Add git tagging to the 'setup.py release' command
added as well better error handling
This commit is contained in:
parent
e6decf93da
commit
e1bd64439c
@ -286,10 +286,12 @@ def cmd_genpot(config, options, args):
|
|||||||
def cmd_release(config, options, args):
|
def cmd_release(config, options, args):
|
||||||
if not os.path.isdir('.git'):
|
if not os.path.isdir('.git'):
|
||||||
print 'ERROR - this command works only for git repositories'
|
print 'ERROR - this command works only for git repositories'
|
||||||
|
return
|
||||||
|
|
||||||
retcode = subprocess.call(['git', 'pull'])
|
retcode = subprocess.call(['git', 'pull'])
|
||||||
if retcode:
|
if retcode:
|
||||||
print 'ERROR - cannot pull from git'
|
print 'ERROR - cannot pull from git'
|
||||||
|
return
|
||||||
|
|
||||||
print 'Bumping activity version...'
|
print 'Bumping activity version...'
|
||||||
|
|
||||||
@ -348,20 +350,32 @@ def cmd_release(config, options, args):
|
|||||||
f.write(news)
|
f.write(news)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
print 'Creating the bundle...'
|
||||||
|
packager = XOPackager(config)
|
||||||
|
packager.package()
|
||||||
|
|
||||||
print 'Committing to git...'
|
print 'Committing to git...'
|
||||||
|
|
||||||
changelog = 'Release version %d.' % version
|
changelog = 'Release version %d.' % version
|
||||||
retcode = subprocess.call(['git', 'commit', '-a', '-m % s' % changelog])
|
retcode = subprocess.call(['git', 'commit', '-a', '-m % s' % changelog])
|
||||||
if retcode:
|
if retcode:
|
||||||
print 'ERROR - cannot commit to git'
|
print 'ERROR - cannot commit to git'
|
||||||
|
return
|
||||||
|
|
||||||
|
retcode = subprocess.call(['git', 'tag', 'v%s' % version])
|
||||||
|
if retcode:
|
||||||
|
print 'ERROR - cannot tag the commit'
|
||||||
|
return
|
||||||
|
|
||||||
retcode = subprocess.call(['git', 'push'])
|
retcode = subprocess.call(['git', 'push'])
|
||||||
if retcode:
|
if retcode:
|
||||||
print 'ERROR - cannot push to git'
|
print 'ERROR - cannot push to git'
|
||||||
|
return
|
||||||
print 'Creating the bundle...'
|
|
||||||
packager = XOPackager(config)
|
retcode = subprocess.call(['git', 'push', '--tags'])
|
||||||
packager.package()
|
if retcode:
|
||||||
|
print 'ERROR - cannot push tags to git'
|
||||||
|
return
|
||||||
|
|
||||||
print 'Done.'
|
print 'Done.'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user