backing out r1057
This commit is contained in:
parent
ec34e4a4d1
commit
54588b3d6f
|
@ -1,5 +1,3 @@
|
|||
import os
|
||||
|
||||
class Generator(object):
|
||||
def __init__(self, cmakeName, buildDir='build', sourceDir='..', binDir='bin'):
|
||||
self.cmakeName = cmakeName
|
||||
|
@ -11,7 +9,7 @@ class Generator(object):
|
|||
return self.buildDir
|
||||
|
||||
def getBinDir(self, target=''):
|
||||
return os.path.abspath(os.path.join(self.binDir,target))
|
||||
return self.binDir
|
||||
|
||||
def getSourceDir(self):
|
||||
return self.sourceDir
|
||||
|
|
|
@ -47,13 +47,12 @@ class InternalCommands:
|
|||
qtpro_filename = 'qsynergy.pro'
|
||||
doxygen_filename = 'doxygen.cfg'
|
||||
|
||||
# this is supposed to be relative to the project directory
|
||||
macZipFiles = [
|
||||
'bin/{target}/synergyc',
|
||||
'bin/{target}/synergys',
|
||||
'bin/{target}/QSynergy.app',
|
||||
'doc/synergy.conf.example',
|
||||
'doc/MacReadme.txt']
|
||||
'../../bin/synergyc',
|
||||
'../../bin/synergys',
|
||||
'../../bin/QSynergy.app',
|
||||
'../../doc/synergy.conf.example',
|
||||
'../../doc/MacReadme.txt']
|
||||
|
||||
cmake_url = 'http://www.cmake.org/cmake/resources/software.html'
|
||||
|
||||
|
@ -127,7 +126,7 @@ class InternalCommands:
|
|||
def configureAll(self, targets):
|
||||
|
||||
# if no mode specified, use default
|
||||
if not targets:
|
||||
if len(targets) == 0:
|
||||
targets += [self.defaultTarget,]
|
||||
|
||||
for target in targets:
|
||||
|
@ -150,7 +149,7 @@ class InternalCommands:
|
|||
generator = self.getGenerator()
|
||||
|
||||
if generator != self.findGeneratorFromConfig():
|
||||
print('Generator changed, running setup.')
|
||||
print('Generator changed, running setup.')
|
||||
self.setup(target)
|
||||
|
||||
if generator.cmakeName != '':
|
||||
|
@ -181,7 +180,7 @@ class InternalCommands:
|
|||
|
||||
self.restore_chdir()
|
||||
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('CMake encountered error: ' + str(err))
|
||||
|
||||
# allow user to skip qui compile
|
||||
|
@ -198,7 +197,7 @@ class InternalCommands:
|
|||
err = os.system(qmake_cmd_string)
|
||||
self.restore_chdir()
|
||||
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('QMake encountered error: ' + str(err))
|
||||
|
||||
self.setConfRun(target)
|
||||
|
@ -208,7 +207,7 @@ class InternalCommands:
|
|||
# code; we don't care about the version, since CMakeLists worrys about this for us.
|
||||
err = os.system('%s --version' % self.cmake_cmd)
|
||||
|
||||
if err:
|
||||
if err != 0:
|
||||
# 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'
|
||||
|
@ -242,7 +241,7 @@ class InternalCommands:
|
|||
raise Exception('Cannot continue without qmake.')
|
||||
|
||||
stdout, stderr = p.communicate()
|
||||
if p.returncode:
|
||||
if p.returncode != 0:
|
||||
raise Exception('Could not test for cmake: %s' % stderr)
|
||||
else:
|
||||
m = re.search('.*Using Qt version (\d+\.\d+\.\d+).*', stdout)
|
||||
|
@ -270,7 +269,7 @@ class InternalCommands:
|
|||
def build(self, targets=[], skipConfig=False):
|
||||
|
||||
# if no mode specified, use default
|
||||
if not targets:
|
||||
if len(targets) == 0:
|
||||
targets += [self.defaultTarget,]
|
||||
|
||||
self.ensure_setup_latest()
|
||||
|
@ -302,13 +301,13 @@ class InternalCommands:
|
|||
err = os.system(cmd)
|
||||
self.restore_chdir()
|
||||
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception(cmd + ' failed: ' + str(err))
|
||||
|
||||
def clean(self, targets=[]):
|
||||
|
||||
# if no mode specified, use default
|
||||
if not targets:
|
||||
if len(targets) == 0:
|
||||
targets += [self.defaultTarget,]
|
||||
|
||||
generator = self.getGeneratorFromConfig().cmakeName
|
||||
|
@ -325,6 +324,7 @@ class InternalCommands:
|
|||
self.run_vcbuild(generator, target, '/clean')
|
||||
|
||||
else:
|
||||
cmd = ''
|
||||
if generator == "Unix Makefiles":
|
||||
print 'Cleaning with GNU Make...'
|
||||
cmd = self.make_cmd
|
||||
|
@ -339,7 +339,7 @@ class InternalCommands:
|
|||
err = os.system(cmd + ' clean')
|
||||
self.restore_chdir()
|
||||
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Clean failed: ' + str(err))
|
||||
|
||||
# allow user to skip qui compile
|
||||
|
@ -370,7 +370,7 @@ class InternalCommands:
|
|||
err = os.system(gui_make_cmd + ' ' + target)
|
||||
self.restore_chdir()
|
||||
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception(gui_make_cmd + ' failed with error: ' + str(err))
|
||||
else:
|
||||
if sys.platform == 'darwin':
|
||||
|
@ -398,7 +398,7 @@ class InternalCommands:
|
|||
def update(self):
|
||||
print "Running Subversion update..."
|
||||
err = os.system('svn update')
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Could not update from repository with error code code: ' + str(err))
|
||||
|
||||
def revision(self):
|
||||
|
@ -412,7 +412,7 @@ class InternalCommands:
|
|||
p = subprocess.Popen(['svn', 'info'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
|
||||
if p.returncode:
|
||||
if p.returncode != 0:
|
||||
raise Exception('Could not get revision - svn info failed with code: ' + str(p.returncode))
|
||||
|
||||
m = re.search('.*Revision: (\d+).*', stdout)
|
||||
|
@ -434,7 +434,7 @@ class InternalCommands:
|
|||
|
||||
err = os.system('doxygen %s/%s' % (self.doc_dir, self.doxygen_filename))
|
||||
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('doxygen failed with error code: ' + str(err))
|
||||
|
||||
def dist(self, type, vcRedistDir, qtDir):
|
||||
|
@ -443,11 +443,8 @@ class InternalCommands:
|
|||
package_unsupported = False
|
||||
unixTarget = self.defaultTarget
|
||||
|
||||
if type == '' or type is None:
|
||||
if sys.platform == 'darwin':
|
||||
type = 'mac'
|
||||
else:
|
||||
raise Exception('No type specified.')
|
||||
if type == '' or type == None:
|
||||
raise Exception('No type specified.')
|
||||
|
||||
if type != 'win' and type != 'mac':
|
||||
self.configure(unixTarget, '-DCONF_CPACK:BOOL=TRUE')
|
||||
|
@ -457,7 +454,7 @@ class InternalCommands:
|
|||
|
||||
moveExt = ''
|
||||
|
||||
if type is None:
|
||||
if type == None:
|
||||
self.dist_usage()
|
||||
return
|
||||
|
||||
|
@ -518,7 +515,7 @@ class InternalCommands:
|
|||
|
||||
print 'Exporting repository to: ' + exportPath
|
||||
err = os.system('svn export . ' + exportPath)
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Repository export failed: ' + str(err))
|
||||
|
||||
packagePath = '../' + self.getGenerator().binDir + '/' + name + '.tar.gz'
|
||||
|
@ -527,7 +524,7 @@ class InternalCommands:
|
|||
self.try_chdir(self.getGenerator().buildDir)
|
||||
print 'Packaging to: ' + packagePath
|
||||
err = os.system('tar cfvz ' + packagePath + ' ' + name)
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Package failed: ' + str(err))
|
||||
finally:
|
||||
self.restore_chdir()
|
||||
|
@ -535,7 +532,7 @@ class InternalCommands:
|
|||
def unixMove(self, source, dest):
|
||||
print 'Moving ' + source + ' to ' + dest
|
||||
err = os.system('mv ' + source + ' ' + dest)
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Package failed: ' + str(err))
|
||||
|
||||
def distMac(self, unixTarget):
|
||||
|
@ -561,9 +558,6 @@ class InternalCommands:
|
|||
os.makedirs(zipFile)
|
||||
|
||||
for f in self.macZipFiles:
|
||||
f = f.replace('{target}', unixTarget)
|
||||
f = os.path.abspath(os.path.join(os.path.dirname(__file__),"../../..",f))
|
||||
print f
|
||||
if not os.path.exists(f):
|
||||
raise Exception('File does not exist: ' + f)
|
||||
elif os.path.isdir(f):
|
||||
|
@ -573,11 +567,11 @@ class InternalCommands:
|
|||
else:
|
||||
shutil.copy2(f, zipFile + '/')
|
||||
|
||||
zipCmd = ('zip -r ../../' + binDir + '/' + zipFile + '.zip ' + zipFile)
|
||||
zipCmd = ('zip -r ../../' + binDir + '/' + zipFile + '.zip ' + zipFile);
|
||||
|
||||
print 'Creating package: ' + zipCmd
|
||||
err = os.system(zipCmd)
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Zip failed, code: ' + err)
|
||||
|
||||
finally:
|
||||
|
@ -619,7 +613,7 @@ class InternalCommands:
|
|||
command = 'makensis ' + nsiPath
|
||||
print 'NSIS command: ' + command
|
||||
err = os.system(command)
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Package failed: ' + str(err))
|
||||
|
||||
def getVersionFromCmake(self):
|
||||
|
@ -718,7 +712,7 @@ class InternalCommands:
|
|||
print 'CPack command: ' + command
|
||||
err = os.system(command)
|
||||
self.restore_chdir()
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Package failed: ' + str(err))
|
||||
|
||||
def dist_usage(self):
|
||||
|
@ -775,14 +769,14 @@ class InternalCommands:
|
|||
path = application + ' ' + path
|
||||
|
||||
err = os.system(path)
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Could not open project with error code code: ' + str(err))
|
||||
|
||||
def setup(self, target=''):
|
||||
print "Running setup..."
|
||||
|
||||
oldGenerator = self.findGeneratorFromConfig()
|
||||
if not oldGenerator is None:
|
||||
if not oldGenerator == None:
|
||||
for target in ['debug', 'release']:
|
||||
buildDir = oldGenerator.getBuildDir(target)
|
||||
|
||||
|
@ -911,17 +905,7 @@ class InternalCommands:
|
|||
|
||||
conf = self.findGeneratorFromConfig()
|
||||
if conf:
|
||||
return conf
|
||||
|
||||
# generator not configured, will auto-configure it
|
||||
generators = self.get_generators()
|
||||
keys = generators.keys()
|
||||
keys.sort()
|
||||
for k in keys:
|
||||
# print str(k) + ': ' + generators[k].cmakeName
|
||||
if sys.platform == 'darwin' and generators[k].cmakeName == 'Xcode':
|
||||
return generators[int(k)]
|
||||
# TODO add auto-detection for other platforms, eventually by detecting what is available
|
||||
return conf
|
||||
|
||||
raise Exception(
|
||||
'Generator not specified, use -g arg ' +
|
||||
|
@ -956,6 +940,7 @@ class InternalCommands:
|
|||
key_name = r'SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7'
|
||||
else:
|
||||
key_name = r'SOFTWARE\Microsoft\VisualStudio\SxS\VC7'
|
||||
|
||||
try:
|
||||
key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, key_name)
|
||||
except:
|
||||
|
@ -1027,7 +1012,7 @@ class InternalCommands:
|
|||
file.close()
|
||||
|
||||
err = os.system(temp_bat)
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Microsoft compiler failed with error code: ' + str(err))
|
||||
|
||||
def ensure_setup_latest(self):
|
||||
|
@ -1040,7 +1025,7 @@ class InternalCommands:
|
|||
'--quiet --suffix=none --style=java --indent=force-tab=4 --recursive '
|
||||
'lib/*.cpp lib/*.h cmd/*.cpp cmd/*.h')
|
||||
|
||||
if err:
|
||||
if err != 0:
|
||||
raise Exception('Reformat failed with error code: ' + str(err))
|
||||
|
||||
def printGeneratorList(self):
|
||||
|
@ -1062,7 +1047,7 @@ class InternalCommands:
|
|||
|
||||
# version is major and minor with no dots (e.g. 106)
|
||||
return ('MacOSX' + str(result.group(1)) +
|
||||
str(result.group(2)) + '-Universal')
|
||||
str(result.group(2)) + '-Universal');
|
||||
|
||||
# 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
|
||||
|
|
Loading…
Reference in New Issue