File: setup.py

package info (click to toggle)
python-ciso8601 2.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 372 kB
  • sloc: python: 1,294; ansic: 939; sh: 22; makefile: 7
file content (81 lines) | stat: -rw-r--r-- 2,958 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import os

from setuptools import setup, Extension

# workaround for open() with encoding='' python2/3 compatibility
from io import open

with open("README.rst", encoding="utf-8") as file:
    long_description = file.read()

# We want to force all warnings to be considered errors. That way we get to catch potential issues during
# development and at PR review time.
# But since ciso8601 is a source distribution, exotic compiler configurations can cause spurious warnings that
# would fail the installation. So we only want to treat warnings as errors during development.
if os.environ.get("STRICT_WARNINGS", "0") == "1":
    # We can't use `extra_compile_args`, since the cl.exe (Windows) and gcc compilers don't use the same flags.
    # Further, there is not an easy way to tell which compiler is being used.
    # Instead we rely on each compiler looking at their appropriate environment variable.

    # GCC/Clang
    try:
        _ = os.environ["CFLAGS"]
    except KeyError:
        os.environ["CFLAGS"] = ""
    os.environ["CFLAGS"] += " -Werror"

    # cl.exe
    try:
        _ = os.environ["_CL_"]
    except KeyError:
        os.environ["_CL_"] = ""
    os.environ["_CL_"] += " /WX"

VERSION = "2.3.3"
CISO8601_CACHING_ENABLED = int(os.environ.get('CISO8601_CACHING_ENABLED', '1') == '1')

setup(
    name="ciso8601",
    version=VERSION,
    description="Fast ISO8601 date time parser for Python written in C",
    long_description=long_description,
    url="https://github.com/closeio/ciso8601",
    license="MIT",
    ext_modules=[
        Extension(
            "ciso8601",
            sources=["module.c", "timezone.c", "isocalendar.c"],
            define_macros=[
                ("CISO8601_VERSION", VERSION),
                ("CISO8601_CACHING_ENABLED", CISO8601_CACHING_ENABLED),
            ],
        )
    ],
    packages=["ciso8601"],
    package_data={"ciso8601": ["__init__.pyi", "py.typed"]},
    test_suite="tests",
    tests_require=[
        "pytz",
    ],
    classifiers=[
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        "Programming Language :: Python :: 2",
        "Programming Language :: Python :: 2.7",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.4",
        "Programming Language :: Python :: 3.5",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "Programming Language :: Python :: 3.11",
        "Programming Language :: Python :: 3.12",
        "Programming Language :: Python :: 3.13",
        "Programming Language :: Python :: 3.14",
        "Topic :: Software Development :: Libraries :: Python Modules",
    ],
)