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
7
3
import sys
4
+ import codecs
5
+ from shutil import rmtree
6
+ from setuptools import setup , find_packages , Command
8
7
PY2 = sys .version_info [0 ] == 2
9
8
PY26 = PY2 and sys .version_info [1 ] < 7
10
9
11
10
NAME = 'pyexcel-ods3'
12
11
AUTHOR = 'C.W.'
13
- VERSION = '0.5.0 '
12
+ VERSION = '0.5.1 '
14
13
15
14
LICENSE = 'New BSD'
16
15
DESCRIPTION = (
17
16
'A wrapper library to read, manipulate and write data in ods format' +
18
17
''
19
18
)
20
19
URL = 'https://github.com/pyexcel/pyexcel-ods3'
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' ]
23
22
KEYWORDS = [
24
23
'ods'
25
24
'python'
51
50
PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
52
51
EXTRAS_REQUIRE = {
53
52
}
53
+ PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi' .format (
54
+ sys .executable )
55
+ GS_COMMAND = ('gs pyexcel-ods3 v0.5.1 ' +
56
+ "Find 0.5.1 in changelog for more details" )
57
+ here = os .path .abspath (os .path .dirname (__file__ ))
58
+
59
+
60
+ class PublishCommand (Command ):
61
+ """Support setup.py upload."""
62
+
63
+ description = 'Build and publish the package on github and pypi'
64
+ user_options = []
65
+
66
+ @staticmethod
67
+ def status (s ):
68
+ """Prints things in bold."""
69
+ print ('\033 [1m{0}\033 [0m' .format (s ))
70
+
71
+ def initialize_options (self ):
72
+ pass
73
+
74
+ def finalize_options (self ):
75
+ pass
76
+
77
+ def run (self ):
78
+ try :
79
+ self .status ('Removing previous builds...' )
80
+ rmtree (os .path .join (here , 'dist' ))
81
+ except OSError :
82
+ pass
83
+
84
+ self .status ('Building Source and Wheel (universal) distribution...' )
85
+ if os .system (GS_COMMAND ) == 0 :
86
+ os .system (PUBLISH_COMMAND )
87
+
88
+ sys .exit ()
54
89
55
90
56
91
def read_files (* files ):
@@ -64,7 +99,7 @@ def read_files(*files):
64
99
65
100
def read (afile ):
66
101
"""Read a file into setup"""
67
- with open (afile , 'r' ) as opened_file :
102
+ with codecs . open (afile , 'r' , 'utf-8 ' ) as opened_file :
68
103
content = filter_out_test_code (opened_file )
69
104
content = "" .join (list (content ))
70
105
return content
@@ -112,5 +147,9 @@ def filter_out_test_code(file_handle):
112
147
packages = PACKAGES ,
113
148
include_package_data = True ,
114
149
zip_safe = False ,
115
- classifiers = CLASSIFIERS
150
+ classifiers = CLASSIFIERS ,
151
+ setup_requires = ['gease' ],
152
+ cmdclass = {
153
+ 'publish' : PublishCommand ,
154
+ }
116
155
)
0 commit comments