Author: bugman Date: Thu May 22 18:18:27 2014 New Revision: 23345 URL: http://svn.gna.org/viewcvs/relax?rev=23345&view=rev Log: Improvements for the git-svn support in the relax version module. Python 3 is now correctly handled and the URL is properly extracted from the git repository. Modified: trunk/version.py Modified: trunk/version.py URL: http://svn.gna.org/viewcvs/relax/trunk/version.py?rev=23345&r1=23344&r2=23345&view=diff ============================================================================== --- trunk/version.py (original) +++ trunk/version.py Thu May 22 18:18:27 2014 @@ -75,6 +75,11 @@ if not pipe.stderr.readlines(): # Loop over the output lines. for line in pipe.stdout.readlines(): + # Decode Python 3 byte arrays. + if hasattr(line, 'decode'): + line = line.decode() + + # The revision. if search('^[0-9]', line): return str(line[:-1]) @@ -111,12 +116,21 @@ return str(row[1]) # Try git-svn, reading the output if there are no errors. - pipe = Popen('git svn info --url', shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False) + print 'cd %s; git svn info' % status.install_path + pipe = Popen('cd %s; git svn info' % status.install_path, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False) if not pipe.stderr.readlines(): # Loop over the output lines. for line in pipe.stdout.readlines(): - if search('^svn', line): - return str(line[:-1]) + # Decode Python 3 byte arrays. + if hasattr(line, 'decode'): + line = line.decode() + + # Split up the line. + row = line.split() + + # The revision. + if len(row) and row[0] == 'URL:': + return str(row[1]) def version_full():