Merge 1.3.6 r665:666 into 1.4.2 and trunk
This commit is contained in:
parent
7456d0ba75
commit
dff128d5bf
|
@ -39,7 +39,6 @@ class InternalCommands:
|
||||||
xcodeproj_filename = '%s.xcodeproj' % project
|
xcodeproj_filename = '%s.xcodeproj' % project
|
||||||
config_filename = '%s.cfg' % this_cmd
|
config_filename = '%s.cfg' % this_cmd
|
||||||
qtpro_filename = 'qsynergy.pro'
|
qtpro_filename = 'qsynergy.pro'
|
||||||
package_filename_re = 'synergy-plus-\d\.\d\.\d-.*'
|
|
||||||
|
|
||||||
# try_chdir(...) and restore_chdir() will use this
|
# try_chdir(...) and restore_chdir() will use this
|
||||||
prevdir = ''
|
prevdir = ''
|
||||||
|
@ -394,71 +393,119 @@ class InternalCommands:
|
||||||
else:
|
else:
|
||||||
raise Exception('Not implemented for platform: ' + sys.platform)
|
raise Exception('Not implemented for platform: ' + sys.platform)
|
||||||
|
|
||||||
def package(self, type, ftp=None):
|
def dist(self, type, ftp=None):
|
||||||
|
|
||||||
# Package is supported by default.
|
# Package is supported by default.
|
||||||
package_unsupported = False
|
package_unsupported = False
|
||||||
|
|
||||||
if type == None:
|
if type == None:
|
||||||
self.package_usage()
|
self.dist_usage()
|
||||||
|
return
|
||||||
|
|
||||||
elif type == 'src':
|
elif type == 'src':
|
||||||
if sys.platform in ['linux2', 'darwin']:
|
if sys.platform in ['linux2', 'darwin']:
|
||||||
self.package_run('make package_source')
|
self.dist_run('make package_source')
|
||||||
else:
|
else:
|
||||||
package_unsupported = True
|
package_unsupported = True
|
||||||
|
|
||||||
elif type == 'rpm':
|
elif type == 'rpm':
|
||||||
if sys.platform == 'linux2':
|
if sys.platform == 'linux2':
|
||||||
self.package_run('cpack -G RPM')
|
self.dist_run('cpack -G RPM')
|
||||||
else:
|
else:
|
||||||
package_unsupported = True
|
package_unsupported = True
|
||||||
|
|
||||||
elif type == 'deb':
|
elif type == 'deb':
|
||||||
if sys.platform == 'linux2':
|
if sys.platform == 'linux2':
|
||||||
self.package_run('cpack -G DEB')
|
self.dist_run('cpack -G DEB')
|
||||||
else:
|
else:
|
||||||
package_unsupported = True
|
package_unsupported = True
|
||||||
|
|
||||||
elif type == 'win':
|
elif type == 'win':
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
self.package_run('cpack -G NSIS')
|
self.dist_run('cpack -G NSIS')
|
||||||
else:
|
else:
|
||||||
package_unsupported = True
|
package_unsupported = True
|
||||||
|
|
||||||
elif type == 'mac':
|
elif type == 'mac':
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
self.package_run('cpack -G PackageMaker')
|
self.dist_run('cpack -G PackageMaker')
|
||||||
else:
|
else:
|
||||||
package_unsupported = True
|
package_unsupported = True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print 'Not yet implemented: package %s' % type
|
raise Exception('Package type not supported: ' + type)
|
||||||
|
|
||||||
if package_unsupported:
|
if package_unsupported:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
("Package type, '%s' is not supported for platform, '%s'")
|
("Package type, '%s' is not supported for platform, '%s'")
|
||||||
% (type, sys.platform))
|
% (type, sys.platform))
|
||||||
|
|
||||||
if ftp:
|
if type and ftp:
|
||||||
print 'Uploading package to FTP...'
|
name = self.dist_name(type)
|
||||||
ftp.run('bin/' + self.dist_name(), self.dist_name_rev())
|
print 'Uploading %s to FTP server %s...' % (name, ftp.host)
|
||||||
|
ftp.run('bin/' + name, self.dist_name_rev(type))
|
||||||
|
print 'Done'
|
||||||
|
|
||||||
|
def dist_name(self, type):
|
||||||
|
ext = None
|
||||||
|
platform = None
|
||||||
|
|
||||||
|
if type == 'src':
|
||||||
|
ext = 'tar.gz'
|
||||||
|
platform = 'Source'
|
||||||
|
|
||||||
|
elif type == 'rpm' or type == 'deb':
|
||||||
|
|
||||||
|
# os_bits should be loaded with '32bit' or '64bit'
|
||||||
|
import platform
|
||||||
|
(os_bits, other) = platform.architecture()
|
||||||
|
|
||||||
|
# get platform based on current platform
|
||||||
|
ext = type
|
||||||
|
if os_bits == '32bit':
|
||||||
|
platform = 'Linux-i686'
|
||||||
|
elif os_bits == '64bit':
|
||||||
|
platform = 'Linux-x86_64'
|
||||||
|
|
||||||
|
elif type == 'win':
|
||||||
|
|
||||||
|
# get platform based on last generator used
|
||||||
|
ext = 'exe'
|
||||||
|
generator = self.get_generator_from_config()
|
||||||
|
if generator.find('Win64') != -1:
|
||||||
|
platform = 'Windows-x64'
|
||||||
|
else:
|
||||||
|
platform = 'Windows-x86'
|
||||||
|
|
||||||
|
elif type == 'mac':
|
||||||
|
platform = 'MacOSX-Universal'
|
||||||
|
|
||||||
|
if not platform:
|
||||||
|
raise Exception('Unable to detect package platform.')
|
||||||
|
|
||||||
|
pattern = re.escape('synergy-plus-') + '\d\.\d\.\d' + re.escape('-' + platform + '.' + ext)
|
||||||
|
|
||||||
def dist_name(self):
|
|
||||||
for filename in os.listdir(self.bin_dir):
|
for filename in os.listdir(self.bin_dir):
|
||||||
if re.search(self.package_filename_re, filename):
|
if re.search(pattern, filename):
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
# still here? package probably not created yet.
|
# still here? package probably not created yet.
|
||||||
raise Exception('Could not find package name.')
|
raise Exception('Could not find package name with pattern: ' + pattern)
|
||||||
|
|
||||||
def dist_name_rev(self):
|
def dist_name_rev(self, type):
|
||||||
|
# find the version number (we're puting the rev in after this)
|
||||||
pattern = '(.*\d+\.\d+\.\d+)(.*)'
|
pattern = '(.*\d+\.\d+\.\d+)(.*)'
|
||||||
replace = '\g<1>-r' + self.find_revision() + '\g<2>'
|
replace = '\g<1>-r' + self.find_revision() + '\g<2>'
|
||||||
return re.sub(pattern, replace, self.dist_name())
|
return re.sub(pattern, replace, self.dist_name(type))
|
||||||
|
|
||||||
def package_run(self, command):
|
def dist_run(self, command):
|
||||||
self.try_chdir(self.bin_dir)
|
self.try_chdir(self.bin_dir)
|
||||||
err = os.system(command)
|
err = os.system(command)
|
||||||
self.restore_chdir()
|
self.restore_chdir()
|
||||||
if err != 0:
|
if err != 0:
|
||||||
raise Exception('Package failed: ' + str(err))
|
raise Exception('Package failed: ' + str(err))
|
||||||
|
|
||||||
def package_usage(self):
|
def dist_usage(self):
|
||||||
print ('Usage: %s package [package-type]\n'
|
print ('Usage: %s package [package-type]\n'
|
||||||
'\n'
|
'\n'
|
||||||
'Replace [package-type] with one of:\n'
|
'Replace [package-type] with one of:\n'
|
||||||
|
@ -747,7 +794,9 @@ class CommandHandler:
|
||||||
ic = InternalCommands()
|
ic = InternalCommands()
|
||||||
build_targets = []
|
build_targets = []
|
||||||
|
|
||||||
def __init__(self, argv, opts, args):
|
def __init__(self, argv, opts, args, verbose):
|
||||||
|
|
||||||
|
self.ic.verbose = verbose
|
||||||
|
|
||||||
self.opts = opts
|
self.opts = opts
|
||||||
self.args = args
|
self.args = args
|
||||||
|
@ -785,7 +834,7 @@ class CommandHandler:
|
||||||
def install(self):
|
def install(self):
|
||||||
print 'Not yet implemented: install'
|
print 'Not yet implemented: install'
|
||||||
|
|
||||||
def package(self):
|
def dist(self):
|
||||||
|
|
||||||
type = None
|
type = None
|
||||||
if len(self.args) > 0:
|
if len(self.args) > 0:
|
||||||
|
@ -811,7 +860,7 @@ class CommandHandler:
|
||||||
ftp = ftputil.FtpUploader(
|
ftp = ftputil.FtpUploader(
|
||||||
ftp_host, ftp_user, ftp_password, ftp_dir)
|
ftp_host, ftp_user, ftp_password, ftp_dir)
|
||||||
|
|
||||||
self.ic.package(type, ftp)
|
self.ic.dist(type, ftp)
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
self.ic.destroy()
|
self.ic.destroy()
|
||||||
|
|
7
hm.py
7
hm.py
|
@ -51,7 +51,7 @@ cmd_opt_dict = {
|
||||||
'clean' : [build_options, build_options_long],
|
'clean' : [build_options, build_options_long],
|
||||||
'update' : ['', []],
|
'update' : ['', []],
|
||||||
'install' : ['', []],
|
'install' : ['', []],
|
||||||
'package' : ['', ['ftp-host=', 'ftp-user=', 'ftp-pass=', 'ftp-dir=']],
|
'dist' : ['', ['ftp-host=', 'ftp-user=', 'ftp-pass=', 'ftp-dir=']],
|
||||||
'kill' : ['', []],
|
'kill' : ['', []],
|
||||||
'usage' : ['', []],
|
'usage' : ['', []],
|
||||||
'revision' : ['', []],
|
'revision' : ['', []],
|
||||||
|
@ -63,7 +63,7 @@ cmd_opt_dict = {
|
||||||
cmd_alias_dict = {
|
cmd_alias_dict = {
|
||||||
'info' : 'about',
|
'info' : 'about',
|
||||||
'help' : 'usage',
|
'help' : 'usage',
|
||||||
'dist' : 'package',
|
'package' : 'dist',
|
||||||
'make' : 'build',
|
'make' : 'build',
|
||||||
'cmake' : 'configure',
|
'cmake' : 'configure',
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,7 @@ def run_cmd(cmd, argv = []):
|
||||||
|
|
||||||
# pass args and optarg data to command handler, which figures out
|
# pass args and optarg data to command handler, which figures out
|
||||||
# how to handle the arguments
|
# how to handle the arguments
|
||||||
handler = commands.CommandHandler(argv, opts, args)
|
handler = commands.CommandHandler(argv, opts, args, verbose)
|
||||||
handler.verbose = verbose
|
|
||||||
|
|
||||||
# use reflection to get the function pointer
|
# use reflection to get the function pointer
|
||||||
cmd_func = getattr(handler, cmd)
|
cmd_func = getattr(handler, cmd)
|
||||||
|
|
Loading…
Reference in New Issue