Some additional fixes to make UPX paths work correctly.

git-svn-id: http://svn.pyinstaller.org/trunk@666 8dd32b29-ccff-0310-8a9a-9233e24343b1
This commit is contained in:
giovannibajo
2009-05-18 14:01:58 +00:00
parent c1d18dadb5
commit baf462ce17
2 changed files with 13 additions and 5 deletions
+10 -2
View File
@@ -51,6 +51,14 @@ rthooks = {}
iswin = sys.platform[:3] == 'win'
cygwin = sys.platform == 'cygwin'
def system(cmd):
# This workaround is required because NT shell doesn't work with commands
# that start with double quotes (required if there are spaces inside the
# command path)
if iswin:
cmd = 'echo on && ' + cmd
os.system(cmd)
def _save_data(filename, data):
outf = open(filename, 'w')
pprint.pprint(data, outf)
@@ -492,13 +500,13 @@ def checkCache(fnm, strip, upx):
upx_executable = "upx"
if config.get('upx_dir'):
upx_executable = os.path.join(config['upx_dir'], upx_executable)
cmd = upx_executable + " " + bestopt + " -q \"%s\"" % cachedfile
cmd = '"' + upx_executable + '" ' + bestopt + " -q \"%s\"" % cachedfile
else:
if strip:
cmd = "strip \"%s\"" % cachedfile
shutil.copy2(fnm, cachedfile)
os.chmod(cachedfile, 0755)
if cmd: os.system(cmd)
if cmd: system(cmd)
# update cache index
cache_index[basenm] = digest
+3 -3
View File
@@ -234,13 +234,13 @@ def test_unicode(config):
def test_UPX(config):
print 'I: testing for UPX...'
cmd = "upx -V"
cmd = "upx"
if opts.upx_dir:
cmd = os.path.join(opts.upx_dir, cmd)
cmd = '"' + os.path.normpath(os.path.join(opts.upx_dir, cmd)) + '"'
hasUPX = 0
try:
vers = os.popen(cmd).readlines()
vers = os.popen(cmd + ' -V').readlines()
if vers:
v = string.split(vers[0])[1]
hasUPX = tuple(map(int, string.split(v, ".")))