Skip to content

Commit

Permalink
Changed default policy for dirty repositories to 'report' (#41)
Browse files Browse the repository at this point in the history
* Changed default policy for dirty repositories to 'report'

* Updated pkg_bundle version.py to match autover's.

* Test that 'dirty' appears in package name in such a way that it can't be uploaded to pypi, and that conda won't build.
  • Loading branch information
jlstevens authored and jbednar committed Apr 23, 2018
1 parent 50429cc commit dfd0bec
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 22 deletions.
34 changes: 21 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,6 @@ jobs:
script:
- doit $EXTRA verify_installed_version --example=$MODULE

##############################

# test that dirty detection works

- <<: *example_tests
python: 3.6
env:
- DESC="check dirty"
- MODULE=pkg_bundle
- EXTRA="--dir=/tmp/123"
install: true
script:
- doit $EXTRA check_dirty_detection

##############################

Expand Down Expand Up @@ -303,3 +290,24 @@ jobs:
- doit $EXTRA git_init
script:
- doit $EXTRA build_conda_package -c pyviz/label/dev


##############################

# test that -dirty appears in package name for dirty repo

- <<: *example_tests
python: 3.6
env:
- DESC="check dirty pip"
- MODULE=pkg_bundle
- EXTRA="--dir=/tmp/123"
install: true
script: doit $EXTRA check_dirty_package_name

# test on autover itself
- <<: *conda_default
stage: test
env: DESC="check dirty conda"
install: true
script: doit $EXTRA check_dirty_fails_conda_package
4 changes: 2 additions & 2 deletions autover/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def verify(self, string_version=None):

@classmethod
def get_setup_version(cls, setup_path, reponame, describe=False,
dirty='raise', archive_commit=None):
dirty='report', archive_commit=None):
"""
Helper for use in setup.py to get the version from the .version file (if available)
or more up-to-date information from git describe (if available).
Expand Down Expand Up @@ -478,7 +478,7 @@ def extract_directory_tag(cls, setup_path, reponame):


@classmethod
def setup_version(cls, setup_path, reponame, archive_commit=None, dirty='raise'):
def setup_version(cls, setup_path, reponame, archive_commit=None, dirty='report'):
info = {}
git_describe = None
try:
Expand Down
19 changes: 14 additions & 5 deletions dodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,25 @@ def task_original_script():
]
}

def task_check_dirty_detection():
def task_check_dirty_package_name():
# TODO: test should be less bash
return {
'actions':[
'echo "#dirty" >> setup.py',
'git describe --dirty --long',
'! python setup.py sdist > test-dirty-check 2>&1',
'grep "AssertionError: Repository is in a dirty state." test-dirty-check'
'python setup.py sdist',
'python -c "import os,glob; assert len(glob.glob(\'dist/*+g*.dirty.tar.gz\'))==1, os.listdir(\'dist\')"',
]}

def task_check_dirty_fails_conda_package():
# TODO: test should be less bash
return {
'actions':[
'echo "#dirty" >> setup.py',
'git describe --dirty --long',
'! conda build conda.recipe > conda-dirty-check 2>&1',
'grep "Error: bad character \'-\' in package/version" conda-dirty-check'
],
'teardown':[
'cat test-dirty-check'
'python -c "print(open(\'conda-dirty-check\').read())"'
]}

4 changes: 2 additions & 2 deletions examples/pkg_bundle/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def verify(self, string_version=None):

@classmethod
def get_setup_version(cls, setup_path, reponame, describe=False,
dirty='raise', archive_commit=None):
dirty='report', archive_commit=None):
"""
Helper for use in setup.py to get the version from the .version file (if available)
or more up-to-date information from git describe (if available).
Expand Down Expand Up @@ -478,7 +478,7 @@ def extract_directory_tag(cls, setup_path, reponame):


@classmethod
def setup_version(cls, setup_path, reponame, archive_commit=None, dirty='raise'):
def setup_version(cls, setup_path, reponame, archive_commit=None, dirty='report'):
info = {}
git_describe = None
try:
Expand Down

0 comments on commit dfd0bec

Please sign in to comment.