summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@googlemail.com>2011-03-24 16:30:06 +0100
committerRalf Gommers <ralf.gommers@googlemail.com>2011-03-27 11:33:36 +0200
commit87e12c1dfc90fae5d0a2576add0c1879df815740 (patch)
tree343d5c3f39f8b45d867ee502df0f14af85c3155d /setup.py
parent7d436cc8994f9efbc51289fdf6c8c520b92e179c (diff)
downloadnumpy-87e12c1dfc90fae5d0a2576add0c1879df815740.tar.gz
BUG: Py3K: fix setup.py to work from a released tarball.
This was first fixed in commit 0131218 (but that broke the paver script), and broken again in commit 13212a5d. Should now work in both cases.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/setup.py b/setup.py
index 14e2d6f99..f0cd6516f 100755
--- a/setup.py
+++ b/setup.py
@@ -94,19 +94,6 @@ if os.path.exists('MANIFEST'): os.remove('MANIFEST')
# a lot more robust than what was previously being used.
builtins.__NUMPY_SETUP__ = True
-# Construct full version info. Needs to be in setup.py namespace, otherwise it
-# can't be accessed from pavement.py at build time.
-FULLVERSION = VERSION
-if os.path.exists('.git'):
- GIT_REVISION = git_version()
-elif os.path.exists('numpy/version.py'):
- # must be a source distribution, use existing version file
- from numpy.version import git_revision as GIT_REVISION
-else:
- GIT_REVISION = "Unknown"
-
-if not ISRELEASED:
- FULLVERSION += '.dev-' + GIT_REVISION[:7]
def write_version_py(filename='numpy/version.py'):
cnt = """
@@ -120,6 +107,20 @@ release = %(isrelease)s
if not release:
version = full_version
"""
+ # 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
+ if os.path.exists('.git'):
+ GIT_REVISION = git_version()
+ elif os.path.exists('numpy/version.py'):
+ # must be a source distribution, use existing version file
+ from numpy.version import git_revision as GIT_REVISION
+ else:
+ GIT_REVISION = "Unknown"
+
+ if not ISRELEASED:
+ FULLVERSION += '.dev-' + GIT_REVISION[:7]
+
a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION,