This commit is contained in:
Xinyu Hou 2014-10-21 15:49:39 +01:00
commit e746cc401a
3 changed files with 41 additions and 3 deletions

19
.gitignore vendored
View File

@ -17,3 +17,22 @@
#doxygen
/doc/doxygen
/doc/doxygen.cfg
/build
/ext/cryptopp562
/ext/gmock-1.6.0
/ext/gtest-1.6.0
/lib
/src/gui/ui_SetupWizardBase.h
/src/gui/Makefile
/src/gui/Makefile.Debug
/src/gui/Makefile.Release
/src/gui/object_script.synergy.Debug
/src/gui/object_script.synergy.Release
/src/gui/ui_AboutDialogBase.h
/src/gui/ui_ActionDialogBase.h
/src/gui/ui_HotkeyDialogBase.h
/src/gui/ui_MainWindowBase.h
/src/gui/ui_ScreenSettingsDialogBase.h
/src/gui/ui_ServerConfigDialogBase.h
/src/gui/ui_SettingsDialogBase.h
/src/gui/tmp

View File

@ -941,6 +941,24 @@ class InternalCommands:
print self.find_revision()
def find_revision(self):
return self.getGitRevision()
def getGitRevision(self):
if sys.version_info < (2, 4):
raise Exception("Python 2.4 or greater required.")
else:
p = subprocess.Popen(
["git", "log", "--pretty=format:%h", "-n", "1"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
if p.returncode != 0:
raise Exception('Could not get revision - git info failed with code: ' + str(p.returncode))
return stdout
def find_revision_svn(self):
if sys.version_info < (2, 4):
stdout = commands.getoutput('svn info')
else:
@ -1174,7 +1192,8 @@ class InternalCommands:
shutil.rmtree(exportPath)
print 'Exporting repository to: ' + exportPath
err = os.system('svn export . ' + exportPath)
os.mkdir(exportPath)
err = os.system('git archive master | tar -x -C ' + exportPath)
if err != 0:
raise Exception('Repository export failed: ' + str(err))
@ -1403,7 +1422,7 @@ class InternalCommands:
def dist_name_rev(self, type):
# find the version number (we're puting the rev in after this)
pattern = '(.*\d+\.\d+\.\d+)(.*)'
replace = '\g<1>-r' + self.find_revision() + '\g<2>'
replace = '\g<1>-' + self.find_revision() + '\g<2>'
return re.sub(pattern, replace, self.dist_name(type))
def dist_usage(self):

2
test
View File

@ -1 +1 @@
2
3