Fixed messed up indentation in commands1.py #4695

This commit is contained in:
Nick Bolton 2015-05-25 15:19:54 +01:00
parent 74dda188dc
commit 16d9bd8f0d
1 changed files with 94 additions and 85 deletions

View File

@ -55,14 +55,14 @@ class Toolchain:
'reformat' : ['', []],
'open' : ['', []],
'genlist' : ['', []],
'reset' : ['', []],
'signwin' : ['', ['pfx=', 'pwd=', 'dist']],
'signmac' : ['', []]
'reset' : ['', []],
'signwin' : ['', ['pfx=', 'pwd=', 'dist']],
'signmac' : ['', []]
}
# aliases to valid commands
cmd_alias_dict = {
'info' : 'about',
'info' : 'about',
'help' : 'usage',
'package' : 'dist',
'docs' : 'doxygen',
@ -319,7 +319,6 @@ class InternalCommands:
self.configure(target)
def checkGTest(self):
dir = self.extDir + '/' + self.gtestDir
if (os.path.isdir(dir)):
return
@ -335,7 +334,6 @@ class InternalCommands:
self.zipExtractAll(zip, dir)
def checkGMock(self):
dir = self.extDir + '/' + self.gmockDir
if (os.path.isdir(dir)):
return
@ -524,14 +522,14 @@ class InternalCommands:
version = commands.getoutput("qmake --version")
result = re.search('(\d+)\.(\d+)\.(\d)', version)
if not result:
if not result:
raise Exception("Could not get qmake version.")
major = int(result.group(1))
minor = int(result.group(2))
rev = int(result.group(3))
major = int(result.group(1))
minor = int(result.group(2))
rev = int(result.group(3))
return (major, minor, rev)
return (major, minor, rev)
def getMacSdkDir(self):
sdkName = "macosx" + self.macSdk
@ -575,7 +573,7 @@ class InternalCommands:
# if return code from cmake is not 0, then either something has
# gone terribly wrong with --version, or it genuinely doesn't exist.
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)
raise Exception('Cannot continue without CMake.')
else:
@ -786,15 +784,15 @@ class InternalCommands:
# reorganize Qt frameworks layout on Mac 10.9.5 or later
# http://goo.gl/BFnQ8l
# QtCore example:
# QtCore.framework/
# QtCore -> Versions/Current/QtCore
# Resources -> Versions/Current/Resources
# Versions/
# Current -> 5
# 5/
# QtCore
# Resources/
# Info.plist
# QtCore.framework/
# QtCore -> Versions/Current/QtCore
# Resources -> Versions/Current/Resources
# Versions/
# Current -> 5
# 5/
# QtCore
# Resources/
# Info.plist
targetDir = self.getGenerator().getBinDir(target)
target = targetDir + "/Synergy.app/Contents/Frameworks"
@ -1026,7 +1024,7 @@ class InternalCommands:
elif type == 'rpm':
if sys.platform == 'linux2':
self.distRpm()
self.distRpm()
else:
package_unsupported = True
@ -1062,9 +1060,9 @@ class InternalCommands:
("Package type, '%s' is not supported for platform, '%s'")
% (type, sys.platform))
def distRpm(self):
rpmDir = self.getGenerator().buildDir + '/rpm'
if os.path.exists(rpmDir):
def distRpm(self):
rpmDir = self.getGenerator().buildDir + '/rpm'
if os.path.exists(rpmDir):
shutil.rmtree(rpmDir)
os.makedirs(rpmDir)
@ -1080,40 +1078,41 @@ class InternalCommands:
specFile.write(template)
specFile.close()
version = self.getVersionFromCmake()
target = '../../bin/synergy-%s-%s.rpm' % (
version, self.getLinuxPlatform())
version = self.getVersionFromCmake()
target = '../../bin/synergy-%s-%s.rpm' % (
version, self.getLinuxPlatform())
try:
self.try_chdir(rpmDir)
cmd = 'rpmbuild -bb --define "_topdir `pwd`" synergy.spec'
print "Command: " + cmd
cmd = 'rpmbuild -bb --define "_topdir `pwd`" synergy.spec'
print "Command: " + cmd
err = os.system(cmd)
if err != 0:
raise Exception('rpmbuild failed: ' + str(err))
self.unixMove('RPMS/*/*.rpm', target)
cmd = 'rpmlint ' + target
print "Command: " + cmd
cmd = 'rpmlint ' + target
print "Command: " + cmd
err = os.system(cmd)
if err != 0:
raise Exception('rpmlint failed: ' + str(err))
finally:
self.restore_chdir()
def distDeb(self):
def distDeb(self):
buildDir = self.getGenerator().buildDir
binDir = self.getGenerator().binDir
resDir = self.cmake_dir
version = self.getVersionFromCmake()
package = '%s-%s-%s' % (
self.project, version, self.getLinuxPlatform())
version = self.getVersionFromCmake()
package = '%s-%s-%s' % (
self.project, version, self.getLinuxPlatform())
debDir = '%s/deb' % buildDir
if os.path.exists(debDir):
debDir = '%s/deb' % buildDir
if os.path.exists(debDir):
shutil.rmtree(debDir)
metaDir = '%s/%s/DEBIAN' % (debDir, package)
@ -1181,14 +1180,14 @@ class InternalCommands:
self.try_chdir(debDir)
# TODO: consider dpkg-buildpackage (higher level tool)
cmd = 'fakeroot dpkg-deb --build %s' % package
print "Command: " + cmd
cmd = 'fakeroot dpkg-deb --build %s' % package
print "Command: " + cmd
err = os.system(cmd)
if err != 0:
raise Exception('dpkg-deb failed: ' + str(err))
cmd = 'lintian %s.deb' % package
print "Command: " + cmd
cmd = 'lintian %s.deb' % package
print "Command: " + cmd
err = os.system(cmd)
if err != 0:
raise Exception('lintian failed: ' + str(err))
@ -1368,9 +1367,19 @@ class InternalCommands:
nsPluginTarget = self.getLibraryDistFilename(type, pluginsDir, 'ns')
self.ftpUpload(ftp, nsPluginSource, nsPluginTarget)
# os_bits should be loaded with '32bit' or '64bit'
import platform
(os_bits, other) = platform.architecture()
def getLibraryDistFilename(self, type, dir, name):
(platform, packageExt, libraryExt) = self.getDistributePlatformInfo(type)
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):
(platform, packageExt, libraryExt) = self.getDistributePlatformInfo(type)
ext = libraryExt
@ -1439,37 +1448,37 @@ class InternalCommands:
self.getGitBranchName(), self.getGitRevision())
return re.sub(pattern, replace, self.dist_name(type))
def getDebianArch(self):
if os.uname()[4][:3] == 'arm':
return 'armhf'
def getDebianArch(self):
if os.uname()[4][:3] == 'arm':
return 'armhf'
# os_bits should be loaded with '32bit' or '64bit'
import platform
(os_bits, other) = platform.architecture()
# os_bits should be loaded with '32bit' or '64bit'
import platform
(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)
# 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):
if os.uname()[4][:3] == 'arm':
return 'Linux-armv6l'
def getLinuxPlatform(self):
if os.uname()[4][:3] == 'arm':
return 'Linux-armv6l'
# os_bits should be loaded with '32bit' or '64bit'
import platform
(os_bits, other) = platform.architecture()
# os_bits should be loaded with '32bit' or '64bit'
import platform
(os_bits, other) = platform.architecture()
# get platform based on current platform
if os_bits == '32bit':
return 'Linux-i686'
elif os_bits == '64bit':
return 'Linux-x86_64'
else:
raise Exception("unknown os bits: " + os_bits)
# get platform based on current platform
if os_bits == '32bit':
return 'Linux-i686'
elif os_bits == '64bit':
return 'Linux-x86_64'
else:
raise Exception("unknown os bits: " + os_bits)
def dist_usage(self):
print ('Usage: %s package [package-type]\n'
@ -1849,7 +1858,7 @@ class InternalCommands:
# qt 4.3 generates ui_ files.
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
# from the command prompt). the purpose of this class is so that we