Packaging bugs. I'm drowning in them. (use subprocess.Popen instead of os.popen)

This commit is contained in:
Shyotl
2014-08-31 04:56:55 -05:00
parent c7e9430f99
commit 8e45003c27
3 changed files with 13 additions and 13 deletions

View File

@@ -628,7 +628,7 @@ class WindowsSetup(PlatformSetup):
def run(self, command, name=None):
'''Run a program. If the program fails, raise an exception.'''
ret = os.system(command)
ret = os.system(command.encode('utf-8'))
if ret:
if name is None:
name = command.split(None, 1)[0]
@@ -662,7 +662,7 @@ class WindowsSetup(PlatformSetup):
os.path.join(build_dir,'Singularity.sln') +
' --config ' + self.build_type +
' --startup secondlife-bin')
print 'Running %r in %r' % (vstool_cmd, getcwd())
print 'Running vstool %r in %r' % (vstool_cmd, getcwd())
self.run(vstool_cmd)
print >> open(stamp, 'w'), self.build_type
@@ -676,11 +676,11 @@ class WindowsSetup(PlatformSetup):
if targets:
for t in targets:
cmd = '%s /project %s %s' % (build_cmd, t, ' '.join(opts))
print 'Running %r in %r' % (cmd, d)
print 'Running build(targets) %r in %r' % (cmd, d)
self.run(cmd)
else:
cmd = '%s %s' % (build_cmd, ' '.join(opts))
print 'Running %r in %r' % (cmd, d)
print 'Running build %r in %r' % (cmd, d)
self.run(cmd)
finally:
os.chdir(cwd)

View File

@@ -39,6 +39,7 @@ import shutil
import sys
import tarfile
import errno
import subprocess
def path_ancestors(path):
drive, path = os.path.splitdrive(os.path.normpath(path))
@@ -393,20 +394,19 @@ class LLManifest(object):
debugging/informational purpoases, prints out the command's
output as it is received."""
print "Running command:", command
fd = os.popen(command, 'r')
fd = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
lines = []
while True:
lines.append(fd.readline())
lines.append(fd.stdout.readline().rstrip('\n'))
if lines[-1] == '':
break
else:
print lines[-1],
output = ''.join(lines)
status = fd.close()
if status:
if fd.returncode:
raise RuntimeError(
"Command %s returned non-zero status (%s) \noutput:\n%s"
% (command, status, output) )
% (command, fd.returncode, output) )
return output
def created_path(self, path):

View File

@@ -360,7 +360,7 @@ class WindowsManifest(ViewerManifest):
out_path = installed_dir
result += 'SetOutPath ' + out_path + '\n'
if install:
result += 'File ' + pkg_file + '\n'
result += 'File "' + pkg_file + '"\n'
else:
result += 'Delete ' + wpath(os.path.join('$INSTDIR', rel_file)) + '\n'
@@ -453,14 +453,14 @@ class WindowsManifest(ViewerManifest):
try:
import _winreg as reg
NSIS_path = reg.QueryValue(reg.HKEY_LOCAL_MACHINE, r"SOFTWARE\NSIS\Unicode") + '\\makensis.exe'
self.run_command('"' + proper_windows_path(NSIS_path) + '" "' + self.dst_path_of(tempfile) + '"')
self.run_command([proper_windows_path(NSIS_path), self.dst_path_of(tempfile)])
except:
try:
NSIS_path = os.environ['ProgramFiles'] + '\\NSIS\\Unicode\\makensis.exe'
self.run_command('"' + proper_windows_path(NSIS_path) + '" "' + self.dst_path_of(tempfile) + '"')
self.run_command([proper_windows_path(NSIS_path), self.dst_path_of(tempfile)])
except:
NSIS_path = os.environ['ProgramFiles(X86)'] + '\\NSIS\\Unicode\\makensis.exe'
self.run_command('"' + proper_windows_path(NSIS_path) + '" "' + self.dst_path_of(tempfile) + '"')
self.run_command([proper_windows_path(NSIS_path),self.dst_path_of(tempfile)])
# self.remove(self.dst_path_of(tempfile))
# If we're on a build machine, sign the code using our Authenticode certificate. JC
sign_py = os.path.expandvars("{SIGN_PY}")