Commits

abudden committed 3262d88

Added release version generation.

Comments (0)

Files changed (3)

dist/make_taghighlight_release.py

             matches.append(os.path.join(root, filename))
     return matches
 
+def UpdateReleaseVersion():
+    release_file = os.path.join(vimfiles_dir,'plugin/TagHighlight/data/release.txt')
+    fh = open(release_file,'r')
+    lines = [i for i in fh]
+    fh.close()
+    release = 'INVALID'
+    fh = open(release_file, 'wb')
+    for line in lines:
+        if line.startswith('release:'):
+            parts = line.strip().split(':')
+            numbers = [int(i) for i in parts[1].split('.')]
+            release = '{0}.{1}.{2}'.format(numbers[0],numbers[1],numbers[2]+1))
+            fh.write('release:'+release+'\n')
+        else:
+            fh.write(line.strip() + '\n')
+    fh.close()
+    return release
+
 version_info_format = '''
 release_clean:{clean}
 release_date:{date}
     pyinstaller_path = os.environ['WINPYINSTALLERDIR']
     MakeCompiled(pyexe, pyinstaller_path)
 
+def CheckInChanges(r):
+    args = BZR+['ci','-m','Release build {0}'.format(r)]
+    p = subprocess.Popen(args)
+    (stdout,stderr) = p.communicate()
 
 def main():
     version_file, clean = GenerateVersionInfo()
+    new_release = UpdateReleaseVersion()
 
     if clean:
         MakeZipFile()
         MakeWin32Compiled()
+        CheckInChanges(new_release)
     else:
         print("Distribution not clean: check into Bazaar before making release.")
 

plugin/TagHighlight/data/release.txt

+# Release is major.minor.revision
+# Revision is incremented automatically, when incrementing
+# others, set revision back to -1: first release will be 0.
+release:0.0.-1

plugin/TagHighlight/module/config.py

 def LoadVersionInfo():
     global config
     config['version'] = {}
+    fh = open(os.path.join(config['data_directory'],'release.txt'),'r')
+    for line in fh:
+        if line.startswith('release:'):
+            config['release'] = line.strip().split(':')[1]
+            break
+    fh.close()
     try:
         fh = open(os.path.join(config['version_info_dir'],'version_info.txt'), 'r')
         for line in fh:
             if line.startswith('release_'):
                 parts = line.strip().split(':')
                 config['version'][parts[0]] = parts[1]
+        fh.close()
     except IOError:
         for name in ['clean','date','revno','revision_id']:
             config['version']['release_'+name] = 'Unreleased'