99
1010NAME = 'gease'
1111AUTHOR = 'C. W.'
12- VERSION = '0.0.2 '
12+ VERSION = '0.0.3 '
1313EMAIL = 'wangc_2011@hotmail.com'
1414LICENSE = 'MIT'
1515ENTRY_POINTS = {
2222 ''
2323)
2424URL = 'https://github.com/moremoban/gease'
25- DOWNLOAD_URL = '%s/archive/0.0.2 .tar.gz' % URL
25+ DOWNLOAD_URL = '%s/archive/0.0.3 .tar.gz' % URL
2626FILES = ['README.rst' , 'CHANGELOG.rst' ]
2727KEYWORDS = [
2828 'python'
5151PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
5252EXTRAS_REQUIRE = {
5353}
54+ # You do not need to read beyond this line
5455PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi' .format (
5556 sys .executable )
56- GS_COMMAND = ('gs gease v0.0.2 ' +
57- "Find 0.0.2 in changelog for more details" )
58- here = os .path .abspath (os .path .dirname (__file__ ))
57+ GS_COMMAND = ('gs gease v0.0.3 ' +
58+ "Find 0.0.3 in changelog for more details" )
59+ NO_GS_MESSAGE = ('Automatic github release is disabled. ' +
60+ 'Please install gease to enable it.' )
61+ UPLOAD_FAILED_MSG = (
62+ 'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND )
63+ HERE = os .path .abspath (os .path .dirname (__file__ ))
5964
6065
6166class PublishCommand (Command ):
@@ -78,17 +83,36 @@ def finalize_options(self):
7883 def run (self ):
7984 try :
8085 self .status ('Removing previous builds...' )
81- rmtree (os .path .join (here , 'dist' ))
86+ rmtree (os .path .join (HERE , 'dist' ))
8287 except OSError :
8388 pass
8489
8590 self .status ('Building Source and Wheel (universal) distribution...' )
86- if os .system (GS_COMMAND ) == 0 :
87- os .system (PUBLISH_COMMAND )
91+ run_status = True
92+ if has_gease ():
93+ run_status = os .system (GS_COMMAND ) == 0
94+ else :
95+ self .status (NO_GS_MESSAGE )
96+ if run_status :
97+ if os .system (PUBLISH_COMMAND ) != 0 :
98+ self .status (UPLOAD_FAILED_MSG % PUBLISH_COMMAND )
8899
89100 sys .exit ()
90101
91102
103+ def has_gease ():
104+ """
105+ test if github release command is installed
106+
107+ visit http://github.com/moremoban/gease for more info
108+ """
109+ try :
110+ import gease # noqa
111+ return True
112+ except ImportError :
113+ return False
114+
115+
92116def read_files (* files ):
93117 """Read files into setup"""
94118 text = ""
@@ -150,7 +174,6 @@ def filter_out_test_code(file_handle):
150174 zip_safe = False ,
151175 entry_points = ENTRY_POINTS ,
152176 classifiers = CLASSIFIERS ,
153- setup_requires = ['gease' ],
154177 cmdclass = {
155178 'publish' : PublishCommand ,
156179 }
0 commit comments