Skip to content
Snippets Groups Projects
Commit 2d10efcc authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Fixed GAUDI-1153: fixes to prepare_gaudi_release.py

* fixed she-bang line
* fixed implementation of versionKey function
* added check on the version of Git (require >= 1.7.9.1)

See merge request !83
parents 8119d23e d581c4fb
No related branches found
No related tags found
No related merge requests found
#!/usr/bin.env python #!/usr/bin/env python
''' '''
Script to prepare the release of Gaudi. Script to prepare the release of Gaudi.
...@@ -12,6 +12,21 @@ import re ...@@ -12,6 +12,21 @@ import re
import ConfigParser import ConfigParser
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
def checkGitVersion():
'''
Ensure we have a usable version of Git (>= 1.7.9.1).
See:
* https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/1.7.9.1.txt
* https://github.com/git/git/commit/36ed1913e1d5de0930e59db6eeec3ccb2bd58bd9
'''
proc = Popen(['git', '--version'], stdout=PIPE)
version = proc.communicate()[0].split()[-1]
if proc.returncode:
raise RuntimeError('could not get git version')
if versionKey(version) < versionKey('1.7.9.1'):
raise RuntimeError('bad version of git found: %s (1.7.9.1 required)' % version)
_VK_RE = re.compile(r'(\d+|\D+)') _VK_RE = re.compile(r'(\d+|\D+)')
def versionKey(x): def versionKey(x):
''' '''
...@@ -19,7 +34,7 @@ def versionKey(x): ...@@ -19,7 +34,7 @@ def versionKey(x):
as version numbers. as version numbers.
''' '''
return [int(i) if i[0] in '0123456789' else i return [int(i) if i[0] in '0123456789' else i
for i in _VK_RE.split('v10r31') for i in _VK_RE.split(x)
if i] if i]
def findLatestTag(): def findLatestTag():
...@@ -222,7 +237,7 @@ def main(): ...@@ -222,7 +237,7 @@ def main():
git_log) git_log)
vers = raw_input(msg) vers = raw_input(msg)
while not vers or vers == old_vers: while not vers or vers == old_vers:
vers = raw_input('give me a version') vers = raw_input('give me a version, please. ')
if vers: if vers:
change_version(pkgdir, vers) change_version(pkgdir, vers)
updateReleaseNotes(pkgdir, updateReleaseNotes(pkgdir,
...@@ -263,5 +278,6 @@ def main(): ...@@ -263,5 +278,6 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
checkGitVersion()
main() main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment