1- try :
2- from setuptools import setup , find_packages
3- except ImportError :
4- from ez_setup import use_setuptools
5- use_setuptools ()
6- from setuptools import setup , find_packages
1+ # Template by setupmobans
2+ import os
73import sys
4+ import codecs
5+ from shutil import rmtree
6+ from setuptools import setup , find_packages , Command
87PY2 = sys .version_info [0 ] == 2
98PY26 = PY2 and sys .version_info [1 ] < 7
109
1110NAME = 'pyexcel-pygal'
1211AUTHOR = 'C.W.'
13- VERSION = '0.0.1 '
12+ VERSION = '0.0.2 '
1413EMAIL = 'wangc_2011@hotmail.com'
1514LICENSE = 'New BSD'
1615DESCRIPTION = (
1716 'draw simple svg chart via pygal' +
1817 ''
1918)
20- URL = 'https://github.com/pyexcel/pyexcel-pygal'
21- DOWNLOAD_URL = '%s/archive/0.0.1 .tar.gz' % URL
22- FILES = ['README.rst' , 'CHANGELOG.rst' ]
19+ URL = 'https://github.com/pyexcel-renderers /pyexcel-pygal'
20+ DOWNLOAD_URL = '%s/archive/0.0.2 .tar.gz' % URL
21+ FILES = ['README.rst' , 'CHANGELOG.rst' ]
2322KEYWORDS = [
2423 'python'
2524]
4746PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
4847EXTRAS_REQUIRE = {
4948}
49+ PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi' .format (
50+ sys .executable )
51+ GS_COMMAND = ('gs pyexcel-pygal v0.0.2 ' +
52+ "Find 0.0.2 in changelog for more details" )
53+ here = os .path .abspath (os .path .dirname (__file__ ))
54+
55+
56+ class PublishCommand (Command ):
57+ """Support setup.py upload."""
58+
59+ description = 'Build and publish the package on github and pypi'
60+ user_options = []
61+
62+ @staticmethod
63+ def status (s ):
64+ """Prints things in bold."""
65+ print ('\033 [1m{0}\033 [0m' .format (s ))
66+
67+ def initialize_options (self ):
68+ pass
69+
70+ def finalize_options (self ):
71+ pass
72+
73+ def run (self ):
74+ try :
75+ self .status ('Removing previous builds...' )
76+ rmtree (os .path .join (here , 'dist' ))
77+ except OSError :
78+ pass
79+
80+ self .status ('Building Source and Wheel (universal) distribution...' )
81+ if os .system (GS_COMMAND ) == 0 :
82+ os .system (PUBLISH_COMMAND )
83+
84+ sys .exit ()
5085
5186
5287def read_files (* files ):
@@ -60,7 +95,7 @@ def read_files(*files):
6095
6196def read (afile ):
6297 """Read a file into setup"""
63- with open (afile , 'r' ) as opened_file :
98+ with codecs . open (afile , 'r' , 'utf-8 ' ) as opened_file :
6499 content = filter_out_test_code (opened_file )
65100 content = "" .join (list (content ))
66101 return content
@@ -108,5 +143,9 @@ def filter_out_test_code(file_handle):
108143 packages = PACKAGES ,
109144 include_package_data = True ,
110145 zip_safe = False ,
111- classifiers = CLASSIFIERS
146+ classifiers = CLASSIFIERS ,
147+ setup_requires = ['gease' ],
148+ cmdclass = {
149+ 'publish' : PublishCommand ,
150+ }
112151 )
0 commit comments