summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-03-27 11:15:36 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-03-27 11:15:36 +0000
commita2ac985620c7c681861cd856068f57d272d9d03f (patch)
tree99669f33b22f56293c42239946ee1c7c464180e4 /setup.py
parentc253b72d38b0e1cc51a89c50398a0a1262c40043 (diff)
downloadnumpy-a2ac985620c7c681861cd856068f57d272d9d03f.tar.gz
Generate the version.py file, to help keeping the version synchronized everywhere (doc, paver, etc...).
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 51742839c..92745a7a7 100755
--- a/setup.py
+++ b/setup.py
@@ -46,6 +46,8 @@ CLASSIFIERS = filter(None, CLASSIFIERS.split('\n')),
AUTHOR = "Travis E. Oliphant, et.al.",
AUTHOR_EMAIL = "oliphant@enthought.com",
PLATFORMS = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
+VERSION = '1.4.0'
+ISRELEASED = False
# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
@@ -57,6 +59,31 @@ if os.path.exists('MANIFEST'): os.remove('MANIFEST')
# a lot more robust than what was previously being used.
__builtin__.__NUMPY_SETUP__ = True
+def write_version_py(filename='numpy/version.py'):
+ cnt = """
+short_version='%(version)s'
+version='%(version)s'
+release=%(isrelease)s
+
+if not release:
+ version += '.dev'
+ import os
+ svn_version_file = os.path.join(os.path.dirname(__file__),
+ 'core','__svn_version__.py')
+ if os.path.isfile(svn_version_file):
+ import imp
+ svn = imp.load_module('numpy.core.__svn_version__',
+ open(svn_version_file),
+ svn_version_file,
+ ('.py','U',1))
+ version += svn.version
+"""
+ a = open(filename, 'w')
+ try:
+ a.write(cnt % {'version': VERSION, 'isrelease': str(ISRELEASED)})
+ finally:
+ a.close()
+
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
@@ -85,6 +112,10 @@ def setup_package():
os.chdir(local_path)
sys.path.insert(0,local_path)
+ # Rewrite the version file everytime
+ if os.path.exists('numpy/version.py'): os.remove('numpy/version.py')
+ write_version_py()
+
try:
setup(
name=NAME,