File: setup.py

package info (click to toggle)
ujson 4.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,060 kB
  • sloc: ansic: 2,601; python: 1,005; cpp: 51; makefile: 41; sh: 15
file content (69 lines) | stat: -rw-r--r-- 1,992 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
from glob import glob

from setuptools import Extension, setup

CLASSIFIERS = """
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Programming Language :: C
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3 :: Only
"""

dconv_source_files = glob("./deps/double-conversion/double-conversion/*.cc")
dconv_source_files.append("./lib/dconv_wrapper.cc")

module1 = Extension(
    "ujson",
    sources=dconv_source_files
    + [
        "./python/ujson.c",
        "./python/objToJSON.c",
        "./python/JSONtoObj.c",
        "./lib/ultrajsonenc.c",
        "./lib/ultrajsondec.c",
    ],
    include_dirs=["./python", "./lib", "/usr/include/double-conversion"],
    extra_compile_args=["-D_GNU_SOURCE"],
    extra_link_args=["-lstdc++", "-lm", "-ldouble-conversion"],
)


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


with open("python/version_template.h") as f:
    version_template = f.read()


def local_scheme(version):
    """Skip the local version (eg. +xyz of 0.6.1.dev4+gdf99fe2)
    to be able to upload to Test PyPI"""
    return ""


setup(
    name="ujson",
    description="Ultra fast JSON encoder and decoder for Python",
    long_description=long_description,
    ext_modules=[module1],
    author="Jonas Tarnstrom",
    download_url="https://github.com/ultrajson/ultrajson",
    platforms=["any"],
    url="https://github.com/ultrajson/ultrajson",
    project_urls={"Source": "https://github.com/ultrajson/ultrajson"},
    use_scm_version={
        "local_scheme": local_scheme,
        "write_to": "python/version.h",
        "write_to_template": version_template,
    },
    setup_requires=["setuptools_scm"],
    python_requires=">=3.6",
    classifiers=[x for x in CLASSIFIERS.split("\n") if x],
)