1010
1111from setuptools import Command , setup , find_packages
1212
13- PY2 = sys .version_info [0 ] == 2
14- PY26 = PY2 and sys .version_info [1 ] < 7
15- PY33 = sys .version_info < (3 , 4 )
16-
1713# Work around mbcs bug in distutils.
1814# http://bugs.python.org/issue10945
1915# This work around is only if a project supports Python < 3.4
2218try :
2319 lc = locale .getlocale ()
2420 pf = platform .system ()
25- if pf != ' Windows' and lc == (None , None ):
26- locale .setlocale (locale .LC_ALL , ' C.UTF-8' )
21+ if pf != " Windows" and lc == (None , None ):
22+ locale .setlocale (locale .LC_ALL , " C.UTF-8" )
2723except (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- EMAIL = 'info@pyecharts.com'
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- ]
24+ locale .setlocale (locale .LC_ALL , "en_US.UTF-8" )
25+
26+ NAME = "snapshot-selenium"
27+ AUTHOR = "pyecharts dev team"
28+ VERSION = "0.0.1"
29+ EMAIL = "info@pyecharts.com"
30+ LICENSE = "MIT"
31+ DESCRIPTION = "Render echarts using selenium"
32+ URL = "https://github.com/pyecharts/snapshot-selenium"
33+ DOWNLOAD_URL = "%s/archive/0.0.1.tar.gz" % URL
34+ FILES = ["README.md" ]
35+
4436
4537CLASSIFIERS = [
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' ,
38+ "Topic :: Software Development :: Libraries" ,
39+ "Programming Language :: Python" ,
40+ "Intended Audience :: Developers" ,
41+ "Programming Language :: Python :: 3.5" ,
42+ "Programming Language :: Python :: 3.6" ,
43+ "Programming Language :: Python :: 3.7" ,
5544]
5645
57- INSTALL_REQUIRES = [
58- ]
46+ INSTALL_REQUIRES = ["selenium" ]
5947SETUP_COMMANDS = {}
6048
6149
62- PACKAGES = find_packages (exclude = [' ez_setup' , ' examples' , ' tests' ])
50+ PACKAGES = find_packages (exclude = [" ez_setup" , " examples" , " tests" ])
6351EXTRAS_REQUIRE = {}
6452# 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 )
53+ PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi" .format (sys .executable )
54+ GS_COMMAND = "gs snapshot-selenium v0.0.1 " + "Find 0.0.1 in changelog for more details"
55+ NO_GS_MESSAGE = (
56+ "Automatic github release is disabled. " + "Please install gease to enable it."
57+ )
58+ UPLOAD_FAILED_MSG = 'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND
7359HERE = os .path .abspath (os .path .dirname (__file__ ))
7460
7561
7662class PublishCommand (Command ):
7763 """Support setup.py upload."""
7864
79- description = ' Build and publish the package on github and pypi'
65+ description = " Build and publish the package on github and pypi"
8066 user_options = []
8167
8268 @staticmethod
8369 def status (s ):
8470 """Prints things in bold."""
85- print (' \033 [1m{0}\033 [0m' .format (s ))
71+ print (" \033 [1m{0}\033 [0m" .format (s ))
8672
8773 def initialize_options (self ):
8874 pass
@@ -92,14 +78,14 @@ def finalize_options(self):
9278
9379 def run (self ):
9480 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' ))
81+ self .status (" Removing previous builds..." )
82+ rmtree (os .path .join (HERE , " dist" ))
83+ rmtree (os .path .join (HERE , " build" ))
84+ rmtree (os .path .join (HERE , " snapshot_selenium.egg-info" ))
9985 except OSError :
10086 pass
10187
102- self .status (' Building Source and Wheel (universal) distribution...' )
88+ self .status (" Building Source and Wheel (universal) distribution..." )
10389 run_status = True
10490 if has_gease ():
10591 run_status = os .system (GS_COMMAND ) == 0
@@ -112,9 +98,7 @@ def run(self):
11298 sys .exit ()
11399
114100
115- SETUP_COMMANDS .update ({
116- 'publish' : PublishCommand
117- })
101+ SETUP_COMMANDS .update ({"publish" : PublishCommand })
118102
119103
120104def has_gease ():
@@ -125,6 +109,7 @@ def has_gease():
125109 """
126110 try :
127111 import gease # noqa
112+
128113 return True
129114 except ImportError :
130115 return False
@@ -142,7 +127,7 @@ def read_files(*files):
142127def read (afile ):
143128 """Read a file into setup"""
144129 the_relative_file = os .path .join (HERE , afile )
145- with codecs .open (the_relative_file , 'r' , ' utf-8' ) as opened_file :
130+ with codecs .open (the_relative_file , "r" , " utf-8" ) as opened_file :
146131 content = filter_out_test_code (opened_file )
147132 content = "" .join (list (content ))
148133 return content
@@ -151,11 +136,11 @@ def read(afile):
151136def filter_out_test_code (file_handle ):
152137 found_test_code = False
153138 for line in file_handle .readlines ():
154- if line .startswith (' .. testcode:' ):
139+ if line .startswith (" .. testcode:" ):
155140 found_test_code = True
156141 continue
157142 if found_test_code is True :
158- if line .startswith (' ' ):
143+ if line .startswith (" " ):
159144 continue
160145 else :
161146 empty_line = line .strip ()
@@ -165,14 +150,14 @@ def filter_out_test_code(file_handle):
165150 found_test_code = False
166151 yield line
167152 else :
168- for keyword in [' |version|' , ' |today|' ]:
153+ for keyword in [" |version|" , " |today|" ]:
169154 if keyword in line :
170155 break
171156 else :
172157 yield line
173158
174159
175- if __name__ == ' __main__' :
160+ if __name__ == " __main__" :
176161 setup (
177162 test_suite = "tests" ,
178163 name = NAME ,
@@ -184,13 +169,12 @@ def filter_out_test_code(file_handle):
184169 download_url = DOWNLOAD_URL ,
185170 long_description = read_files (* FILES ),
186171 license = LICENSE ,
187- keywords = KEYWORDS ,
188172 extras_require = EXTRAS_REQUIRE ,
189- tests_require = [' nose' ],
173+ tests_require = [" nose" ],
190174 install_requires = INSTALL_REQUIRES ,
191175 packages = PACKAGES ,
192176 include_package_data = True ,
193177 zip_safe = False ,
194178 classifiers = CLASSIFIERS ,
195- cmdclass = SETUP_COMMANDS
179+ cmdclass = SETUP_COMMANDS ,
196180 )
0 commit comments