66"""
77
88import sys
9- from ast import Assign , Constant , Name , parse
9+ from ast import Assign , Name , parse
1010from functools import partial
1111from operator import attrgetter
1212from os import path
1515from setuptools import find_packages , setup
1616
1717if sys .version_info [:2 ] >= (3 , 12 ):
18- import os
19- from sysconfig import _BASE_EXEC_PREFIX as BASE_EXEC_PREFIX
20- from sysconfig import _BASE_PREFIX as BASE_PREFIX
21- from sysconfig import _EXEC_PREFIX as EXEC_PREFIX
22- from sysconfig import _PREFIX as PREFIX
23- from sysconfig import get_python_version
24-
25- Str = type (
26- "_Never" ,
27- tuple (),
28- {
29- "__init__" : lambda s = None , n = None , constant_value = None , string = None , col_offset = None , lineno = None : s
30- or n
31- },
32- )
18+ from ast import Del as Str
19+ else :
20+ from ast import Str
3321
34- def is_virtual_environment ():
35- """
36- Whether one is in a virtual environment
37- """
38- return sys .base_prefix != sys .prefix or hasattr (sys , "real_prefix" )
39-
40- def get_python_lib (plat_specific = 0 , standard_lib = 0 , prefix = None ):
41- """Return the directory containing the Python library (standard or
42- site additions).
43-
44- If 'plat_specific' is true, return the directory containing
45- platform-specific modules, i.e. any module from a non-pure-Python
46- module distribution; otherwise, return the platform-shared library
47- directory. If 'standard_lib' is true, return the directory
48- containing standard Python library modules; otherwise, return the
49- directory for site-specific modules.
50-
51- If 'prefix' is supplied, use it instead of sys.base_prefix or
52- sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
53- """
54- is_default_prefix = not prefix or os .path .normpath (prefix ) in (
55- "/usr" ,
56- "/usr/local" ,
57- )
58- prefix = (
59- prefix or plat_specific and (BASE_EXEC_PREFIX or BASE_PREFIX )
60- if standard_lib
61- else (EXEC_PREFIX or PREFIX )
62- )
22+ if sys .version_info [0 ] == 2 :
23+ from itertools import ifilter as filter
24+ from itertools import imap as map
6325
64- class DistutilsPlatformError (Exception ):
65- """DistutilsPlatformError"""
26+ if sys .version_info [:2 ] > (3 , 7 ):
27+ from ast import Constant
28+ else :
29+ from ast import expr
6630
67- assert os .name in frozenset (("posix" , "nt" )), DistutilsPlatformError (
68- "I don't know where Python installs its library "
69- "on platform '{}'" .format (os .name )
70- )
71- return (
72- (
73- # plat_specific or standard_lib:
74- # Platform-specific modules (any module from a non-pure-Python
75- # module distribution) or standard Python library modules.
76- # else:
77- # Pure Python
78- lambda libpython : (
79- libpython
80- if standard_lib
81- else (
82- os .path .join (prefix , "lib" , "python3" , "dist-packages" )
83- if is_default_prefix and not is_virtual_environment ()
84- else os .path .join (libpython , "site-packages" )
85- )
86- )
87- )(
88- os .path .join (
89- prefix ,
90- sys .platlibdir if plat_specific or standard_lib else "lib" ,
91- "python" + get_python_version (),
92- )
93- )
94- if os .name == "posix"
95- else (
96- os .path .join (prefix , "Lib" )
97- if standard_lib
98- else os .path .join (prefix , "Lib" , "site-packages" )
99- )
100- )
31+ # Constant. Will never be used in Python =< 3.8
32+ Constant = type ("Constant" , (expr ,), {})
10133
102- else :
103- from ast import Str
104- from distutils .sysconfig import get_python_lib
10534
10635package_name = "cdd"
10736
@@ -113,22 +42,6 @@ class DistutilsPlatformError(Exception):
11342 long_description = fh .read ()
11443
11544
116- def to_funcs (* paths ):
117- """
118- Produce function tuples that produce the local and install dir, respectively.
119-
120- :param paths: one or more str, referring to relative folder names
121- :type paths: ```*paths```
122-
123- :return: 2 functions
124- :rtype: ```tuple[Callable[Optional[List[str]], str], Callable[Optional[List[str]], str]]```
125- """
126- return (
127- partial (path .join , path .dirname (__file__ ), package_name , * paths ),
128- partial (path .join , get_python_lib (prefix = "" ), package_name , * paths ),
129- )
130-
131-
13245def main ():
13346 """Main function for setup.py; this actually does the installation"""
13447 with open (
@@ -165,18 +78,14 @@ def main():
16578 )
16679
16780 setup (
168- name = "python-{}" . format ( package_name ) ,
81+ name = package_name ,
16982 author = __author__ ,
17083 author_email = "807580+SamuelMarks@users.noreply.github.com" ,
17184 version = __version__ ,
85+ url = "https://github.com/offscale/{}" .format (package_name ),
17286 description = __description__ ,
17387 long_description = long_description ,
17488 long_description_content_type = "text/markdown" ,
175- url = "https://github.com/offscale/{}-python" .format (package_name ),
176- install_requires = ["pyyaml" ],
177- test_suite = "{}{}tests" .format (package_name , path .extsep ),
178- packages = find_packages (),
179- package_dir = {package_name : package_name },
18089 classifiers = [
18190 "Development Status :: 3 - Alpha" ,
18291 "Environment :: Console" ,
@@ -194,6 +103,7 @@ def main():
194103 "Programming Language :: Python :: 3.10" ,
195104 "Programming Language :: Python :: 3.11" ,
196105 "Programming Language :: Python :: 3.12" ,
106+ "Programming Language :: Python :: 3.13" ,
197107 "Programming Language :: Python :: Implementation" ,
198108 "Programming Language :: Python :: Implementation :: CPython" ,
199109 "Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator" ,
@@ -203,6 +113,11 @@ def main():
203113 "Topic :: Software Development :: Compilers" ,
204114 "Topic :: Software Development :: Pre-processors" ,
205115 ],
116+ license = "(Apache-2.0 OR MIT)" ,
117+ license_files = ["LICENSE-APACHE" , "LICENSE-MIT" ],
118+ install_requires = ["pyyaml" ],
119+ test_suite = "{}{}tests" .format (package_name , path .extsep ),
120+ packages = find_packages (),
206121 python_requires = ">=3.6" ,
207122 )
208123
0 commit comments