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
3+ import sys
4+ import codecs
5+ from shutil import rmtree
6+ from setuptools import setup , find_packages , Command
77
88NAME = 'pyexcel-xlsx'
99AUTHOR = 'C.W.'
10- VERSION = '0.5.0. 1'
10+ VERSION = '0.5.1'
11111212LICENSE = 'New BSD'
1313DESCRIPTION = (
1616 ''
1717)
1818URL = 'https://github.com/pyexcel/pyexcel-xlsx'
19- DOWNLOAD_URL = '%s/archive/0.5.0. 1.tar.gz' % URL
20- FILES = ['README.rst' , 'CHANGELOG.rst' ]
19+ DOWNLOAD_URL = '%s/archive/0.5.1.tar.gz' % URL
20+ FILES = ['README.rst' , 'CHANGELOG.rst' ]
2121KEYWORDS = [
2222 'xlsx'
2323 'python'
4747PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
4848EXTRAS_REQUIRE = {
4949}
50+ PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi' .format (
51+ sys .executable )
52+ GS_COMMAND = ('gs pyexcel-xlsx v0.5.1 ' +
53+ "Find 0.5.1 in changelog for more details" )
54+ here = os .path .abspath (os .path .dirname (__file__ ))
55+
56+
57+ class PublishCommand (Command ):
58+ """Support setup.py upload."""
59+
60+ description = 'Build and publish the package on github and pypi'
61+ user_options = []
62+
63+ @staticmethod
64+ def status (s ):
65+ """Prints things in bold."""
66+ print ('\033 [1m{0}\033 [0m' .format (s ))
67+
68+ def initialize_options (self ):
69+ pass
70+
71+ def finalize_options (self ):
72+ pass
73+
74+ def run (self ):
75+ try :
76+ self .status ('Removing previous builds...' )
77+ rmtree (os .path .join (here , 'dist' ))
78+ except OSError :
79+ pass
80+
81+ self .status ('Building Source and Wheel (universal) distribution...' )
82+ if os .system (GS_COMMAND ) == 0 :
83+ os .system (PUBLISH_COMMAND )
84+
85+ sys .exit ()
5086
5187
5288def read_files (* files ):
@@ -60,7 +96,7 @@ def read_files(*files):
6096
6197def read (afile ):
6298 """Read a file into setup"""
63- with open (afile , 'r' ) as opened_file :
99+ with codecs . open (afile , 'r' , 'utf-8 ' ) as opened_file :
64100 content = filter_out_test_code (opened_file )
65101 content = "" .join (list (content ))
66102 return content
@@ -108,5 +144,9 @@ def filter_out_test_code(file_handle):
108144 packages = PACKAGES ,
109145 include_package_data = True ,
110146 zip_safe = False ,
111- classifiers = CLASSIFIERS
147+ classifiers = CLASSIFIERS ,
148+ setup_requires = ['gease' ],
149+ cmdclass = {
150+ 'publish' : PublishCommand ,
151+ }
112152 )
0 commit comments