build.sh: Use Python 3.x for Windows

This commit is contained in:
GXTX 2019-01-28 00:28:53 -05:00 committed by mborgerson
parent e7bd7bf228
commit 56faaf1400
2 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@ package_windows() { # Script to prepare the windows exe
mkdir -p dist mkdir -p dist
cp i386-softmmu/qemu-system-i386.exe dist/xqemu.exe cp i386-softmmu/qemu-system-i386.exe dist/xqemu.exe
cp i386-softmmu/qemu-system-i386w.exe dist/xqemuw.exe cp i386-softmmu/qemu-system-i386w.exe dist/xqemuw.exe
python2 ./get_deps.py dist/xqemu.exe dist python3 ./get_deps.py dist/xqemu.exe dist
strip dist/xqemu.exe strip dist/xqemu.exe
strip dist/xqemuw.exe strip dist/xqemuw.exe
} }
@ -52,7 +52,7 @@ case "$(uname -s)" in # adjust compilation option based on platform
CYGWIN*|MINGW*|MSYS*) CYGWIN*|MINGW*|MSYS*)
echo 'Compiling for Windows…' echo 'Compiling for Windows…'
sys_cflags='-Wno-error' sys_cflags='-Wno-error'
sys_opts='--python=python2 --disable-cocoa --disable-opengl' sys_opts='--python=python3 --disable-cocoa --disable-opengl'
postbuild='package_windows' # set the above function to be called after build postbuild='package_windows' # set the above function to be called after build
;; ;;
*) *)

View File

@ -22,7 +22,7 @@ def main():
elif not os.path.isdir(args.dest): elif not os.path.isdir(args.dest):
print('File exists with destination name') print('File exists with destination name')
sys.exit(1) sys.exit(1)
try: try:
subprocess.check_output(['cygpath', '--help']) subprocess.check_output(['cygpath', '--help'])
except OSError as err: except OSError as err:
@ -30,7 +30,7 @@ def main():
print("Make sure you're using a recent version of MSYS2 and that it works correctly.") print("Make sure you're using a recent version of MSYS2 and that it works correctly.")
sys.exit(1) sys.exit(1)
sout = subprocess.check_output(['ldd', args.prog]) sout = subprocess.check_output(['ldd', args.prog]).decode('utf-8')
for line in sout.splitlines(): for line in sout.splitlines():
line = line.strip().split() line = line.strip().split()
dll_name, dll_path, dll_load_addr = line[0], line[2], line[3] dll_name, dll_path, dll_load_addr = line[0], line[2], line[3]
@ -39,7 +39,7 @@ def main():
continue continue
# ldd on msys gives Unix-style paths, but mingw Python wants them Windows-style # ldd on msys gives Unix-style paths, but mingw Python wants them Windows-style
# Use cygpath to convert the paths, because both mingw and msys Python can handle them # Use cygpath to convert the paths, because both mingw and msys Python can handle them
dll_path = subprocess.check_output(['cygpath', '-w', dll_path]).strip() dll_path = subprocess.check_output(['cygpath', '-w', dll_path]).decode('utf-8').strip()
if dll_path.lower().startswith('c:\\windows'): if dll_path.lower().startswith('c:\\windows'):
print('Skipping system DLL %s' % dll_path) print('Skipping system DLL %s' % dll_path)
continue continue