11#!/usr/bin/env python3
22
3- # Template by pypi-mobans
4- import os
5- import sys
63import codecs
74import locale
5+
6+ # Template by pypi-mobans
7+ import os
88import platform
9+ import sys
910from shutil import rmtree
1011
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
1613
1714# Work around mbcs bug in distutils.
1815# http://bugs.python.org/issue10945
2219try :
2320 lc = locale .getlocale ()
2421 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" )
2724except (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- ]
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+ EMAIL = "info@pyecharts.com"
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+
4437
4538CLASSIFIERS = [
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" ,
5545]
5646
57- INSTALL_REQUIRES = [
58- ]
47+ INSTALL_REQUIRES = ["selenium" ]
5948SETUP_COMMANDS = {}
6049
6150
62- PACKAGES = find_packages (exclude = [' ez_setup' , ' examples' , ' tests' ])
51+ PACKAGES = find_packages (exclude = [" ez_setup" , " examples" , " tests" ])
6352EXTRAS_REQUIRE = {}
6453# 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
7360HERE = os .path .abspath (os .path .dirname (__file__ ))
7461
7562
7663class PublishCommand (Command ):
7764 """Support setup.py upload."""
7865
79- description = ' Build and publish the package on github and pypi'
66+ description = " Build and publish the package on github and pypi"
8067 user_options = []
8168
8269 @staticmethod
8370 def status (s ):
8471 """Prints things in bold."""
85- print (' \033 [1m{0}\033 [0m' .format (s ))
72+ print (" \033 [1m{0}\033 [0m" .format (s ))
8673
8774 def initialize_options (self ):
8875 pass
@@ -92,14 +79,14 @@ def finalize_options(self):
9279
9380 def run (self ):
9481 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" ))
9986 except OSError :
10087 pass
10188
102- self .status (' Building Source and Wheel (universal) distribution...' )
89+ self .status (" Building Source and Wheel (universal) distribution..." )
10390 run_status = True
10491 if has_gease ():
10592 run_status = os .system (GS_COMMAND ) == 0
@@ -112,9 +99,7 @@ def run(self):
11299 sys .exit ()
113100
114101
115- SETUP_COMMANDS .update ({
116- 'publish' : PublishCommand
117- })
102+ SETUP_COMMANDS .update ({"publish" : PublishCommand })
118103
119104
120105def has_gease ():
@@ -125,6 +110,7 @@ def has_gease():
125110 """
126111 try :
127112 import gease # noqa
113+
128114 return True
129115 except ImportError :
130116 return False
@@ -142,7 +128,7 @@ def read_files(*files):
142128def read (afile ):
143129 """Read a file into setup"""
144130 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 :
146132 content = filter_out_test_code (opened_file )
147133 content = "" .join (list (content ))
148134 return content
@@ -151,11 +137,11 @@ def read(afile):
151137def filter_out_test_code (file_handle ):
152138 found_test_code = False
153139 for line in file_handle .readlines ():
154- if line .startswith (' .. testcode:' ):
140+ if line .startswith (" .. testcode:" ):
155141 found_test_code = True
156142 continue
157143 if found_test_code is True :
158- if line .startswith (' ' ):
144+ if line .startswith (" " ):
159145 continue
160146 else :
161147 empty_line = line .strip ()
@@ -165,14 +151,14 @@ def filter_out_test_code(file_handle):
165151 found_test_code = False
166152 yield line
167153 else :
168- for keyword in [' |version|' , ' |today|' ]:
154+ for keyword in [" |version|" , " |today|" ]:
169155 if keyword in line :
170156 break
171157 else :
172158 yield line
173159
174160
175- if __name__ == ' __main__' :
161+ if __name__ == " __main__" :
176162 setup (
177163 test_suite = "tests" ,
178164 name = NAME ,
@@ -184,13 +170,12 @@ def filter_out_test_code(file_handle):
184170 download_url = DOWNLOAD_URL ,
185171 long_description = read_files (* FILES ),
186172 license = LICENSE ,
187- keywords = KEYWORDS ,
188173 extras_require = EXTRAS_REQUIRE ,
189- tests_require = [' nose' ],
174+ tests_require = [" nose" ],
190175 install_requires = INSTALL_REQUIRES ,
191176 packages = PACKAGES ,
192177 include_package_data = True ,
193178 zip_safe = False ,
194179 classifiers = CLASSIFIERS ,
195- cmdclass = SETUP_COMMANDS
180+ cmdclass = SETUP_COMMANDS ,
196181 )
0 commit comments