1#!/usr/bin/python
2from os.path import isfile
3import os
4
5import setuptools
6from setuptools import setup, find_packages
7from setuptools.command.test import test as TestCommand
8
9from distutils.version import LooseVersion
10import warnings
11
12import io
13import sys
14
15if isfile("MANIFEST"):
16    os.unlink("MANIFEST")
17
18if LooseVersion(setuptools.__version__) <= LooseVersion("24.3"):
19    warnings.warn("python_requires requires setuptools version > 24.3",
20                  UserWarning)
21
22
23class Unsupported(TestCommand):
24    def run(self):
25        sys.stderr.write("Running 'test' with setup.py is not supported. "
26                         "Use 'pytest' or 'tox' to run the tests.\n")
27        sys.exit(1)
28
29
30###
31# Load metadata
32PACKAGES = find_packages(where='.', exclude=['dateutil.test'])
33
34
35def README():
36    with io.open('README.rst', encoding='utf-8') as f:
37        readme_lines = f.readlines()
38
39    # The .. doctest directive is not supported by PyPA
40    lines_out = []
41    for line in readme_lines:
42        if line.startswith('.. doctest'):
43            lines_out.append('.. code-block:: python3\n')
44        else:
45            lines_out.append(line)
46
47    return ''.join(lines_out)
48README = README()  # NOQA
49
50
51setup(name="python-dateutil",
52      use_scm_version={
53          'write_to': 'dateutil/_version.py',
54      },
55      description="Extensions to the standard Python datetime module",
56      author="Gustavo Niemeyer",
57      author_email="gustavo@niemeyer.net",
58      maintainer="Paul Ganssle",
59      maintainer_email="dateutil@python.org",
60      url="https://dateutil.readthedocs.io",
61      license="Dual License",
62      long_description=README,
63      long_description_content_type='text/x-rst',
64      packages=PACKAGES,
65      python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*",
66      package_data={"dateutil.zoneinfo": ["dateutil-zoneinfo.tar.gz"]},
67      zip_safe=True,
68      setup_requires=['setuptools_scm'],
69      install_requires=["six >=1.5"],
70      classifiers=[
71          'Development Status :: 5 - Production/Stable',
72          'Intended Audience :: Developers',
73          'License :: OSI Approved :: BSD License',
74          'License :: OSI Approved :: Apache Software License',
75          'Programming Language :: Python',
76          'Programming Language :: Python :: 2',
77          'Programming Language :: Python :: 2.7',
78          'Programming Language :: Python :: 3',
79          'Programming Language :: Python :: 3.3',
80          'Programming Language :: Python :: 3.4',
81          'Programming Language :: Python :: 3.5',
82          'Programming Language :: Python :: 3.6',
83          'Programming Language :: Python :: 3.7',
84          'Topic :: Software Development :: Libraries',
85      ],
86      test_suite="dateutil.test",
87      cmdclass={
88          "test": Unsupported
89      }
90      )
91