1
1
#!/usr/bin/env python3
2
2
3
- # Template by pypi-mobans
4
- import os
5
- import sys
6
3
import codecs
7
4
import locale
5
+
6
+ # Template by pypi-mobans
7
+ import os
8
8
import platform
9
+ import sys
9
10
from shutil import rmtree
10
11
11
- from setuptools import Command , setup , find_packages
12
-
13
- PY2 = sys .version_info [0 ] == 2
14
- PY26 = PY2 and sys .version_info [1 ] < 7
15
- PY33 = sys .version_info < (3 , 4 )
12
+ from setuptools import Command , find_packages , setup
16
13
17
14
# Work around mbcs bug in distutils.
18
15
# http://bugs.python.org/issue10945
22
19
try :
23
20
lc = locale .getlocale ()
24
21
pf = platform .system ()
25
- if pf != ' Windows' and lc == (None , None ):
26
- locale .setlocale (locale .LC_ALL , ' C.UTF-8' )
22
+ if pf != " Windows" and lc == (None , None ):
23
+ locale .setlocale (locale .LC_ALL , " C.UTF-8" )
27
24
except (ValueError , UnicodeError , locale .Error ):
28
- locale .setlocale (locale .LC_ALL , 'en_US.UTF-8' )
29
-
30
- NAME = 'snapshot-selenium'
31
- AUTHOR = 'C.W.'
32
- VERSION = '0.0.1'
33
-
34
- LICENSE = 'MIT'
35
- DESCRIPTION = (
36
- 'Render echarts using selenium'
37
- )
38
- URL = 'https://github.com/pyecharts/snapshot-selenium'
39
- DOWNLOAD_URL = '%s/archive/0.0.1.tar.gz' % URL
40
- FILES = ['README.rst' , 'CHANGELOG.rst' ]
41
- KEYWORDS = [
42
- 'python' ,
43
- ]
25
+ locale .setlocale (locale .LC_ALL , "en_US.UTF-8" )
26
+
27
+ NAME = "snapshot-selenium"
28
+ AUTHOR = "pyecharts dev team"
29
+ VERSION = "0.0.1"
30
+
31
+ LICENSE = "MIT"
32
+ DESCRIPTION = "Render echarts using selenium"
33
+ URL = "https://github.com/pyecharts/snapshot-selenium"
34
+ DOWNLOAD_URL = "%s/archive/0.0.1.tar.gz" % URL
35
+ FILES = ["README.md" ]
36
+
44
37
45
38
CLASSIFIERS = [
46
- 'Topic :: Software Development :: Libraries' ,
47
- 'Programming Language :: Python' ,
48
- 'Intended Audience :: Developers' ,
49
- 'Programming Language :: Python :: 2.6' ,
50
- 'Programming Language :: Python :: 2.7' ,
51
- 'Programming Language :: Python :: 3.3' ,
52
- 'Programming Language :: Python :: 3.4' ,
53
- 'Programming Language :: Python :: 3.5' ,
54
- 'Programming Language :: Python :: 3.6' ,
39
+ "Topic :: Software Development :: Libraries" ,
40
+ "Programming Language :: Python" ,
41
+ "Intended Audience :: Developers" ,
42
+ "Programming Language :: Python :: 3.5" ,
43
+ "Programming Language :: Python :: 3.6" ,
44
+ "Programming Language :: Python :: 3.7" ,
55
45
]
56
46
57
- INSTALL_REQUIRES = [
58
- ]
47
+ INSTALL_REQUIRES = ["selenium" ]
59
48
SETUP_COMMANDS = {}
60
49
61
50
62
- PACKAGES = find_packages (exclude = [' ez_setup' , ' examples' , ' tests' ])
51
+ PACKAGES = find_packages (exclude = [" ez_setup" , " examples" , " tests" ])
63
52
EXTRAS_REQUIRE = {}
64
53
# You do not need to read beyond this line
65
- PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi' .format (
66
- sys .executable )
67
- GS_COMMAND = ('gs snapshot-selenium v0.0.1 ' +
68
- "Find 0.0.1 in changelog for more details" )
69
- NO_GS_MESSAGE = ('Automatic github release is disabled. ' +
70
- 'Please install gease to enable it.' )
71
- UPLOAD_FAILED_MSG = (
72
- 'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND )
54
+ PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi" .format (sys .executable )
55
+ GS_COMMAND = "gs snapshot-selenium v0.0.1 " + "Find 0.0.1 in changelog for more details"
56
+ NO_GS_MESSAGE = (
57
+ "Automatic github release is disabled. " + "Please install gease to enable it."
58
+ )
59
+ UPLOAD_FAILED_MSG = 'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND
73
60
HERE = os .path .abspath (os .path .dirname (__file__ ))
74
61
75
62
76
63
class PublishCommand (Command ):
77
64
"""Support setup.py upload."""
78
65
79
- description = ' Build and publish the package on github and pypi'
66
+ description = " Build and publish the package on github and pypi"
80
67
user_options = []
81
68
82
69
@staticmethod
83
70
def status (s ):
84
71
"""Prints things in bold."""
85
- print (' \033 [1m{0}\033 [0m' .format (s ))
72
+ print (" \033 [1m{0}\033 [0m" .format (s ))
86
73
87
74
def initialize_options (self ):
88
75
pass
@@ -92,14 +79,14 @@ def finalize_options(self):
92
79
93
80
def run (self ):
94
81
try :
95
- self .status (' Removing previous builds...' )
96
- rmtree (os .path .join (HERE , ' dist' ))
97
- rmtree (os .path .join (HERE , ' build' ))
98
- rmtree (os .path .join (HERE , ' snapshot_selenium.egg-info' ))
82
+ self .status (" Removing previous builds..." )
83
+ rmtree (os .path .join (HERE , " dist" ))
84
+ rmtree (os .path .join (HERE , " build" ))
85
+ rmtree (os .path .join (HERE , " snapshot_selenium.egg-info" ))
99
86
except OSError :
100
87
pass
101
88
102
- self .status (' Building Source and Wheel (universal) distribution...' )
89
+ self .status (" Building Source and Wheel (universal) distribution..." )
103
90
run_status = True
104
91
if has_gease ():
105
92
run_status = os .system (GS_COMMAND ) == 0
@@ -112,9 +99,7 @@ def run(self):
112
99
sys .exit ()
113
100
114
101
115
- SETUP_COMMANDS .update ({
116
- 'publish' : PublishCommand
117
- })
102
+ SETUP_COMMANDS .update ({"publish" : PublishCommand })
118
103
119
104
120
105
def has_gease ():
@@ -125,6 +110,7 @@ def has_gease():
125
110
"""
126
111
try :
127
112
import gease # noqa
113
+
128
114
return True
129
115
except ImportError :
130
116
return False
@@ -142,7 +128,7 @@ def read_files(*files):
142
128
def read (afile ):
143
129
"""Read a file into setup"""
144
130
the_relative_file = os .path .join (HERE , afile )
145
- with codecs .open (the_relative_file , 'r' , ' utf-8' ) as opened_file :
131
+ with codecs .open (the_relative_file , "r" , " utf-8" ) as opened_file :
146
132
content = filter_out_test_code (opened_file )
147
133
content = "" .join (list (content ))
148
134
return content
@@ -151,11 +137,11 @@ def read(afile):
151
137
def filter_out_test_code (file_handle ):
152
138
found_test_code = False
153
139
for line in file_handle .readlines ():
154
- if line .startswith (' .. testcode:' ):
140
+ if line .startswith (" .. testcode:" ):
155
141
found_test_code = True
156
142
continue
157
143
if found_test_code is True :
158
- if line .startswith (' ' ):
144
+ if line .startswith (" " ):
159
145
continue
160
146
else :
161
147
empty_line = line .strip ()
@@ -165,14 +151,14 @@ def filter_out_test_code(file_handle):
165
151
found_test_code = False
166
152
yield line
167
153
else :
168
- for keyword in [' |version|' , ' |today|' ]:
154
+ for keyword in [" |version|" , " |today|" ]:
169
155
if keyword in line :
170
156
break
171
157
else :
172
158
yield line
173
159
174
160
175
- if __name__ == ' __main__' :
161
+ if __name__ == " __main__" :
176
162
setup (
177
163
test_suite = "tests" ,
178
164
name = NAME ,
@@ -184,13 +170,12 @@ def filter_out_test_code(file_handle):
184
170
download_url = DOWNLOAD_URL ,
185
171
long_description = read_files (* FILES ),
186
172
license = LICENSE ,
187
- keywords = KEYWORDS ,
188
173
extras_require = EXTRAS_REQUIRE ,
189
- tests_require = [' nose' ],
174
+ tests_require = [" nose" ],
190
175
install_requires = INSTALL_REQUIRES ,
191
176
packages = PACKAGES ,
192
177
include_package_data = True ,
193
178
zip_safe = False ,
194
179
classifiers = CLASSIFIERS ,
195
- cmdclass = SETUP_COMMANDS
180
+ cmdclass = SETUP_COMMANDS ,
196
181
)
0 commit comments