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
7
7
8
8
NAME = 'pyexcel-xlsx'
9
9
AUTHOR = 'C.W.'
10
- VERSION = '0.5.0. 1'
10
+ VERSION = '0.5.1'
11
11
12
12
LICENSE = 'New BSD'
13
13
DESCRIPTION = (
16
16
''
17
17
)
18
18
URL = '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' ]
21
21
KEYWORDS = [
22
22
'xlsx'
23
23
'python'
47
47
PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
48
48
EXTRAS_REQUIRE = {
49
49
}
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 ()
50
86
51
87
52
88
def read_files (* files ):
@@ -60,7 +96,7 @@ def read_files(*files):
60
96
61
97
def read (afile ):
62
98
"""Read a file into setup"""
63
- with open (afile , 'r' ) as opened_file :
99
+ with codecs . open (afile , 'r' , 'utf-8 ' ) as opened_file :
64
100
content = filter_out_test_code (opened_file )
65
101
content = "" .join (list (content ))
66
102
return content
@@ -108,5 +144,9 @@ def filter_out_test_code(file_handle):
108
144
packages = PACKAGES ,
109
145
include_package_data = True ,
110
146
zip_safe = False ,
111
- classifiers = CLASSIFIERS
147
+ classifiers = CLASSIFIERS ,
148
+ setup_requires = ['gease' ],
149
+ cmdclass = {
150
+ 'publish' : PublishCommand ,
151
+ }
112
152
)
0 commit comments