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-htmlr'
1211AUTHOR = 'C.W.'
13- VERSION = '0.5.0 '
12+ VERSION = '0.5.1 '
1413EMAIL = 'wangc_2011@hotmail.com'
1514LICENSE = 'New BSD'
1615DESCRIPTION = (
1716 'read tables in html file as excel data' +
1817 ''
1918)
2019URL = 'https://github.com/pyexcel/pyexcel-htmlr'
21- DOWNLOAD_URL = '%s/archive/0.5.0 .tar.gz' % URL
22- FILES = ['README.rst' , 'CHANGELOG.rst' ]
20+ DOWNLOAD_URL = '%s/archive/0.5.1 .tar.gz' % URL
21+ FILES = ['README.rst' , 'CHANGELOG.rst' ]
2322KEYWORDS = [
2423 'python'
2524]
4948PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
5049EXTRAS_REQUIRE = {
5150}
51+ PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi' .format (
52+ sys .executable )
53+ GS_COMMAND = ('gs pyexcel-htmlr v0.5.1 ' +
54+ "Find 0.5.1 in changelog for more details" )
55+ here = os .path .abspath (os .path .dirname (__file__ ))
56+
57+
58+ class PublishCommand (Command ):
59+ """Support setup.py upload."""
60+
61+ description = 'Build and publish the package on github and pypi'
62+ user_options = []
63+
64+ @staticmethod
65+ def status (s ):
66+ """Prints things in bold."""
67+ print ('\033 [1m{0}\033 [0m' .format (s ))
68+
69+ def initialize_options (self ):
70+ pass
71+
72+ def finalize_options (self ):
73+ pass
74+
75+ def run (self ):
76+ try :
77+ self .status ('Removing previous builds...' )
78+ rmtree (os .path .join (here , 'dist' ))
79+ except OSError :
80+ pass
81+
82+ self .status ('Building Source and Wheel (universal) distribution...' )
83+ if os .system (GS_COMMAND ) == 0 :
84+ os .system (PUBLISH_COMMAND )
85+
86+ sys .exit ()
5287
5388
5489def read_files (* files ):
@@ -62,7 +97,7 @@ def read_files(*files):
6297
6398def read (afile ):
6499 """Read a file into setup"""
65- with open (afile , 'r' ) as opened_file :
100+ with codecs . open (afile , 'r' , 'utf-8 ' ) as opened_file :
66101 content = filter_out_test_code (opened_file )
67102 content = "" .join (list (content ))
68103 return content
@@ -110,5 +145,9 @@ def filter_out_test_code(file_handle):
110145 packages = PACKAGES ,
111146 include_package_data = True ,
112147 zip_safe = False ,
113- classifiers = CLASSIFIERS
148+ classifiers = CLASSIFIERS ,
149+ setup_requires = ['gease' ],
150+ cmdclass = {
151+ 'publish' : PublishCommand ,
152+ }
114153 )
0 commit comments