Skip to content

Commit

Permalink
Modify basesetup some more
Browse files Browse the repository at this point in the history
  • Loading branch information
mpharrigan committed Mar 17, 2016
1 parent 7ce2160 commit 5f96ca8
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions basesetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,37 +233,36 @@ def _minimal_ext_cmd(cmd):
return GIT_REVISION


def write_version_py(VERSION, ISRELEASED, filename):
def write_version_py(version, isreleased, filename):
cnt = """
# THIS FILE IS GENERATED FROM SETUP.PY
short_version = '%(version)s'
version = '%(version)s'
full_version = '%(full_version)s'
git_revision = '%(git_revision)s'
release = %(isrelease)s
if not release:
version = full_version
# This file is generated in setup.py at build time.
version = '{version}'
short_version = '{short_version}'
full_version = '{full_version}'
git_revision = '{git_revision}'
release = {release}
"""
# Adding the git rev number needs to be done inside write_version_py(),
# otherwise the import of numpy.version messes up the build under Python 3.
FULLVERSION = VERSION
# git_revision
if os.path.exists('.git'):
GIT_REVISION = git_version()
git_revision = git_version()
else:
GIT_REVISION = 'Unknown'

if not ISRELEASED:
FULLVERSION += '.dev-' + GIT_REVISION[:7]
git_revision = 'Unknown'

a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION,
'full_version': FULLVERSION,
'git_revision': GIT_REVISION,
'isrelease': str(ISRELEASED)})
finally:
a.close()
# short_version, full_version
if isreleased:
full_version = version
short_version = version
else:
full_version = ("{version}+{git_revision}"
.format(version=version, git_revision=git_revision))
short_version = version

with open(filename, 'w') as f:
f.write(cnt.format(version=version,
short_version=short_version,
full_version=full_version,
git_revision=git_revision,
release=isreleased))


class StaticLibrary(Extension):
Expand Down

0 comments on commit 5f96ca8

Please sign in to comment.