20
20
from reversion_compare import __version__
21
21
22
22
23
+ PACKAGE_ROOT = os .path .dirname (os .path .abspath (__file__ ))
24
+
25
+
26
+ # convert README.creole on-the-fly to ReSt, see also:
27
+ # https://github.com/jedie/python-creole/wiki/Use-In-Setup/
28
+ check_readme = "publish" in sys .argv or "check" in sys .argv or "register" in sys .argv or "sdist" in sys .argv or "--long-description" in sys .argv
29
+ try :
30
+ from creole .setup_utils import get_long_description
31
+ except ImportError as err :
32
+ if check_readme :
33
+ raise ImportError ("%s - Please install python-creole >= v0.8 - e.g.: pip install python-creole" % err )
34
+ long_description = None
35
+ else :
36
+ if check_readme :
37
+ print ("\n Check creole2ReSt:" )
38
+ long_description = get_long_description (PACKAGE_ROOT )
39
+ if check_readme :
40
+ print ("OK" )
41
+
42
+
23
43
if "publish" in sys .argv :
24
44
"""
25
45
Build and upload to PyPi, if...
32
52
The cli arguments will be pass to 'twine'. So this is possible:
33
53
* Display 'twine' help page...: ./setup.py publish --help
34
54
* use testpypi................: ./setup.py publish --repository=test
55
+
56
+ TODO: Look at: https://github.com/zestsoftware/zest.releaser
35
57
"""
36
58
# Imports here, so it's easier to copy&paste this complete code block ;)
37
59
import subprocess
@@ -101,14 +123,24 @@ def verbose_check_call(*args):
101
123
print (output )
102
124
sys .exit (- 1 )
103
125
104
- print ("\n git tag version (will raise a error of tag already exists)" )
105
- verbose_check_call ("git" , "tag" , "v%s" % __version__ )
126
+ print ("\n check if pull is needed" )
127
+ verbose_check_call ("git" , "fetch" , "--all" )
128
+ call_info , output = verbose_check_output ("git" , "log" , "HEAD..origin/master" , "--oneline" )
129
+ print ("\t %s" % call_info )
130
+ if output == "" :
131
+ print ("OK" )
132
+ else :
133
+ print ("\n *** ERROR: git repro is not up-to-date:" )
134
+ print (output )
135
+ sys .exit (- 1 )
136
+ verbose_check_call ("git" , "push" )
106
137
107
138
print ("\n Cleanup old builds:" )
108
139
def rmtree (path ):
109
140
path = os .path .abspath (path )
110
- print ("\t remove tree:" , path )
111
- shutil .rmtree (path )
141
+ if os .path .isdir (path ):
142
+ print ("\t remove tree:" , path )
143
+ shutil .rmtree (path )
112
144
rmtree ("./dist" )
113
145
rmtree ("./build" )
114
146
@@ -124,6 +156,9 @@ def rmtree(path):
124
156
log .write (output )
125
157
print ("Build output is in log file: %r" % log_filename )
126
158
159
+ print ("\n git tag version (will raise a error of tag already exists)" )
160
+ verbose_check_call ("git" , "tag" , "v%s" % __version__ )
161
+
127
162
print ("\n Upload with twine:" )
128
163
twine_args = sys .argv [1 :]
129
164
twine_args .remove ("publish" )
@@ -132,26 +167,12 @@ def rmtree(path):
132
167
from twine .commands .upload import main as twine_upload
133
168
twine_upload (twine_args )
134
169
135
- print ("\n git push to server" )
136
- verbose_check_call ("git" , "push" )
170
+ print ("\n git push tag to server" )
137
171
verbose_check_call ("git" , "push" , "--tags" )
138
172
139
173
sys .exit (0 )
140
174
141
175
142
- PACKAGE_ROOT = os .path .dirname (os .path .abspath (__file__ ))
143
-
144
-
145
- # convert creole to ReSt on-the-fly, see also:
146
- # https://code.google.com/p/python-creole/wiki/UseInSetup
147
- try :
148
- from creole .setup_utils import get_long_description
149
- except ImportError as err :
150
- if "check" in sys .argv or "register" in sys .argv or "sdist" in sys .argv or "--long-description" in sys .argv :
151
- raise ImportError ("%s - Please install python-creole >= v0.8 - e.g.: pip install python-creole" % err )
152
- long_description = None
153
- else :
154
- long_description = get_long_description (PACKAGE_ROOT )
155
176
156
177
157
178
def get_authors ():
@@ -193,7 +214,11 @@ def get_authors():
193
214
# "Intended Audience :: End Users/Desktop",
194
215
"License :: OSI Approved :: GNU General Public License (GPL)" ,
195
216
"Programming Language :: Python" ,
196
- 'Framework :: Django' ,
217
+ "Programming Language :: Python :: 2.7" ,
218
+ "Programming Language :: Python :: 3.4" ,
219
+ "Framework :: Django" ,
220
+ "Framework :: Django :: 1.7" ,
221
+ "Framework :: Django :: 1.8" ,
197
222
"Topic :: Database :: Front-Ends" ,
198
223
"Topic :: Documentation" ,
199
224
"Topic :: Internet :: WWW/HTTP :: Dynamic Content" ,
0 commit comments