Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 186 lines (158 sloc) 5.963 kb
36d3c16 @fperez Remove MANIFEST file at startup time, since distutils fails to proper…
fperez authored
1 #!/usr/bin/env python
c8b5a7e Fixed error in setflags and added a few unit tests for test_multiarray
Travis Oliphant authored
2 """NumPy: array processing for numbers, strings, records, and objects.
da9c6da Fix-up setup.py
Travis Oliphant authored
3
c8b5a7e Fixed error in setflags and added a few unit tests for test_multiarray
Travis Oliphant authored
4 NumPy is a general-purpose array-processing package designed to
da9c6da Fix-up setup.py
Travis Oliphant authored
5 efficiently manipulate large multi-dimensional arrays of arbitrary
6 records without sacrificing too much speed for small multi-dimensional
c8b5a7e Fixed error in setflags and added a few unit tests for test_multiarray
Travis Oliphant authored
7 arrays. NumPy is built on the Numeric code base and adds features
da9c6da Fix-up setup.py
Travis Oliphant authored
8 introduced by numarray as well as an extended C-API and the ability to
00a3587 Fix some problems with data-files not being added in top-level and ex…
Travis Oliphant authored
9 create arrays of arbitrary type which also makes NumPy suitable for
10 interfacing with general-purpose data-base applications.
da9c6da Fix-up setup.py
Travis Oliphant authored
11
12 There are also basic facilities for discrete fourier transform,
13 basic linear algebra and random number generation.
14 """
15
16 DOCLINES = __doc__.split("\n")
c415fd1 @pearu Bundle scipy_test,scipy_distutils to scipy_core. See the header of se…
pearu authored
17
083ca64 @fperez Modify the setup routine to indicate that it is being run via a system
fperez authored
18 import __builtin__
e8fa013 @pearu scipy_core package is now functional. Usage:
pearu authored
19 import os
20 import sys
5864bd2 @cournape ... and re
cournape authored
21 import re
5623a7c @cournape Revert using setuptools svn revision, it is broken.
cournape authored
22 import subprocess
c415fd1 @pearu Bundle scipy_test,scipy_distutils to scipy_core. See the header of se…
pearu authored
23
da9c6da Fix-up setup.py
Travis Oliphant authored
24 CLASSIFIERS = """\
19da971 @rkern PyPI metadata fixes.
rkern authored
25 Development Status :: 5 - Production/Stable
da9c6da Fix-up setup.py
Travis Oliphant authored
26 Intended Audience :: Science/Research
27 Intended Audience :: Developers
28 License :: OSI Approved
29 Programming Language :: C
30 Programming Language :: Python
31 Topic :: Software Development
32 Topic :: Scientific/Engineering
33 Operating System :: Microsoft :: Windows
34 Operating System :: POSIX
35 Operating System :: Unix
36 Operating System :: MacOS
37 """
38
cc9a446 @cournape Fix metadata incorrectly defined as tuples.
cournape authored
39 NAME = 'numpy'
40 MAINTAINER = "NumPy Developers"
41 MAINTAINER_EMAIL = "numpy-discussion@scipy.org"
42 DESCRIPTION = DOCLINES[0]
43 LONG_DESCRIPTION = "\n".join(DOCLINES[2:])
44 URL = "http://numpy.scipy.org"
45 DOWNLOAD_URL = "http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103"
46 LICENSE = 'BSD'
47 CLASSIFIERS = filter(None, CLASSIFIERS.split('\n'))
48 AUTHOR = "Travis E. Oliphant, et.al."
49 AUTHOR_EMAIL = "oliphant@enthought.com"
50 PLATFORMS = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"]
5e041cb @cournape Add svn parse for the full version.
cournape authored
51 MAJOR = 1
52 MINOR = 4
53 MICRO = 0
a2ac985 @cournape Generate the version.py file, to help keeping the version synchronize…
cournape authored
54 ISRELEASED = False
5e041cb @cournape Add svn parse for the full version.
cournape authored
55 VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
56
5623a7c @cournape Revert using setuptools svn revision, it is broken.
cournape authored
57 # Return the svn version as a string, raise a ValueError otherwise
58 def svn_version():
44d92ec @cournape BUG #1100: fix svn version detection for localized environments.
cournape authored
59 def _minimal_ext_cmd(cmd):
60 # construct minimal environment
61 env = {}
62 path = os.environ.get('PATH')
63 if path is not None:
64 env['PATH'] = path
65 # LANGUAGE is used on win32
66 env['LANGUAGE'] = 'C'
67 env['LANG'] = 'C'
68 env['LC_ALL'] = 'C'
69 out = subprocess.Popen(cmd, stdout = subprocess.PIPE, env=env).communicate()[0]
70 return out
71
5623a7c @cournape Revert using setuptools svn revision, it is broken.
cournape authored
72 try:
44d92ec @cournape BUG #1100: fix svn version detection for localized environments.
cournape authored
73 out = _minimal_ext_cmd(['svn', 'info'])
5623a7c @cournape Revert using setuptools svn revision, it is broken.
cournape authored
74 except OSError:
44d92ec @cournape BUG #1100: fix svn version detection for localized environments.
cournape authored
75 print(" --- Could not run svn info --- ")
5623a7c @cournape Revert using setuptools svn revision, it is broken.
cournape authored
76 return ""
5bb1aa5 @cournape Fix svn version detection.
cournape authored
77
5623a7c @cournape Revert using setuptools svn revision, it is broken.
cournape authored
78 r = re.compile('Revision: ([0-9]+)')
79 svnver = None
80 for line in out.split('\n'):
81 m = r.match(line)
82 if m:
83 svnver = m.group(1)
52fb78d @cournape Use setuptools svn rev parsing, should be more reliable ?
cournape authored
84
5623a7c @cournape Revert using setuptools svn revision, it is broken.
cournape authored
85 if not svnver:
86 raise ValueError("Error while parsing svn version ?")
87 return svnver
5bb1aa5 @cournape Fix svn version detection.
cournape authored
88
36d3c16 @fperez Remove MANIFEST file at startup time, since distutils fails to proper…
fperez authored
89 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
90 # update it when the contents of directories change.
91 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
92
083ca64 @fperez Modify the setup routine to indicate that it is being run via a system
fperez authored
93 # This is a bit hackish: we are setting a global variable so that the main
94 # numpy __init__ can detect if it is being loaded by the setup routine, to
95 # avoid attempting to load components that aren't built yet. While ugly, it's
96 # a lot more robust than what was previously being used.
97 __builtin__.__NUMPY_SETUP__ = True
98
d8fc4ad @cournape Fix missing distutils log import .
cournape authored
99 FULLVERSION = VERSION
100 if not ISRELEASED:
101 FULLVERSION += '.dev'
102 # If in git or something, bypass the svn rev
103 if os.path.exists('.svn'):
5623a7c @cournape Revert using setuptools svn revision, it is broken.
cournape authored
104 FULLVERSION += svn_version()
d8fc4ad @cournape Fix missing distutils log import .
cournape authored
105
a2ac985 @cournape Generate the version.py file, to help keeping the version synchronize…
cournape authored
106 def write_version_py(filename='numpy/version.py'):
107 cnt = """
914bb15 @cournape Mention that version.py file is now generated.
cournape authored
108 # THIS FILE IS GENERATED FROM NUMPY SETUP.PY
a70c483 @cournape Fix spelling mistake in version module gen.
cournape authored
109 short_version='%(version)s'
a2ac985 @cournape Generate the version.py file, to help keeping the version synchronize…
cournape authored
110 version='%(version)s'
111 release=%(isrelease)s
112
113 if not release:
114 version += '.dev'
115 import os
116 svn_version_file = os.path.join(os.path.dirname(__file__),
117 'core','__svn_version__.py')
118 if os.path.isfile(svn_version_file):
119 import imp
120 svn = imp.load_module('numpy.core.__svn_version__',
121 open(svn_version_file),
122 svn_version_file,
123 ('.py','U',1))
124 version += svn.version
125 """
126 a = open(filename, 'w')
127 try:
128 a.write(cnt % {'version': VERSION, 'isrelease': str(ISRELEASED)})
129 finally:
130 a.close()
131
471196b @pearu Introduced configuration kw argument to setup. This fixes long lasted…
pearu authored
132 def configuration(parent_package='',top_path=None):
133 from numpy.distutils.misc_util import Configuration
134
17d7cfe @pearu Fix version machinery and pkg information requests.
pearu authored
135 config = Configuration(None, parent_package, top_path)
471196b @pearu Introduced configuration kw argument to setup. This fixes long lasted…
pearu authored
136 config.set_options(ignore_setup_xxx_py=True,
137 assume_default_configuration=True,
138 delegate_options_to_subpackages=True,
139 quiet=True)
0b77f0e @jarrodmillman ran reindent.py to clean up whitespace
jarrodmillman authored
140
471196b @pearu Introduced configuration kw argument to setup. This fixes long lasted…
pearu authored
141 config.add_subpackage('numpy')
0b77f0e @jarrodmillman ran reindent.py to clean up whitespace
jarrodmillman authored
142
7b76ca7 @pearu Fix ticket 535.
pearu authored
143 config.add_data_files(('numpy','*.txt'),
144 ('numpy','COMPATIBILITY'),
145 ('numpy','site.cfg.example'))
17d7cfe @pearu Fix version machinery and pkg information requests.
pearu authored
146
147 config.get_version('numpy/version.py') # sets config.version
00a3587 Fix some problems with data-files not being added in top-level and ex…
Travis Oliphant authored
148
471196b @pearu Introduced configuration kw argument to setup. This fixes long lasted…
pearu authored
149 return config
150
14db419 Fixing for new distutils
Travis Oliphant authored
151 def setup_package():
c415fd1 @pearu Bundle scipy_test,scipy_distutils to scipy_core. See the header of se…
pearu authored
152
da9c6da Fix-up setup.py
Travis Oliphant authored
153 from numpy.distutils.core import setup
e8fa013 @pearu scipy_core package is now functional. Usage:
pearu authored
154
155 old_path = os.getcwd()
d190674 @pearu Now one can run 'python /full/path/to/scipy_core/setup.py'
pearu authored
156 local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
157 os.chdir(local_path)
14db419 Fixing for new distutils
Travis Oliphant authored
158 sys.path.insert(0,local_path)
e8fa013 @pearu scipy_core package is now functional. Usage:
pearu authored
159
a2ac985 @cournape Generate the version.py file, to help keeping the version synchronize…
cournape authored
160 # Rewrite the version file everytime
161 if os.path.exists('numpy/version.py'): os.remove('numpy/version.py')
162 write_version_py()
163
e8fa013 @pearu scipy_core package is now functional. Usage:
pearu authored
164 try:
17d7cfe @pearu Fix version machinery and pkg information requests.
pearu authored
165 setup(
c253b72 @cournape Use global for distutils metat-data, so that we can pull them from pa…
cournape authored
166 name=NAME,
167 maintainer=MAINTAINER,
168 maintainer_email=MAINTAINER_EMAIL,
169 description=DESCRIPTION,
170 long_description=LONG_DESCRIPTION,
171 url=URL,
172 download_url=DOWNLOAD_URL,
173 license=LICENSE,
174 classifiers=CLASSIFIERS,
175 author=AUTHOR,
176 author_email=AUTHOR_EMAIL,
177 platforms=PLATFORMS,
17d7cfe @pearu Fix version machinery and pkg information requests.
pearu authored
178 configuration=configuration )
e8fa013 @pearu scipy_core package is now functional. Usage:
pearu authored
179 finally:
180 del sys.path[0]
181 os.chdir(old_path)
14db419 Fixing for new distutils
Travis Oliphant authored
182 return
c415fd1 @pearu Bundle scipy_test,scipy_distutils to scipy_core. See the header of se…
pearu authored
183
14db419 Fixing for new distutils
Travis Oliphant authored
184 if __name__ == '__main__':
e8fa013 @pearu scipy_core package is now functional. Usage:
pearu authored
185 setup_package()
Something went wrong with that request. Please try again.