Skip to content

Commit 87e9a8a

Browse files
Fixed stripping of Travis Tag
1 parent f0d9dd4 commit 87e9a8a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

setup.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,17 @@
2626
), session='None')
2727

2828
# Try to write VERSION file from Travis tag
29-
TRAVIS_TAG = environ.get('TRAVIS_TAG').strip()
30-
if TRAVIS_TAG:
29+
TRAVIS_TAG = environ.get('TRAVIS_TAG')
30+
if TRAVIS_TAG and TRAVIS_TAG.strip():
3131
with open('VERSION', 'w') as version_file:
32-
version_file.write(TRAVIS_TAG)
32+
version_file.write(TRAVIS_TAG.strip())
3333

3434
# Try to read VERSION from file
35-
with open('VERSION', 'r') as version_file:
36-
VERSION = version_file.read().strip()
37-
38-
# If VERSION is not defined, raise error
39-
if not VERSION:
40-
raise EnvironmentError('VERSION not defined.')
35+
try:
36+
with open('VERSION', 'r') as version_file:
37+
VERSION = version_file.read().strip()
38+
except IOError:
39+
raise EnvironmentError('VERSION file could not be read.')
4140

4241
PACKAGES = find_packages(exclude=['tests*'])
4342

0 commit comments

Comments
 (0)