10
10
{% block header %}
11
11
# Template by pypi-mobans
12
12
{% endblock %}
13
- import os
14
- import sys
15
13
import codecs
16
14
import locale
15
+ import os
17
16
import platform
17
+ import sys
18
18
from shutil import rmtree
19
19
{% if external_module_library %}
20
20
from distutils.core import setup, Extension
21
21
{% else %}
22
22
23
- from setuptools import Command, setup, find_packages
23
+ from setuptools import Command, find_packages, setup
24
24
25
25
{%endif%}
26
26
{%block compat_block%}
@@ -34,46 +34,46 @@ PY33 = sys.version_info < (3, 4)
34
34
# This work around is only if a project supports Python < 3.4
35
35
{% if PY33 %}
36
36
try:
37
- codecs.lookup(' mbcs' )
37
+ codecs.lookup(" mbcs" )
38
38
except LookupError:
39
- ascii = codecs.lookup(' ascii' )
40
- func = lambda name, enc=ascii: {True: enc}.get(name==' mbcs' )
39
+ ascii = codecs.lookup(" ascii" )
40
+ func = lambda name, enc=ascii: {True: enc}.get(name==" mbcs" )
41
41
codecs.register(func)
42
42
{% endif %}
43
43
44
44
# Work around for locale not being set
45
45
try:
46
46
lc = locale.getlocale()
47
47
pf = platform.system()
48
- if pf != ' Windows' and lc == (None, None):
49
- locale.setlocale(locale.LC_ALL, ' C.UTF-8' )
48
+ if pf != " Windows" and lc == (None, None):
49
+ locale.setlocale(locale.LC_ALL, " C.UTF-8" )
50
50
except (ValueError, UnicodeError, locale.Error):
51
- locale.setlocale(locale.LC_ALL, ' en_US.UTF-8' )
51
+ locale.setlocale(locale.LC_ALL, " en_US.UTF-8" )
52
52
53
- NAME = ' {{name}}'
54
- AUTHOR = ' {{author}}'
55
- VERSION = ' {{current_version}}'
56
- EMAIL = ' {{contact}}'
57
- LICENSE = ' {{license}}'
53
+ NAME = " {{name}}"
54
+ AUTHOR = " {{author}}"
55
+ VERSION = " {{current_version}}"
56
+ EMAIL = " {{contact}}"
57
+ LICENSE = " {{license}}"
58
58
{% if MAINTAINER %}
59
- MAINTAINER = ' {{maintainer}}'
60
- MAINTAINER_CONTACT = ' {{maintainer_contact}}'
59
+ MAINTAINER = " {{maintainer}}"
60
+ MAINTAINER_CONTACT = " {{maintainer_contact}}"
61
61
{% endif %}
62
62
{% if command_line_interface or entry_points %}
63
63
ENTRY_POINTS = {
64
64
{% if not entry_points or 'console_scripts' not in entry_points %}
65
- ' console_scripts' : [
66
- ' {{command_line_interface}} = {{ entry_point }}'
65
+ " console_scripts" : [
66
+ " {{command_line_interface}} = {{ entry_point }}"
67
67
],
68
68
{% endif %}
69
69
{% if entry_points %}
70
70
{% for group_name, items in entry_points.items() %}
71
- ' {{group_name}}' : [
72
- {% if group_name == ' console_scripts' and command_line_interface %}
73
- ' {{command_line_interface}} = {{ entry_point }}' ,
71
+ " {{group_name}}" : [
72
+ {% if group_name == " console_scripts" and command_line_interface %}
73
+ " {{command_line_interface}} = {{ entry_point }}" ,
74
74
{% endif %}
75
75
{% for item in items %}
76
- ' {{item}}' ,
76
+ " {{item}}" ,
77
77
{% endfor %}
78
78
],
79
79
{% endfor %}
@@ -82,64 +82,64 @@ ENTRY_POINTS = {
82
82
{% endif %}
83
83
DESCRIPTION = (
84
84
{% for line in description | split_length(70) %}
85
- ' {{ line }}' {{ ' +' if not loop.last}}
85
+ " {{ line }}" {{ " +" if not loop.last}}
86
86
{% endfor %}
87
87
)
88
- URL = ' https://{{scm_host}}/{{organisation}}/{{name}}'
89
- DOWNLOAD_URL = ' %s/archive/{{release}}.tar.gz' % URL
90
- FILES = [' README.rst' ,{%block morefiles %}{%endblock%} ' CHANGELOG.rst' ]
88
+ URL = " https://{{scm_host}}/{{organisation}}/{{name}}"
89
+ DOWNLOAD_URL = " %s/archive/{{release}}.tar.gz" % URL
90
+ FILES = [" README.rst" ,{%block morefiles %}{%endblock%} " CHANGELOG.rst" ]
91
91
{% if self.additional_keywords %}
92
92
{% set additional_keywords = self.additional_keywords() %}
93
- {% if additional_keywords and not additional_keywords.rstrip().endswith(',' ) %}
94
- {% set additional_keywords = additional_keywords.rstrip() + ' ,\n' %}
93
+ {% if additional_keywords and not additional_keywords.rstrip().endswith("," ) %}
94
+ {% set additional_keywords = additional_keywords.rstrip() + " ,\n" %}
95
95
{% endif %}
96
96
{% endif %}
97
97
KEYWORDS = [
98
- ' python' ,
98
+ " python" ,
99
99
{% for keyword in keywords %}
100
- ' {{keyword}}' ,
100
+ " {{keyword}}" ,
101
101
{% endfor %}
102
102
{%block additional_keywords -%}
103
103
{%endblock%}
104
104
]
105
105
106
106
CLASSIFIERS = [
107
- ' Topic :: Software Development :: Libraries' ,
108
- ' Programming Language :: Python' ,
109
- ' Intended Audience :: Developers' ,
110
- {% if min_python_version <= ['2', '6' ] %}
111
- ' Programming Language :: Python :: 2.6' ,
107
+ " Topic :: Software Development :: Libraries" ,
108
+ " Programming Language :: Python" ,
109
+ " Intended Audience :: Developers" ,
110
+ {% if min_python_version <= ["2", "6" ] %}
111
+ " Programming Language :: Python :: 2.6" ,
112
112
{%- endif %}
113
113
114
- {% if min_python_version <= ['2', '7' ] %}
115
- ' Programming Language :: Python :: 2.7' ,
114
+ {% if min_python_version <= ["2", "7" ] %}
115
+ " Programming Language :: Python :: 2.7" ,
116
116
{%- endif %}
117
117
118
- {%- if min_python_version[0] == '3' %}
119
- ' Programming Language :: Python :: 3 :: Only' ,
118
+ {%- if min_python_version[0] == "3" %}
119
+ " Programming Language :: Python :: 3 :: Only" ,
120
120
{%- endif %}
121
121
122
- {% if min_python_version <= ['3','3' ] %}
123
- ' Programming Language :: Python :: 3.3' ,
122
+ {% if min_python_version <= ["3","3" ] %}
123
+ " Programming Language :: Python :: 3.3" ,
124
124
{%- endif %}
125
125
126
- {% if min_python_version <= ['3','4' ] %}
127
- ' Programming Language :: Python :: 3.4' ,
126
+ {% if min_python_version <= ["3","4" ] %}
127
+ " Programming Language :: Python :: 3.4" ,
128
128
{%- endif %}
129
129
130
- {% if min_python_version <= ['3','5' ] %}
131
- ' Programming Language :: Python :: 3.5' ,
130
+ {% if min_python_version <= ["3","5" ] %}
131
+ " Programming Language :: Python :: 3.5" ,
132
132
{%- endif %}
133
133
134
- {% if min_python_version <= ['3','6' ] %}
135
- ' Programming Language :: Python :: 3.6' ,
134
+ {% if min_python_version <= ["3","6" ] %}
135
+ " Programming Language :: Python :: 3.6" ,
136
136
{% endif %}
137
137
{%block additional_classifiers%}
138
138
{%endblock %}
139
139
]
140
140
141
141
{%macro handle_complex_dependency(complex_one) -%}
142
- {%set dependency, condition = complex_one.split(';' )%}
142
+ {%set dependency, condition = complex_one.split(";" )%}
143
143
{% if condition == 'python_version<"3"'%}
144
144
if PY2:
145
145
{% endif %}
@@ -164,12 +164,12 @@ INSTALL_REQUIRES = [
164
164
{% if '#' in egg_name: %}
165
165
{% set egg_name = egg_name.split('#')[0].strip() %}
166
166
{% endif %}
167
- ' {{[repo_link, egg_name] | join('#egg=')}}' ,
167
+ " {{[repo_link, egg_name] | join('#egg=')}}" ,
168
168
{% elif '#' in dependency: %}
169
169
{% set dependency = dependency.split('#')[0].strip() %}
170
- ' {{dependency}}' ,
170
+ " {{dependency}}" ,
171
171
{% else %}
172
- ' {{dependency}}' ,
172
+ " {{dependency}}" ,
173
173
{% endif %}
174
174
{% endif %}
175
175
{% endfor %}
@@ -189,18 +189,18 @@ PYMODULE = Extension(
189
189
'{{name}}',
190
190
sources=[
191
191
{% for source in sources: %}
192
- ' {{source}}' ,
192
+ " {{source}}" ,
193
193
{% endfor %}
194
194
],
195
195
libraries=INSTALL_REQUIRES
196
196
)
197
197
{% else %}
198
- PACKAGES = find_packages(exclude=[' ez_setup', ' examples', ' tests' ])
198
+ PACKAGES = find_packages(exclude=[" ez_setup", " examples", " tests" ])
199
199
{% if extra_dependencies or dependencies: %}
200
200
EXTRAS_REQUIRE = {
201
201
{% for dependency in extra_dependencies: %}
202
202
{% for key, value in dependency.items(): %}
203
- ' {{key}}' : {{value}},
203
+ " {{key}}" : {{value}},
204
204
{% endfor %}
205
205
{% endfor %}
206
206
}
@@ -210,16 +210,14 @@ EXTRAS_REQUIRE = {}
210
210
{% endif %}
211
211
# You do not need to read beyond this line
212
212
{% if nowheel %}
213
- PUBLISH_COMMAND = '{0} setup.py sdist upload -r pypi'.format(
214
- sys.executable)
213
+ PUBLISH_COMMAND = "{0} setup.py sdist upload -r pypi".format(sys.executable)
215
214
{% else %}
216
- PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi'.format(
217
- sys.executable)
215
+ PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable)
218
216
{% endif %}
219
- GS_COMMAND = (' gs {{name}} v{{release}} ' +
217
+ GS_COMMAND = (" gs {{name}} v{{release}} " +
220
218
"Find {{release}} in changelog for more details")
221
- NO_GS_MESSAGE = (' Automatic github release is disabled. ' +
222
- ' Please install gease to enable it.' )
219
+ NO_GS_MESSAGE = (" Automatic github release is disabled. " +
220
+ " Please install gease to enable it." )
223
221
UPLOAD_FAILED_MSG = (
224
222
'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND)
225
223
HERE = os.path.abspath(os.path.dirname(__file__))
@@ -228,13 +226,13 @@ HERE = os.path.abspath(os.path.dirname(__file__))
228
226
class PublishCommand(Command):
229
227
"""Support setup.py upload."""
230
228
231
- description = ' Build and publish the package on github and pypi'
229
+ description = " Build and publish the package on github and pypi"
232
230
user_options = []
233
231
234
232
@staticmethod
235
233
def status(s):
236
234
"""Prints things in bold."""
237
- print(' \033[1m{0}\033[0m' .format(s))
235
+ print(" \033[1m{0}\033[0m" .format(s))
238
236
239
237
def initialize_options(self):
240
238
pass
@@ -244,14 +242,14 @@ class PublishCommand(Command):
244
242
245
243
def run(self):
246
244
try:
247
- self.status(' Removing previous builds...' )
248
- rmtree(os.path.join(HERE, ' dist' ))
249
- rmtree(os.path.join(HERE, ' build' ))
250
- rmtree(os.path.join(HERE, ' {{name|replace('-', '_')}}.egg-info' ))
245
+ self.status(" Removing previous builds..." )
246
+ rmtree(os.path.join(HERE, " dist" ))
247
+ rmtree(os.path.join(HERE, " build" ))
248
+ rmtree(os.path.join(HERE, " {{name|replace('-', '_')}}.egg-info" ))
251
249
except OSError:
252
250
pass
253
251
254
- self.status(' Building Source and Wheel (universal) distribution...' )
252
+ self.status(" Building Source and Wheel (universal) distribution..." )
255
253
run_status = True
256
254
if has_gease():
257
255
run_status = os.system(GS_COMMAND) == 0
@@ -265,7 +263,7 @@ class PublishCommand(Command):
265
263
266
264
267
265
SETUP_COMMANDS.update({
268
- ' publish' : PublishCommand
266
+ " publish" : PublishCommand
269
267
})
270
268
271
269
@@ -294,7 +292,7 @@ def read_files(*files):
294
292
def read(afile):
295
293
"""Read a file into setup"""
296
294
the_relative_file = os.path.join(HERE, afile)
297
- with codecs.open(the_relative_file, 'r', ' utf-8' ) as opened_file:
295
+ with codecs.open(the_relative_file, "r", " utf-8" ) as opened_file:
298
296
content = filter_out_test_code(opened_file)
299
297
content = "".join(list(content))
300
298
return content
@@ -303,11 +301,11 @@ def read(afile):
303
301
def filter_out_test_code(file_handle):
304
302
found_test_code = False
305
303
for line in file_handle.readlines():
306
- if line.startswith(' .. testcode:' ):
304
+ if line.startswith(" .. testcode:" ):
307
305
found_test_code = True
308
306
continue
309
307
if found_test_code is True:
310
- if line.startswith(' ' ):
308
+ if line.startswith(" " ):
311
309
continue
312
310
else:
313
311
empty_line = line.strip()
@@ -317,16 +315,16 @@ def filter_out_test_code(file_handle):
317
315
found_test_code = False
318
316
yield line
319
317
else:
320
- for keyword in [' |version|', ' |today|' ]:
318
+ for keyword in [" |version|", " |today|" ]:
321
319
if keyword in line:
322
320
break
323
321
else:
324
322
yield line
325
323
326
324
327
- if __name__ == ' __main__' :
325
+ if __name__ == " __main__" :
328
326
setup(
329
- {% if ' tests' is exists %}
327
+ {% if " tests" is exists %}
330
328
test_suite="tests",
331
329
{% endif %}
332
330
name=NAME,
@@ -347,7 +345,7 @@ if __name__ == '__main__':
347
345
ext_modules=[PYMODULE],
348
346
{% else %}
349
347
extras_require=EXTRAS_REQUIRE,
350
- tests_require=[' nose' ],
348
+ tests_require=[" nose" ],
351
349
install_requires=INSTALL_REQUIRES,
352
350
packages=PACKAGES,
353
351
include_package_data=True,
0 commit comments