Fixed messed up indentation in commands1.py #4695
This commit is contained in:
parent
74dda188dc
commit
16d9bd8f0d
|
@ -55,14 +55,14 @@ class Toolchain:
|
||||||
'reformat' : ['', []],
|
'reformat' : ['', []],
|
||||||
'open' : ['', []],
|
'open' : ['', []],
|
||||||
'genlist' : ['', []],
|
'genlist' : ['', []],
|
||||||
'reset' : ['', []],
|
'reset' : ['', []],
|
||||||
'signwin' : ['', ['pfx=', 'pwd=', 'dist']],
|
'signwin' : ['', ['pfx=', 'pwd=', 'dist']],
|
||||||
'signmac' : ['', []]
|
'signmac' : ['', []]
|
||||||
}
|
}
|
||||||
|
|
||||||
# aliases to valid commands
|
# aliases to valid commands
|
||||||
cmd_alias_dict = {
|
cmd_alias_dict = {
|
||||||
'info' : 'about',
|
'info' : 'about',
|
||||||
'help' : 'usage',
|
'help' : 'usage',
|
||||||
'package' : 'dist',
|
'package' : 'dist',
|
||||||
'docs' : 'doxygen',
|
'docs' : 'doxygen',
|
||||||
|
@ -319,7 +319,6 @@ class InternalCommands:
|
||||||
self.configure(target)
|
self.configure(target)
|
||||||
|
|
||||||
def checkGTest(self):
|
def checkGTest(self):
|
||||||
|
|
||||||
dir = self.extDir + '/' + self.gtestDir
|
dir = self.extDir + '/' + self.gtestDir
|
||||||
if (os.path.isdir(dir)):
|
if (os.path.isdir(dir)):
|
||||||
return
|
return
|
||||||
|
@ -335,7 +334,6 @@ class InternalCommands:
|
||||||
self.zipExtractAll(zip, dir)
|
self.zipExtractAll(zip, dir)
|
||||||
|
|
||||||
def checkGMock(self):
|
def checkGMock(self):
|
||||||
|
|
||||||
dir = self.extDir + '/' + self.gmockDir
|
dir = self.extDir + '/' + self.gmockDir
|
||||||
if (os.path.isdir(dir)):
|
if (os.path.isdir(dir)):
|
||||||
return
|
return
|
||||||
|
@ -524,14 +522,14 @@ class InternalCommands:
|
||||||
version = commands.getoutput("qmake --version")
|
version = commands.getoutput("qmake --version")
|
||||||
result = re.search('(\d+)\.(\d+)\.(\d)', version)
|
result = re.search('(\d+)\.(\d+)\.(\d)', version)
|
||||||
|
|
||||||
if not result:
|
if not result:
|
||||||
raise Exception("Could not get qmake version.")
|
raise Exception("Could not get qmake version.")
|
||||||
|
|
||||||
major = int(result.group(1))
|
major = int(result.group(1))
|
||||||
minor = int(result.group(2))
|
minor = int(result.group(2))
|
||||||
rev = int(result.group(3))
|
rev = int(result.group(3))
|
||||||
|
|
||||||
return (major, minor, rev)
|
return (major, minor, rev)
|
||||||
|
|
||||||
def getMacSdkDir(self):
|
def getMacSdkDir(self):
|
||||||
sdkName = "macosx" + self.macSdk
|
sdkName = "macosx" + self.macSdk
|
||||||
|
@ -575,10 +573,10 @@ class InternalCommands:
|
||||||
# if return code from cmake is not 0, then either something has
|
# if return code from cmake is not 0, then either something has
|
||||||
# gone terribly wrong with --version, or it genuinely doesn't exist.
|
# gone terribly wrong with --version, or it genuinely doesn't exist.
|
||||||
print ('Could not find `%s` in system path.\n'
|
print ('Could not find `%s` in system path.\n'
|
||||||
'Download the latest version from:\n %s') % (
|
'Download the latest version from:\n %s') % (
|
||||||
self.cmake_cmd, self.cmake_url)
|
self.cmake_cmd, self.cmake_url)
|
||||||
raise Exception('Cannot continue without CMake.')
|
raise Exception('Cannot continue without CMake.')
|
||||||
else:
|
else:
|
||||||
return self.cmake_cmd
|
return self.cmake_cmd
|
||||||
|
|
||||||
def persist_qt(self):
|
def persist_qt(self):
|
||||||
|
@ -786,15 +784,15 @@ class InternalCommands:
|
||||||
# reorganize Qt frameworks layout on Mac 10.9.5 or later
|
# reorganize Qt frameworks layout on Mac 10.9.5 or later
|
||||||
# http://goo.gl/BFnQ8l
|
# http://goo.gl/BFnQ8l
|
||||||
# QtCore example:
|
# QtCore example:
|
||||||
# QtCore.framework/
|
# QtCore.framework/
|
||||||
# QtCore -> Versions/Current/QtCore
|
# QtCore -> Versions/Current/QtCore
|
||||||
# Resources -> Versions/Current/Resources
|
# Resources -> Versions/Current/Resources
|
||||||
# Versions/
|
# Versions/
|
||||||
# Current -> 5
|
# Current -> 5
|
||||||
# 5/
|
# 5/
|
||||||
# QtCore
|
# QtCore
|
||||||
# Resources/
|
# Resources/
|
||||||
# Info.plist
|
# Info.plist
|
||||||
targetDir = self.getGenerator().getBinDir(target)
|
targetDir = self.getGenerator().getBinDir(target)
|
||||||
|
|
||||||
target = targetDir + "/Synergy.app/Contents/Frameworks"
|
target = targetDir + "/Synergy.app/Contents/Frameworks"
|
||||||
|
@ -1026,7 +1024,7 @@ class InternalCommands:
|
||||||
|
|
||||||
elif type == 'rpm':
|
elif type == 'rpm':
|
||||||
if sys.platform == 'linux2':
|
if sys.platform == 'linux2':
|
||||||
self.distRpm()
|
self.distRpm()
|
||||||
else:
|
else:
|
||||||
package_unsupported = True
|
package_unsupported = True
|
||||||
|
|
||||||
|
@ -1062,9 +1060,9 @@ class InternalCommands:
|
||||||
("Package type, '%s' is not supported for platform, '%s'")
|
("Package type, '%s' is not supported for platform, '%s'")
|
||||||
% (type, sys.platform))
|
% (type, sys.platform))
|
||||||
|
|
||||||
def distRpm(self):
|
def distRpm(self):
|
||||||
rpmDir = self.getGenerator().buildDir + '/rpm'
|
rpmDir = self.getGenerator().buildDir + '/rpm'
|
||||||
if os.path.exists(rpmDir):
|
if os.path.exists(rpmDir):
|
||||||
shutil.rmtree(rpmDir)
|
shutil.rmtree(rpmDir)
|
||||||
|
|
||||||
os.makedirs(rpmDir)
|
os.makedirs(rpmDir)
|
||||||
|
@ -1072,51 +1070,52 @@ class InternalCommands:
|
||||||
templateFile = open(self.cmake_dir + '/synergy.spec.in')
|
templateFile = open(self.cmake_dir + '/synergy.spec.in')
|
||||||
template = templateFile.read()
|
template = templateFile.read()
|
||||||
|
|
||||||
template = template.replace('${in:version}', self.getVersionFromCmake())
|
template = template.replace('${in:version}', self.getVersionFromCmake())
|
||||||
|
|
||||||
specPath = rpmDir + '/synergy.spec'
|
specPath = rpmDir + '/synergy.spec'
|
||||||
|
|
||||||
specFile = open(specPath, 'w')
|
specFile = open(specPath, 'w')
|
||||||
specFile.write(template)
|
specFile.write(template)
|
||||||
specFile.close()
|
specFile.close()
|
||||||
|
|
||||||
version = self.getVersionFromCmake()
|
version = self.getVersionFromCmake()
|
||||||
target = '../../bin/synergy-%s-%s.rpm' % (
|
target = '../../bin/synergy-%s-%s.rpm' % (
|
||||||
version, self.getLinuxPlatform())
|
version, self.getLinuxPlatform())
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.try_chdir(rpmDir)
|
self.try_chdir(rpmDir)
|
||||||
cmd = 'rpmbuild -bb --define "_topdir `pwd`" synergy.spec'
|
cmd = 'rpmbuild -bb --define "_topdir `pwd`" synergy.spec'
|
||||||
print "Command: " + cmd
|
print "Command: " + cmd
|
||||||
err = os.system(cmd)
|
err = os.system(cmd)
|
||||||
if err != 0:
|
if err != 0:
|
||||||
raise Exception('rpmbuild failed: ' + str(err))
|
raise Exception('rpmbuild failed: ' + str(err))
|
||||||
|
|
||||||
self.unixMove('RPMS/*/*.rpm', target)
|
self.unixMove('RPMS/*/*.rpm', target)
|
||||||
|
|
||||||
cmd = 'rpmlint ' + target
|
cmd = 'rpmlint ' + target
|
||||||
print "Command: " + cmd
|
print "Command: " + cmd
|
||||||
err = os.system(cmd)
|
err = os.system(cmd)
|
||||||
if err != 0:
|
if err != 0:
|
||||||
raise Exception('rpmlint failed: ' + str(err))
|
raise Exception('rpmlint failed: ' + str(err))
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
self.restore_chdir()
|
self.restore_chdir()
|
||||||
|
|
||||||
def distDeb(self):
|
def distDeb(self):
|
||||||
buildDir = self.getGenerator().buildDir
|
buildDir = self.getGenerator().buildDir
|
||||||
binDir = self.getGenerator().binDir
|
binDir = self.getGenerator().binDir
|
||||||
resDir = self.cmake_dir
|
resDir = self.cmake_dir
|
||||||
|
|
||||||
version = self.getVersionFromCmake()
|
version = self.getVersionFromCmake()
|
||||||
package = '%s-%s-%s' % (
|
package = '%s-%s-%s' % (
|
||||||
self.project, version, self.getLinuxPlatform())
|
self.project, version, self.getLinuxPlatform())
|
||||||
|
|
||||||
debDir = '%s/deb' % buildDir
|
debDir = '%s/deb' % buildDir
|
||||||
if os.path.exists(debDir):
|
if os.path.exists(debDir):
|
||||||
shutil.rmtree(debDir)
|
shutil.rmtree(debDir)
|
||||||
|
|
||||||
metaDir = '%s/%s/DEBIAN' % (debDir, package)
|
metaDir = '%s/%s/DEBIAN' % (debDir, package)
|
||||||
os.makedirs(metaDir)
|
os.makedirs(metaDir)
|
||||||
|
|
||||||
templateFile = open(resDir + '/deb/control.in')
|
templateFile = open(resDir + '/deb/control.in')
|
||||||
|
@ -1181,14 +1180,14 @@ class InternalCommands:
|
||||||
self.try_chdir(debDir)
|
self.try_chdir(debDir)
|
||||||
|
|
||||||
# TODO: consider dpkg-buildpackage (higher level tool)
|
# TODO: consider dpkg-buildpackage (higher level tool)
|
||||||
cmd = 'fakeroot dpkg-deb --build %s' % package
|
cmd = 'fakeroot dpkg-deb --build %s' % package
|
||||||
print "Command: " + cmd
|
print "Command: " + cmd
|
||||||
err = os.system(cmd)
|
err = os.system(cmd)
|
||||||
if err != 0:
|
if err != 0:
|
||||||
raise Exception('dpkg-deb failed: ' + str(err))
|
raise Exception('dpkg-deb failed: ' + str(err))
|
||||||
|
|
||||||
cmd = 'lintian %s.deb' % package
|
cmd = 'lintian %s.deb' % package
|
||||||
print "Command: " + cmd
|
print "Command: " + cmd
|
||||||
err = os.system(cmd)
|
err = os.system(cmd)
|
||||||
if err != 0:
|
if err != 0:
|
||||||
raise Exception('lintian failed: ' + str(err))
|
raise Exception('lintian failed: ' + str(err))
|
||||||
|
@ -1307,7 +1306,7 @@ class InternalCommands:
|
||||||
|
|
||||||
if generator.endswith('Win64'):
|
if generator.endswith('Win64'):
|
||||||
arch = 'x64'
|
arch = 'x64'
|
||||||
installDirVar = '$PROGRAMFILES64'
|
installDirVar = '$PROGRAMFILES64'
|
||||||
|
|
||||||
templateFile = open(self.cmake_dir + '\Installer.nsi.in')
|
templateFile = open(self.cmake_dir + '\Installer.nsi.in')
|
||||||
template = templateFile.read()
|
template = templateFile.read()
|
||||||
|
@ -1368,9 +1367,19 @@ class InternalCommands:
|
||||||
nsPluginTarget = self.getLibraryDistFilename(type, pluginsDir, 'ns')
|
nsPluginTarget = self.getLibraryDistFilename(type, pluginsDir, 'ns')
|
||||||
self.ftpUpload(ftp, nsPluginSource, nsPluginTarget)
|
self.ftpUpload(ftp, nsPluginSource, nsPluginTarget)
|
||||||
|
|
||||||
# os_bits should be loaded with '32bit' or '64bit'
|
def getLibraryDistFilename(self, type, dir, name):
|
||||||
import platform
|
(platform, packageExt, libraryExt) = self.getDistributePlatformInfo(type)
|
||||||
(os_bits, other) = platform.architecture()
|
branch = self.getGitBranchName()
|
||||||
|
revision = self.getGitRevision()
|
||||||
|
firstPart = '%s-%s-%s-%s' % (name, branch, revision, platform)
|
||||||
|
|
||||||
|
filename = '%s.%s' % (firstPart, libraryExt)
|
||||||
|
if type == 'rpm' or type == 'deb':
|
||||||
|
# linux is a bit special, include dist type (deb/rpm in filename)
|
||||||
|
filename = '%s-%s.%s' % (firstPart, packageExt, libraryExt)
|
||||||
|
|
||||||
|
return filename
|
||||||
|
|
||||||
def findLibraryFile(self, type, dir, name):
|
def findLibraryFile(self, type, dir, name):
|
||||||
(platform, packageExt, libraryExt) = self.getDistributePlatformInfo(type)
|
(platform, packageExt, libraryExt) = self.getDistributePlatformInfo(type)
|
||||||
ext = libraryExt
|
ext = libraryExt
|
||||||
|
@ -1439,37 +1448,37 @@ class InternalCommands:
|
||||||
self.getGitBranchName(), self.getGitRevision())
|
self.getGitBranchName(), self.getGitRevision())
|
||||||
return re.sub(pattern, replace, self.dist_name(type))
|
return re.sub(pattern, replace, self.dist_name(type))
|
||||||
|
|
||||||
def getDebianArch(self):
|
def getDebianArch(self):
|
||||||
if os.uname()[4][:3] == 'arm':
|
if os.uname()[4][:3] == 'arm':
|
||||||
return 'armhf'
|
return 'armhf'
|
||||||
|
|
||||||
# os_bits should be loaded with '32bit' or '64bit'
|
# os_bits should be loaded with '32bit' or '64bit'
|
||||||
import platform
|
import platform
|
||||||
(os_bits, other) = platform.architecture()
|
(os_bits, other) = platform.architecture()
|
||||||
|
|
||||||
# get platform based on current platform
|
|
||||||
if os_bits == '32bit':
|
|
||||||
return 'i386'
|
|
||||||
elif os_bits == '64bit':
|
|
||||||
return 'amd64'
|
|
||||||
else:
|
|
||||||
raise Exception("unknown os bits: " + os_bits)
|
|
||||||
|
|
||||||
def getLinuxPlatform(self):
|
# get platform based on current platform
|
||||||
if os.uname()[4][:3] == 'arm':
|
if os_bits == '32bit':
|
||||||
return 'Linux-armv6l'
|
return 'i386'
|
||||||
|
elif os_bits == '64bit':
|
||||||
|
return 'amd64'
|
||||||
|
else:
|
||||||
|
raise Exception("unknown os bits: " + os_bits)
|
||||||
|
|
||||||
# os_bits should be loaded with '32bit' or '64bit'
|
def getLinuxPlatform(self):
|
||||||
import platform
|
if os.uname()[4][:3] == 'arm':
|
||||||
(os_bits, other) = platform.architecture()
|
return 'Linux-armv6l'
|
||||||
|
|
||||||
# get platform based on current platform
|
# os_bits should be loaded with '32bit' or '64bit'
|
||||||
if os_bits == '32bit':
|
import platform
|
||||||
return 'Linux-i686'
|
(os_bits, other) = platform.architecture()
|
||||||
elif os_bits == '64bit':
|
|
||||||
return 'Linux-x86_64'
|
# get platform based on current platform
|
||||||
else:
|
if os_bits == '32bit':
|
||||||
raise Exception("unknown os bits: " + os_bits)
|
return 'Linux-i686'
|
||||||
|
elif os_bits == '64bit':
|
||||||
|
return 'Linux-x86_64'
|
||||||
|
else:
|
||||||
|
raise Exception("unknown os bits: " + os_bits)
|
||||||
|
|
||||||
def dist_usage(self):
|
def dist_usage(self):
|
||||||
print ('Usage: %s package [package-type]\n'
|
print ('Usage: %s package [package-type]\n'
|
||||||
|
@ -1533,7 +1542,7 @@ class InternalCommands:
|
||||||
|
|
||||||
oldGenerator = self.findGeneratorFromConfig()
|
oldGenerator = self.findGeneratorFromConfig()
|
||||||
if not oldGenerator == None:
|
if not oldGenerator == None:
|
||||||
for target in ['debug', 'release']:
|
for target in ['debug', 'release']:
|
||||||
buildDir = oldGenerator.getBuildDir(target)
|
buildDir = oldGenerator.getBuildDir(target)
|
||||||
|
|
||||||
cmakeCacheFilename = 'CMakeCache.txt'
|
cmakeCacheFilename = 'CMakeCache.txt'
|
||||||
|
@ -1689,7 +1698,7 @@ class InternalCommands:
|
||||||
|
|
||||||
return generators[generator_id]
|
return generators[generator_id]
|
||||||
|
|
||||||
def get_vcvarsall(self, generator):
|
def get_vcvarsall(self, generator):
|
||||||
import platform, _winreg
|
import platform, _winreg
|
||||||
|
|
||||||
# os_bits should be loaded with '32bit' or '64bit'
|
# os_bits should be loaded with '32bit' or '64bit'
|
||||||
|
@ -1719,7 +1728,7 @@ class InternalCommands:
|
||||||
if os_bits == '64bit':
|
if os_bits == '64bit':
|
||||||
path = value + r'vc\vcvarsall.bat'
|
path = value + r'vc\vcvarsall.bat'
|
||||||
else:
|
else:
|
||||||
path = value + r'vcvarsall.bat'
|
path = value + r'vcvarsall.bat'
|
||||||
|
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
raise Exception("'%s' not found." % path)
|
raise Exception("'%s' not found." % path)
|
||||||
|
@ -1849,7 +1858,7 @@ class InternalCommands:
|
||||||
|
|
||||||
# qt 4.3 generates ui_ files.
|
# qt 4.3 generates ui_ files.
|
||||||
for filename in glob.glob("src/gui/ui_*"):
|
for filename in glob.glob("src/gui/ui_*"):
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
|
|
||||||
# the command handler should be called only from hm.py (i.e. directly
|
# the command handler should be called only from hm.py (i.e. directly
|
||||||
# from the command prompt). the purpose of this class is so that we
|
# from the command prompt). the purpose of this class is so that we
|
||||||
|
@ -1918,7 +1927,7 @@ class CommandHandler:
|
||||||
|
|
||||||
type = None
|
type = None
|
||||||
if len(self.args) > 0:
|
if len(self.args) > 0:
|
||||||
type = self.args[0]
|
type = self.args[0]
|
||||||
|
|
||||||
self.ic.dist(type, self.vcRedistDir, self.qtDir)
|
self.ic.dist(type, self.vcRedistDir, self.qtDir)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue