|
6 | 6 | import os
|
7 | 7 | import sys
|
8 | 8 |
|
9 |
| -min_version = (2, 3) |
| 9 | +# setuptools has python_requires, but distutils doesn't, so we test the |
| 10 | +# Python version manually: |
| 11 | +min_version = (2, 7) |
10 | 12 | error_msg = ("Sorry, this package is for Python %d.%d and higher only." %
|
11 | 13 | min_version)
|
12 |
| - |
13 | 14 | try:
|
14 | 15 | if sys.version_info < min_version:
|
15 | 16 | sys.exit(error_msg)
|
16 | 17 | except AttributeError: # sys.version_info was introduced in Python 2.0
|
17 | 18 | sys.exit(error_msg)
|
18 | 19 |
|
19 |
| -# Determination of the directory that contains the source code: |
20 |
| -if os.path.exists('uncertainties'): |
21 |
| - # Case of a direct download of a Python-version-specific Git |
22 |
| - # branch: |
23 |
| - package_dir = 'uncertainties' |
24 |
| -else: |
25 |
| - # Case of a PyPI package download: |
26 |
| - if sys.version_info >= (2, 7): |
27 |
| - package_dir = 'uncertainties-py27' |
28 |
| - else: |
29 |
| - package_dir = 'uncertainties-py23' |
30 |
| - |
31 |
| -#! The following code was intended to automatically fetch the version |
32 |
| -# number; however, it fails when run from Python3 if the downloaded |
33 |
| -# code is not the Python 3 version. An alternative approach would be |
34 |
| -# to run 2to3 just before, instead of using build_py_2to3 (which does |
35 |
| -# not modify the source), but care should be taken so that users can |
36 |
| -# run the setup.py script many times anyway. |
37 |
| -## Access to the local uncertainties package (and not to an already |
38 |
| -## installed uncertainties package): |
39 |
| -# sys.path.insert(0, package_dir) |
40 |
| -# uncertainties = __import__(package_dir) |
41 |
| - |
42 | 20 | # Common options for distutils/setuptools's setup():
|
43 | 21 | setup_options = dict(
|
44 | 22 | name='uncertainties',
|
|
157 | 135 |
|
158 | 136 | Main changes:
|
159 | 137 |
|
| 138 | +- 3.1.4: Python 2.7+ is now required. |
160 | 139 | - 3.1.2: Fix for NumPy 1.17 and ``unumpy.ulinalg.pinv()``.
|
161 | 140 | - 3.1: Variables built through a correlation or covariance matrix, and that
|
162 | 141 | have uncertainties that span many orders of magnitude are now
|
|
293 | 272 | .. _main website: http://uncertainties-python-package.readthedocs.io/
|
294 | 273 | .. _code updater: http://uncertainties-python-package.readthedocs.io/en/latest/index.html#migration-from-version-1-to-version-2
|
295 | 274 | .. _formatting: http://uncertainties-python-package.readthedocs.io/en/latest/user_guide.html#printing''',
|
296 |
| - keywords=[ |
297 |
| - 'error propagation', 'uncertainties', 'uncertainty calculations', |
298 |
| - 'standard deviation', 'derivatives', 'partial derivatives', |
299 |
| - 'differentiation' |
300 |
| - ], |
301 | 275 | classifiers=[
|
302 | 276 | 'Development Status :: 5 - Production/Stable',
|
303 | 277 | 'Intended Audience :: Developers',
|
|
307 | 281 | 'License :: OSI Approved :: BSD License',
|
308 | 282 | 'Operating System :: OS Independent',
|
309 | 283 | 'Programming Language :: Python',
|
310 |
| - 'Programming Language :: Python :: 2.3', |
311 |
| - 'Programming Language :: Python :: 2.4', |
312 |
| - 'Programming Language :: Python :: 2.5', |
313 |
| - 'Programming Language :: Python :: 2.6', |
314 | 284 | 'Programming Language :: Python :: 2.7',
|
315 | 285 | 'Programming Language :: Python :: 3',
|
316 | 286 | # Python 3.1 failed because of a problem with NumPy 1.6.1 (whereas
|
|
334 | 304 | 'Topic :: Utilities'
|
335 | 305 | ],
|
336 | 306 |
|
337 |
| - # Where to find the source code: |
338 |
| - package_dir={'uncertainties': package_dir}, |
| 307 | + keywords=[ |
| 308 | + 'error propagation', 'uncertainties', 'uncertainty calculations', |
| 309 | + 'standard deviation', 'derivatives', 'partial derivatives', |
| 310 | + 'differentiation' |
| 311 | + ], |
339 | 312 |
|
340 | 313 | # Files are defined in MANIFEST (which is automatically created by
|
341 | 314 | # python setup.py sdist bdist_wheel):
|
|
344 | 317 | 'uncertainties.lib1to2.fixes'
|
345 | 318 | ],
|
346 | 319 |
|
347 |
| - # Wheels are built for both Python 2 and Python 3: |
| 320 | + # The code runs with both Python 2 and Python 3: |
348 | 321 | options={"bdist_wheel": {"universal": True}}
|
349 | 322 | )
|
350 | 323 |
|
|
355 | 328 |
|
356 | 329 | # Some setuptools-specific options can be added:
|
357 | 330 |
|
358 |
| - addtl_setup_options = { |
| 331 | + addtl_setup_options = dict( |
359 | 332 |
|
360 |
| - 'install_requires': ['future'], |
361 |
| - 'tests_require': ['nose', 'numpy'], |
| 333 | + project_urls={ |
| 334 | + 'Documentation': |
| 335 | + 'https://uncertainties-python-package.readthedocs.io/', |
| 336 | + 'Source': 'https://github.com/lebigot/uncertainties' |
| 337 | + }, |
| 338 | + |
| 339 | + install_requires=['future'], |
| 340 | + |
| 341 | + tests_require=['nose', 'numpy'], |
| 342 | + |
362 | 343 | # Optional dependencies install using:
|
363 | 344 | # `easy_install uncertainties[optional]`
|
364 |
| - 'extras_require': { |
| 345 | + extras_require={ |
365 | 346 | 'optional': ['numpy'],
|
366 | 347 | 'docs': ['sphinx'],
|
367 | 348 | }
|
368 |
| - } |
| 349 | + ) |
369 | 350 |
|
370 | 351 | # easy_install uncertainties[tests] option:
|
371 | 352 | addtl_setup_options['extras_require']['tests'] = (
|
|
381 | 362 | except ImportError:
|
382 | 363 | from distutils.core import setup
|
383 | 364 |
|
384 |
| - # distutils.core.setup is not like setuptools: it does not have an |
385 |
| - # option for automatically calling 2to3 if Python 3 is used, so the |
386 |
| - # conversion is done here: |
387 |
| - if sys.version_info >= (3,): |
388 |
| - import subprocess |
389 |
| - subprocess.check_call(["2to3", "-w", "."]) |
390 |
| - |
391 | 365 | # End of setup definition
|
392 | 366 |
|
393 | 367 | setup(**setup_options)
|
0 commit comments