Skip to content

Commit

Permalink
Merge pull request #19 from dwhswenson/0.0.7
Browse files Browse the repository at this point in the history
0.0.7
  • Loading branch information
dwhswenson authored Nov 1, 2017
2 parents d0f5c70 + 03d4f8a commit 931ae31
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 27 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ env:

before_install:
- echo "before install"
- git fetch --tags

install:
- pip install -r requirements.txt
Expand Down
50 changes: 27 additions & 23 deletions autorelease/check_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,15 @@ def __init__(self, versions, setup, repo_path='.', output=None):
)
self.desired_version = vers.Version(versions['setup.py'])
super(DefaultCheckRunner, self).__init__(output=output)
self.tests = [
(
self.version_checks.consistency, [],
{'include_package': False}
),
(
self.git_repo_checks.reasonable_desired_version, [],
{'desired_version': self.desired_version}
)
]
self.consistency_test = (
self.version_checks.consistency, [],
{'include_package': False}
)
self.tests = [self.consistency_test]
self.release_branches = ['stable']
self.tag_branch = \
self.git_repo_checks.tag_from_version(self.desired_version)


def _is_release_tests(self, expected):
return [
Expand All @@ -74,24 +72,30 @@ def _is_release_tests(self, expected):
'expected': expected})
]

def _reasonable_desired_version_test(self, allow_equal):
return [
(
self.git_repo_checks.reasonable_desired_version, [],
{'desired_version': self.desired_version,
'allow_equal': allow_equal}
)
]

def select_tests_from_sysargs(self):
# TODO: this can be cleaned up by separating reusable parts
parser = argparse.ArgumentParser()
parser.add_argument('--branch', type=str)
opts = parser.parse_args()
if opts.branch in self.release_branches:
print("Testing as release")
tests = self.release_tests
print("TESTING AS RELEASE")
allow_equal = opts.branch == self.tag_branch
tests = (self.tests
+ self._reasonable_desired_version_test(allow_equal)
+ self._is_release_tests(expected=True))
else:
print("Testing as nonrelease")
tests = self.nonrelease_tests
return tests
print("TESTING AS NONRELEASE")
tests = (self.tests
+ self._reasonable_desired_version_test(False)
+ self._is_release_tests(expected=False))

# NB: branch checks don't work on Travis
@property
def release_tests(self):
return self.tests + self._is_release_tests(expected=True)

@property
def nonrelease_tests(self):
return self.tests + self._is_release_tests(expected=False)
return tests
14 changes: 12 additions & 2 deletions autorelease/git_repo_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ def __init__(self, repo_path='.'):
self.stable_branch = 'stable'
self.dev_branch = 'master'

@staticmethod
def tag_from_version(version):
return "v" + str(version)

def in_required_branch(self, required_branch='stable'):
msg = ""
current_branch = self.repo.active_branch.name
Expand All @@ -23,7 +27,7 @@ def _versions_from_tags(self):
# TODO: may be better to replace with regex for reusability
return [vers.Version(v) for v in tag_versions]

def reasonable_desired_version(self, desired_version):
def reasonable_desired_version(self, desired_version, allow_equal=False):
"""
Determine whether the desired version is a reasonable next version.
Expand All @@ -49,7 +53,13 @@ def reasonable_desired_version(self, desired_version):

update_str = str(max_version) + " -> " + str(desired_version)

if vers.Version(desired_version) < vers.Version(max_version):
v_desired = vers.Version(desired_version)
v_max = vers.Version(max_version)

if allow_equal and v_desired == v_max:
return ""

if v_desired < v_max:
return ("Bad update: New version doesn't increase on last tag: "
+ update_str + "\n")

Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package:
name: autorelease
# add ".dev0" for unreleased versions
version: "0.0.6"
version: "0.0.7"

source:
path: ../../
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
####################### USER SETUP AREA #################################
# * VERSION: base version (do not include .dev0, etc -- that's automatic)
# * IS_RELEASE: whether this is a release
VERSION = "0.0.6"
VERSION = "0.0.7"
IS_RELEASE = True

DEV_NUM = 0 # always 0: we don't do public (pypi) .dev releases
Expand Down

0 comments on commit 931ae31

Please sign in to comment.