build_release: Initial changes for PyInstaller

This commit is contained in:
Florian Bruhin 2017-04-14 20:01:57 +02:00
parent 70e2963432
commit 9816de9e8d

View File

@ -162,49 +162,44 @@ def build_windows():
utils.print_title("Building Windows binaries") utils.print_title("Building Windows binaries")
parts = str(sys.version_info.major), str(sys.version_info.minor) parts = str(sys.version_info.major), str(sys.version_info.minor)
ver = ''.join(parts) ver = ''.join(parts)
dotver = '.'.join(parts)
python_x86 = r'C:\Python{}_x32'.format(ver) python_x86 = r'C:\Python{}_x32'.format(ver)
python_x64 = r'C:\Python{}'.format(ver) python_x64 = r'C:\Python{}'.format(ver)
out_pyinstaller = os.path.join('build', 'qutebrowser')
out_32 = os.path.join('build',
'qutebrowser-{}-x32'.format(qutebrowser.__version__))
out_64 = os.path.join('build',
'qutebrowser-{}-x64'.format(qutebrowser.__version__))
artifacts = [] artifacts = []
utils.print_title("Rebuilding tox environment") utils.print_title("Rebuilding tox environment")
call_tox('cxfreeze-windows', '-r', '--notest') call_tox('pyinstaller', '-r', '--notest')
utils.print_title("Running 32bit freeze.py build_exe") utils.print_title("Running pyinstaller 32bit")
call_tox('cxfreeze-windows', 'build_exe', python=python_x86) call_tox('pyinstaller', python=python_x86)
utils.print_title("Running 32bit freeze.py bdist_msi") shutil.move(out_pyinstaller, out_32)
call_tox('cxfreeze-windows', 'bdist_msi', python=python_x86) utils.print_title("Running pyinstaller 64bit")
utils.print_title("Running 64bit freeze.py build_exe") call_tox('pyinstaller', python=python_x64)
call_tox('cxfreeze-windows', 'build_exe', python=python_x64) shutil.move(out_pyinstaller, out_64)
utils.print_title("Running 64bit freeze.py bdist_msi")
call_tox('cxfreeze-windows', 'bdist_msi', python=python_x64)
name_32 = 'qutebrowser-{}-win32.msi'.format(qutebrowser.__version__) # name_32 = 'qutebrowser-{}-win32.msi'.format(qutebrowser.__version__)
name_64 = 'qutebrowser-{}-amd64.msi'.format(qutebrowser.__version__) # name_64 = 'qutebrowser-{}-amd64.msi'.format(qutebrowser.__version__)
artifacts += [ # artifacts += [
(os.path.join('dist', name_32), 'application/x-msi', # (os.path.join('dist', name_32), 'application/x-msi',
'Windows 32bit installer'), # 'Windows 32bit installer'),
(os.path.join('dist', name_64), 'application/x-msi', # (os.path.join('dist', name_64), 'application/x-msi',
'Windows 64bit installer'), # 'Windows 64bit installer'),
] # ]
utils.print_title("Running 32bit smoke test") utils.print_title("Running 32bit smoke test")
smoke_test('build/exe.win32-{}/qutebrowser.exe'.format(dotver)) smoke_test(os.path.join(out_32, 'qutebrowser.exe'))
utils.print_title("Running 64bit smoke test") utils.print_title("Running 64bit smoke test")
smoke_test('build/exe.win-amd64-{}/qutebrowser.exe'.format(dotver)) smoke_test(os.path.join(out_64, 'qutebrowser.exe'))
basedirname = 'qutebrowser-{}'.format(qutebrowser.__version__)
builddir = os.path.join('build', basedirname)
_maybe_remove(builddir)
utils.print_title("Zipping 32bit standalone...") utils.print_title("Zipping 32bit standalone...")
name = 'qutebrowser-{}-windows-standalone-win32'.format( name = 'qutebrowser-{}-windows-standalone-win32'.format(
qutebrowser.__version__) qutebrowser.__version__)
origin = os.path.join('build', 'exe.win32-{}'.format(dotver)) shutil.make_archive(name, 'zip', 'build', out_32)
os.rename(origin, builddir)
shutil.make_archive(name, 'zip', 'build', basedirname)
shutil.rmtree(builddir)
artifacts.append(('{}.zip'.format(name), artifacts.append(('{}.zip'.format(name),
'application/zip', 'application/zip',
'Windows 32bit standalone')) 'Windows 32bit standalone'))
@ -212,10 +207,7 @@ def build_windows():
utils.print_title("Zipping 64bit standalone...") utils.print_title("Zipping 64bit standalone...")
name = 'qutebrowser-{}-windows-standalone-amd64'.format( name = 'qutebrowser-{}-windows-standalone-amd64'.format(
qutebrowser.__version__) qutebrowser.__version__)
origin = os.path.join('build', 'exe.win-amd64-{}'.format(dotver)) shutil.make_archive(name, 'zip', 'build', out_32)
os.rename(origin, builddir)
shutil.make_archive(name, 'zip', 'build', basedirname)
shutil.rmtree(builddir)
artifacts.append(('{}.zip'.format(name), artifacts.append(('{}.zip'.format(name),
'application/zip', 'application/zip',
'Windows 64bit standalone')) 'Windows 64bit standalone'))