Skip to content

Commit 189cbca

Browse files
Requested changes
1 parent 33eeb65 commit 189cbca

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from os.path import abspath, dirname, exists, join
1010
from os import environ
1111
from setuptools import find_packages, setup
12+
from warnings import warn
1213

1314
try: # for pip >= 10
1415
# noinspection PyProtectedMember,PyPackageRequirements
@@ -25,18 +26,25 @@
2526
'sdk.txt',
2627
), session='None')
2728

28-
# Try to write VERSION file from Travis tag
29-
TRAVIS_TAG = environ.get('TRAVIS_TAG')
30-
if TRAVIS_TAG and TRAVIS_TAG.strip():
31-
with open('VERSION', 'w') as version_file:
32-
version_file.write(TRAVIS_TAG.strip())
29+
# Get path to version file
30+
version_path = join(
31+
dirname(abspath(__file__)),
32+
'VERSION'
33+
)
34+
35+
# Try to write version file from Travis tag
36+
travis_tag = environ.get('TRAVIS_TAG')
37+
if travis_tag and travis_tag.strip():
38+
with open(version_path, 'w') as version_file:
39+
version_file.write(travis_tag.strip())
3340

34-
# Try to read VERSION from file
41+
# Try to read version from file
3542
try:
36-
with open('VERSION', 'r') as version_file:
43+
with open(version_path, 'r') as version_file:
3744
VERSION = version_file.read().strip()
3845
except IOError:
39-
raise EnvironmentError('VERSION file could not be read.')
46+
warn('`{}` file could not be read.'.format(version_path), RuntimeWarning)
47+
VERSION = ''
4048

4149
PACKAGES = find_packages(exclude=['tests*'])
4250

0 commit comments

Comments
 (0)