Tomi Pieviläinen | 40996e0 | 2012-03-03 11:43:08 +0200 | [diff] [blame] | 1 | #!/usr/bin/python |
Yaron de Leeuw | 3c316b5 | 2014-12-01 22:01:11 +0200 | [diff] [blame] | 2 | from os.path import isfile |
niemeyer | debf3cd | 2005-02-23 18:33:30 +0000 | [diff] [blame] | 3 | import os |
niemeyer | 313ef14 | 2007-11-12 14:06:05 +0000 | [diff] [blame] | 4 | |
Jake Chorley | cee2c4f | 2017-12-06 17:05:40 +0000 | [diff] [blame] | 5 | import setuptools |
Paul Ganssle | 59acb7c | 2017-11-10 13:25:14 -0500 | [diff] [blame] | 6 | from setuptools import setup, find_packages |
Laszlo Kiss-Kollar | 6e6b8f1 | 2017-12-06 14:39:01 +0000 | [diff] [blame] | 7 | from setuptools.command.test import test as TestCommand |
niemeyer | 55254c5 | 2008-08-07 02:46:52 +0000 | [diff] [blame] | 8 | |
Jake Chorley | cee2c4f | 2017-12-06 17:05:40 +0000 | [diff] [blame] | 9 | from distutils.version import LooseVersion |
| 10 | import warnings |
| 11 | |
Pierre Gergondet | f39c1ae | 2018-03-26 12:47:58 +0900 | [diff] [blame] | 12 | import io |
| 13 | |
niemeyer | db8b18d | 2005-12-22 15:02:22 +0000 | [diff] [blame] | 14 | if isfile("MANIFEST"): |
niemeyer | debf3cd | 2005-02-23 18:33:30 +0000 | [diff] [blame] | 15 | os.unlink("MANIFEST") |
| 16 | |
Jake Chorley | cee2c4f | 2017-12-06 17:05:40 +0000 | [diff] [blame] | 17 | if LooseVersion(setuptools.__version__) <= LooseVersion("24.3"): |
| 18 | warnings.warn("python_requires requires setuptools version > 24.3", |
| 19 | UserWarning) |
| 20 | |
Laszlo Kiss-Kollar | 6e6b8f1 | 2017-12-06 14:39:01 +0000 | [diff] [blame] | 21 | |
| 22 | class Unsupported(TestCommand): |
| 23 | def run(self): |
| 24 | print("Running 'test' with setup.py is not supported. " |
| 25 | "Use 'pytest' or 'tox' to run the tests.") |
| 26 | |
Paul Ganssle | 6c03246 | 2018-03-24 14:10:04 -0400 | [diff] [blame] | 27 | ### |
| 28 | # Load metadata |
| 29 | PACKAGES = find_packages(where='.', exclude=['dateutil.test']) |
| 30 | |
| 31 | def README(): |
Pierre Gergondet | f39c1ae | 2018-03-26 12:47:58 +0900 | [diff] [blame] | 32 | with io.open('README.rst', encoding='utf-8') as f: |
Paul Ganssle | df06183 | 2018-03-24 14:51:53 -0400 | [diff] [blame] | 33 | readme_lines = f.readlines() |
| 34 | |
| 35 | # The .. doctest directive is not supported by PyPA |
| 36 | lines_out = [] |
| 37 | doctest_line_found = False |
| 38 | for line in readme_lines: |
| 39 | if line.startswith('.. doctest'): |
| 40 | doctest_line_found = True |
| 41 | lines_out.append('.. code-block:: python3\n') |
| 42 | else: |
| 43 | lines_out.append(line) |
| 44 | |
| 45 | return ''.join(lines_out) |
Paul Ganssle | 6c03246 | 2018-03-24 14:10:04 -0400 | [diff] [blame] | 46 | README = README() |
Laszlo Kiss-Kollar | 6e6b8f1 | 2017-12-06 14:39:01 +0000 | [diff] [blame] | 47 | |
niemeyer | cc77d43 | 2003-10-09 02:57:39 +0000 | [diff] [blame] | 48 | setup(name="python-dateutil", |
Iván Matellanes | 600ba20 | 2017-12-06 20:50:51 +0000 | [diff] [blame] | 49 | use_scm_version={ |
| 50 | 'write_to': 'dateutil/_version.py', |
| 51 | }, |
Yaron de Leeuw | 3c316b5 | 2014-12-01 22:01:11 +0200 | [diff] [blame] | 52 | description="Extensions to the standard Python datetime module", |
Paul Ganssle | 31252b2 | 2017-12-05 14:06:12 +0000 | [diff] [blame] | 53 | author="Gustavo Niemeyer", |
| 54 | author_email="gustavo@niemeyer.net", |
| 55 | maintainer="Paul Ganssle", |
| 56 | maintainer_email="dateutil@python.org", |
Adam Chainz | 1119b48 | 2016-05-29 12:50:15 +0100 | [diff] [blame] | 57 | url="https://dateutil.readthedocs.io", |
Paul Ganssle | 7ac48be | 2018-03-24 09:53:00 -0400 | [diff] [blame] | 58 | license="Dual License", |
Paul Ganssle | 6c03246 | 2018-03-24 14:10:04 -0400 | [diff] [blame] | 59 | long_description=README, |
| 60 | long_description_content_type='text/x-rst', |
Paul Ganssle | 59acb7c | 2017-11-10 13:25:14 -0500 | [diff] [blame] | 61 | packages=PACKAGES, |
Paul Ganssle | f533b4a | 2018-03-11 10:54:48 -0400 | [diff] [blame] | 62 | python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*", |
Yaron de Leeuw | 3c316b5 | 2014-12-01 22:01:11 +0200 | [diff] [blame] | 63 | package_data={"dateutil.zoneinfo": ["dateutil-zoneinfo.tar.gz"]}, |
| 64 | zip_safe=True, |
| 65 | requires=["six"], |
Iván Matellanes | 600ba20 | 2017-12-06 20:50:51 +0000 | [diff] [blame] | 66 | setup_requires=['setuptools_scm'], |
Yaron de Leeuw | 1119ee7 | 2014-12-14 21:42:37 +0200 | [diff] [blame] | 67 | install_requires=["six >=1.5"], # XXX fix when packaging is sane again |
Yaron de Leeuw | 3c316b5 | 2014-12-01 22:01:11 +0200 | [diff] [blame] | 68 | classifiers=[ |
Tomi Pieviläinen | aefdb2b | 2012-04-29 16:32:22 +0300 | [diff] [blame] | 69 | 'Development Status :: 5 - Production/Stable', |
| 70 | 'Intended Audience :: Developers', |
| 71 | 'License :: OSI Approved :: BSD License', |
Paul Ganssle | 4c4c7e9 | 2018-03-11 19:48:24 -0400 | [diff] [blame] | 72 | 'License :: OSI Approved :: Apache Software License', |
Tomi Pieviläinen | aefdb2b | 2012-04-29 16:32:22 +0300 | [diff] [blame] | 73 | 'Programming Language :: Python', |
| 74 | 'Programming Language :: Python :: 2', |
Tomi Pieviläinen | aefdb2b | 2012-04-29 16:32:22 +0300 | [diff] [blame] | 75 | 'Programming Language :: Python :: 2.7', |
| 76 | 'Programming Language :: Python :: 3', |
Tomi Pieviläinen | 8c6026b | 2013-11-01 10:37:15 +0200 | [diff] [blame] | 77 | 'Programming Language :: Python :: 3.3', |
Yaron de Leeuw | b759afd | 2014-11-27 22:13:34 +0200 | [diff] [blame] | 78 | 'Programming Language :: Python :: 3.4', |
Thomas A Caswell | 6827516 | 2015-12-07 21:38:53 -0500 | [diff] [blame] | 79 | 'Programming Language :: Python :: 3.5', |
Paul Ganssle | 418b8ae | 2016-11-06 20:54:45 -0500 | [diff] [blame] | 80 | 'Programming Language :: Python :: 3.6', |
Paul Ganssle | f533b4a | 2018-03-11 10:54:48 -0400 | [diff] [blame] | 81 | 'Programming Language :: Python :: 3.7', |
Tomi Pieviläinen | aefdb2b | 2012-04-29 16:32:22 +0300 | [diff] [blame] | 82 | 'Topic :: Software Development :: Libraries', |
Yaron de Leeuw | 7d13f30 | 2014-11-24 17:46:03 +0200 | [diff] [blame] | 83 | ], |
Laszlo Kiss-Kollar | 6e6b8f1 | 2017-12-06 14:39:01 +0000 | [diff] [blame] | 84 | test_suite="dateutil.test", |
| 85 | cmdclass={ |
| 86 | "test": Unsupported |
| 87 | } |
niemeyer | 68ae275 | 2003-09-28 01:20:02 +0000 | [diff] [blame] | 88 | ) |