Merge in 1.3.6 r656:660 into 1.4.2 and trunk
This commit is contained in:
parent
df1fbee986
commit
f7b0e24a6e
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
# TODO: split this file up, it's too long!
|
# TODO: split this file up, it's too long!
|
||||||
|
|
||||||
import sys, os, ConfigParser, subprocess, shutil, re
|
import sys, os, ConfigParser, subprocess, shutil, re, ftputil
|
||||||
|
|
||||||
class InternalCommands:
|
class InternalCommands:
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ 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 = ''
|
||||||
|
@ -372,18 +373,28 @@ class InternalCommands:
|
||||||
raise Exception('Could not update from repository with error code code: ' + str(err))
|
raise Exception('Could not update from repository with error code code: ' + str(err))
|
||||||
|
|
||||||
def revision(self):
|
def revision(self):
|
||||||
# While this doesn't print out the revision specifically, it will do.
|
print self.find_revision()
|
||||||
err = os.system('svn info')
|
|
||||||
if err != 0:
|
|
||||||
raise Exception('Could not get revision info with error code code: ' + str(err))
|
|
||||||
|
|
||||||
|
def find_revision(self):
|
||||||
|
p = subprocess.Popen(['svn', 'info'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
|
stdout, stderr = p.communicate()
|
||||||
|
|
||||||
|
if p.returncode != 0:
|
||||||
|
raise Exception('Could not get revision info with error code code: ' + str(p.returncode))
|
||||||
|
|
||||||
|
m = re.search('.*Revision: (\d+).*', stdout)
|
||||||
|
if not m:
|
||||||
|
raise Exception('Could not find revision number in svn info output.')
|
||||||
|
|
||||||
|
return m.group(1)
|
||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
return os.system('taskkill /F /FI "IMAGENAME eq synergy*"')
|
return os.system('taskkill /F /FI "IMAGENAME eq synergy*"')
|
||||||
else:
|
else:
|
||||||
raise Exception('Not implemented for platform: ' + sys.platform)
|
raise Exception('Not implemented for platform: ' + sys.platform)
|
||||||
|
|
||||||
def package(self, type):
|
def package(self, type, ftp=None):
|
||||||
|
|
||||||
# Package is supported by default.
|
# Package is supported by default.
|
||||||
package_unsupported = False
|
package_unsupported = False
|
||||||
|
@ -422,6 +433,23 @@ class InternalCommands:
|
||||||
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:
|
||||||
|
print 'Uploading package to FTP...'
|
||||||
|
ftp.run('bin/' + self.dist_name(), self.dist_name_rev())
|
||||||
|
|
||||||
|
def dist_name(self):
|
||||||
|
for filename in os.listdir(self.bin_dir):
|
||||||
|
if re.search(self.package_filename_re, filename):
|
||||||
|
return filename
|
||||||
|
|
||||||
|
# still here? package probably not created yet.
|
||||||
|
raise Exception('Could not find package name.')
|
||||||
|
|
||||||
|
def dist_name_rev(self):
|
||||||
|
pattern = '(.*\d+\.\d+\.\d+)(.*)'
|
||||||
|
replace = '\g<1>-r' + self.find_revision() + '\g<2>'
|
||||||
|
return re.sub(pattern, replace, self.dist_name())
|
||||||
|
|
||||||
def package_run(self, command):
|
def package_run(self, command):
|
||||||
self.try_chdir(self.bin_dir)
|
self.try_chdir(self.bin_dir)
|
||||||
|
@ -758,16 +786,35 @@ class CommandHandler:
|
||||||
print 'Not yet implemented: install'
|
print 'Not yet implemented: install'
|
||||||
|
|
||||||
def package(self):
|
def package(self):
|
||||||
self.ic.package()
|
|
||||||
|
|
||||||
def destroy(self):
|
|
||||||
self.ic.destroy()
|
|
||||||
|
|
||||||
def package(self):
|
|
||||||
type = None
|
type = None
|
||||||
if len(self.args) > 0:
|
if len(self.args) > 0:
|
||||||
type = self.args[0]
|
type = self.args[0]
|
||||||
self.ic.package(type)
|
|
||||||
|
ftp_host = None
|
||||||
|
ftp_user = None
|
||||||
|
ftp_password = None
|
||||||
|
ftp_dir = None
|
||||||
|
|
||||||
|
for o, a in self.opts:
|
||||||
|
if o == '--ftp-host':
|
||||||
|
ftp_host = a
|
||||||
|
elif o == '--ftp-user':
|
||||||
|
ftp_user = a
|
||||||
|
elif o == '--ftp-pass':
|
||||||
|
ftp_password = a
|
||||||
|
elif o == '--ftp-dir':
|
||||||
|
ftp_dir = a
|
||||||
|
|
||||||
|
ftp = None
|
||||||
|
if ftp_host:
|
||||||
|
ftp = ftputil.FtpUploader(
|
||||||
|
ftp_host, ftp_user, ftp_password, ftp_dir)
|
||||||
|
|
||||||
|
self.ic.package(type, ftp)
|
||||||
|
|
||||||
|
def destroy(self):
|
||||||
|
self.ic.destroy()
|
||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
self.ic.kill()
|
self.ic.kill()
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
# synergy-plus -- mouse and keyboard sharing utility
|
||||||
|
# Copyright (C) 2010 The Synergy+ Project
|
||||||
|
#
|
||||||
|
# This package is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# found in the file COPYING that should have accompanied this file.
|
||||||
|
#
|
||||||
|
# This package is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from ftplib import FTP
|
||||||
|
|
||||||
|
class FtpUploader:
|
||||||
|
def __init__(self, host, user, password, dir):
|
||||||
|
self.host = host
|
||||||
|
self.user = user
|
||||||
|
self.password = password
|
||||||
|
self.dir = dir
|
||||||
|
|
||||||
|
def run(self, src, dest):
|
||||||
|
|
||||||
|
ftp = FTP(self.host, self.user, self.password)
|
||||||
|
ftp.cwd(self.dir)
|
||||||
|
|
||||||
|
f = open(src, 'rb')
|
||||||
|
ftp.storbinary('STOR ' + dest, f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
ftp.close()
|
6
hm.py
6
hm.py
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
import sys, os
|
import sys, os
|
||||||
from build import commands
|
from build import commands
|
||||||
from getopt import getopt
|
from getopt import gnu_getopt
|
||||||
|
|
||||||
# options used by all commands
|
# options used by all commands
|
||||||
global_options = 'g:v'
|
global_options = 'g:v'
|
||||||
|
@ -51,7 +51,7 @@ cmd_opt_dict = {
|
||||||
'clean' : [build_options, build_options_long],
|
'clean' : [build_options, build_options_long],
|
||||||
'update' : ['', []],
|
'update' : ['', []],
|
||||||
'install' : ['', []],
|
'install' : ['', []],
|
||||||
'package' : ['', []],
|
'package' : ['', ['ftp-host=', 'ftp-user=', 'ftp-pass=', 'ftp-dir=']],
|
||||||
'kill' : ['', []],
|
'kill' : ['', []],
|
||||||
'usage' : ['', []],
|
'usage' : ['', []],
|
||||||
'revision' : ['', []],
|
'revision' : ['', []],
|
||||||
|
@ -151,7 +151,7 @@ def run_cmd(cmd, argv = []):
|
||||||
options_long.extend(global_options_long)
|
options_long.extend(global_options_long)
|
||||||
options_long.extend(options_pair[1])
|
options_long.extend(options_pair[1])
|
||||||
|
|
||||||
opts, args = getopt(argv, options, options_long)
|
opts, args = gnu_getopt(argv, options, options_long)
|
||||||
|
|
||||||
for o, a in opts:
|
for o, a in opts:
|
||||||
if o in ('-v', '--verbose'):
|
if o in ('-v', '--verbose'):
|
||||||
|
|
Loading…
Reference in New Issue