forked from PythonCharmers/python-future
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·187 lines (170 loc) · 5.6 KB
/
setup.py
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/usr/bin/env python
from __future__ import absolute_import, print_function
import os
import os.path
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
NAME = "future"
PACKAGES = ["future",
"future.builtins",
"future.types",
"future.standard_library",
"future.backports",
"future.backports.email",
"future.backports.email.mime",
"future.backports.html",
"future.backports.http",
"future.backports.test",
"future.backports.urllib",
"future.backports.xmlrpc",
"future.moves",
"future.moves.dbm",
"future.moves.html",
"future.moves.http",
"future.moves.test",
"future.moves.tkinter",
"future.moves.urllib",
"future.moves.xmlrpc",
"future.tests", # for future.tests.base
# "future.tests.test_email",
"future.utils",
"past",
"past.builtins",
"past.types",
"past.utils",
# "past.tests",
"past.translation",
"libfuturize",
"libfuturize.fixes",
"libpasteurize",
"libpasteurize.fixes",
]
# PEP 3108 stdlib moves:
if sys.version_info[:2] < (3, 0):
PACKAGES += [
"builtins",
# "configparser", # removed in v0.16.0
"copyreg",
"html",
"http",
"queue",
"reprlib",
"socketserver",
"tkinter",
"winreg",
"xmlrpc",
"_dummy_thread",
"_markupbase",
"_thread",
]
PACKAGE_DATA = {'': [
'README.rst',
'LICENSE.txt',
'futurize.py',
'pasteurize.py',
'discover_tests.py',
'check_rst.sh',
'TESTING.txt',
],
'tests': ['*.py'],
}
REQUIRES = []
TEST_REQUIRES = []
if sys.version_info[:2] == (2, 6):
REQUIRES += ['importlib', 'argparse']
TEST_REQUIRES += ['unittest2']
import src.future
VERSION = src.future.__version__
DESCRIPTION = "Clean single-source support for Python 3 and 2"
LONG_DESC = src.future.__doc__
AUTHOR = "Ed Schofield"
AUTHOR_EMAIL = "[email protected]"
URL="https://python-future.org"
LICENSE = "MIT"
KEYWORDS = "future past python3 migration futurize backport six 2to3 modernize pasteurize 3to2"
CLASSIFIERS = [
"Programming Language :: Python",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"License :: OSI Approved",
"License :: OSI Approved :: MIT License",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
]
setup_kwds = {}
# * Important *
# We forcibly remove the build folder to avoid breaking the
# user's Py3 installation if they run "python2 setup.py
# build" and then "python3 setup.py install".
try:
# If the user happens to run:
# python2 setup.py build
# python3 setup.py install
# then folders like "copyreg" will be in build/lib.
# If so, we CANNOT let the user install this, because
# this may break his/her Python 3 install, depending on the folder order in
# sys.path. (Running "import html" etc. may pick up our Py2
# substitute packages, instead of the intended system stdlib modules.)
SYSTEM_MODULES = set([
'_dummy_thread',
'_markupbase',
'_thread',
'builtins',
# Catch the case that configparser is in the build folder
# from a previous version of `future`:
'configparser',
'copyreg',
'html',
'http',
'queue',
'reprlib',
'socketserver',
'tkinter',
'winreg',
'xmlrpc'
])
if sys.version_info[0] >= 3:
# Do any of the above folders exist in build/lib?
files = os.listdir(os.path.join('build', 'lib'))
if len(set(files) & set(SYSTEM_MODULES)) > 0:
print('ERROR: Your build folder is in an inconsistent state for '
'a Python 3.x install. Please remove it manually and run '
'setup.py again.', file=sys.stderr)
sys.exit(1)
except OSError:
pass
setup(name=NAME,
version=VERSION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
description=DESCRIPTION,
long_description=LONG_DESC,
license=LICENSE,
keywords=KEYWORDS,
entry_points={
'console_scripts': [
'futurize = libfuturize.main:main',
'pasteurize = libpasteurize.main:main'
]
},
package_dir={'': 'src'},
packages=PACKAGES,
package_data=PACKAGE_DATA,
include_package_data=True,
install_requires=REQUIRES,
classifiers=CLASSIFIERS,
test_suite = "discover_tests",
tests_require=TEST_REQUIRES,
**setup_kwds
)