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
13
14if isfile("MANIFEST"):
15    os.unlink("MANIFEST")
16
17if LooseVersion(setuptools.__version__) <= LooseVersion("24.3"):
18    warnings.warn("python_requires requires setuptools version > 24.3",
19                  UserWarning)
20
21
22class 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
27###
28# Load metadata
29PACKAGES = find_packages(where='.', exclude=['dateutil.test'])
30
31def README():
32    with io.open('README.rst', encoding='utf-8') as f:
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)
46README = README()
47
48setup(name="python-dateutil",
49      use_scm_version={
50          'write_to': 'dateutil/_version.py',
51      },
52      description="Extensions to the standard Python datetime module",
53      author="Gustavo Niemeyer",
54      author_email="gustavo@niemeyer.net",
55      maintainer="Paul Ganssle",
56      maintainer_email="dateutil@python.org",
57      url="https://dateutil.readthedocs.io",
58      license="Dual License",
59      long_description=README,
60      long_description_content_type='text/x-rst',
61      packages=PACKAGES,
62      python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*",
63      package_data={"dateutil.zoneinfo": ["dateutil-zoneinfo.tar.gz"]},
64      zip_safe=True,
65      requires=["six"],
66      setup_requires=['setuptools_scm'],
67      install_requires=["six >=1.5"],  # XXX fix when packaging is sane again
68      classifiers=[
69          'Development Status :: 5 - Production/Stable',
70          'Intended Audience :: Developers',
71          'License :: OSI Approved :: BSD License',
72          'License :: OSI Approved :: Apache Software License',
73          'Programming Language :: Python',
74          'Programming Language :: Python :: 2',
75          'Programming Language :: Python :: 2.7',
76          'Programming Language :: Python :: 3',
77          'Programming Language :: Python :: 3.3',
78          'Programming Language :: Python :: 3.4',
79          'Programming Language :: Python :: 3.5',
80          'Programming Language :: Python :: 3.6',
81          'Programming Language :: Python :: 3.7',
82          'Topic :: Software Development :: Libraries',
83      ],
84      test_suite="dateutil.test",
85      cmdclass={
86          "test": Unsupported
87      }
88      )
89