6
6
"""
7
7
8
8
import sys
9
- from ast import Assign , Constant , Name , parse
9
+ from ast import Assign , Name , parse
10
10
from functools import partial
11
11
from operator import attrgetter
12
12
from os import path
15
15
from setuptools import find_packages , setup
16
16
17
17
if 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
33
21
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
63
25
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
66
30
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 ,), {})
101
33
102
- else :
103
- from ast import Str
104
- from distutils .sysconfig import get_python_lib
105
34
106
35
package_name = "cdd"
107
36
@@ -113,22 +42,6 @@ class DistutilsPlatformError(Exception):
113
42
long_description = fh .read ()
114
43
115
44
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
-
132
45
def main ():
133
46
"""Main function for setup.py; this actually does the installation"""
134
47
with open (
@@ -165,18 +78,14 @@ def main():
165
78
)
166
79
167
80
setup (
168
- name = "python-{}" . format ( package_name ) ,
81
+ name = package_name ,
169
82
author = __author__ ,
170
83
author_email = "807580+SamuelMarks@users.noreply.github.com" ,
171
84
version = __version__ ,
85
+ url = "https://github.com/offscale/{}" .format (package_name ),
172
86
description = __description__ ,
173
87
long_description = long_description ,
174
88
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 },
180
89
classifiers = [
181
90
"Development Status :: 3 - Alpha" ,
182
91
"Environment :: Console" ,
@@ -194,6 +103,7 @@ def main():
194
103
"Programming Language :: Python :: 3.10" ,
195
104
"Programming Language :: Python :: 3.11" ,
196
105
"Programming Language :: Python :: 3.12" ,
106
+ "Programming Language :: Python :: 3.13" ,
197
107
"Programming Language :: Python :: Implementation" ,
198
108
"Programming Language :: Python :: Implementation :: CPython" ,
199
109
"Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator" ,
@@ -203,6 +113,11 @@ def main():
203
113
"Topic :: Software Development :: Compilers" ,
204
114
"Topic :: Software Development :: Pre-processors" ,
205
115
],
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 (),
206
121
python_requires = ">=3.6" ,
207
122
)
208
123
0 commit comments