Don't use utils.is_* in build_release.py
This partially reverts ef1c83862b
Otherwise, we'd have to have PyQt5 installed in the environment which runs
build_release.py.
This commit is contained in:
parent
e766cf5ed1
commit
5a60630450
@ -36,8 +36,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
|
||||
os.pardir))
|
||||
|
||||
import qutebrowser
|
||||
from qutebrowser.utils import utils
|
||||
from scripts import utils as scriptutils
|
||||
from scripts import utils as utils
|
||||
# from scripts.dev import update_3rdparty
|
||||
|
||||
|
||||
@ -71,7 +70,7 @@ def call_tox(toxenv, *args, python=sys.executable):
|
||||
|
||||
def run_asciidoc2html(args):
|
||||
"""Common buildsteps used for all OS'."""
|
||||
scriptutils.print_title("Running asciidoc2html.py")
|
||||
utils.print_title("Running asciidoc2html.py")
|
||||
if args.asciidoc is not None:
|
||||
a2h_args = ['--asciidoc'] + args.asciidoc
|
||||
else:
|
||||
@ -128,7 +127,7 @@ def patch_mac_app():
|
||||
|
||||
def build_mac():
|
||||
"""Build macOS .dmg/.app."""
|
||||
scriptutils.print_title("Cleaning up...")
|
||||
utils.print_title("Cleaning up...")
|
||||
for f in ['wc.dmg', 'template.dmg']:
|
||||
try:
|
||||
os.remove(f)
|
||||
@ -136,20 +135,20 @@ def build_mac():
|
||||
pass
|
||||
for d in ['dist', 'build']:
|
||||
shutil.rmtree(d, ignore_errors=True)
|
||||
scriptutils.print_title("Updating 3rdparty content")
|
||||
utils.print_title("Updating 3rdparty content")
|
||||
# Currently disabled because QtWebEngine has no pdfjs support
|
||||
# update_3rdparty.run(ace=False, pdfjs=True, fancy_dmg=False)
|
||||
scriptutils.print_title("Building .app via pyinstaller")
|
||||
utils.print_title("Building .app via pyinstaller")
|
||||
call_tox('pyinstaller', '-r')
|
||||
scriptutils.print_title("Patching .app")
|
||||
utils.print_title("Patching .app")
|
||||
patch_mac_app()
|
||||
scriptutils.print_title("Building .dmg")
|
||||
utils.print_title("Building .dmg")
|
||||
subprocess.check_call(['make', '-f', 'scripts/dev/Makefile-dmg'])
|
||||
|
||||
dmg_name = 'qutebrowser-{}.dmg'.format(qutebrowser.__version__)
|
||||
os.rename('qutebrowser.dmg', dmg_name)
|
||||
|
||||
scriptutils.print_title("Running smoke test")
|
||||
utils.print_title("Running smoke test")
|
||||
|
||||
try:
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
@ -178,11 +177,11 @@ def patch_windows(out_dir):
|
||||
|
||||
def build_windows():
|
||||
"""Build windows executables/setups."""
|
||||
scriptutils.print_title("Updating 3rdparty content")
|
||||
utils.print_title("Updating 3rdparty content")
|
||||
# Currently disabled because QtWebEngine has no pdfjs support
|
||||
# update_3rdparty.run(ace=False, pdfjs=True, fancy_dmg=False)
|
||||
|
||||
scriptutils.print_title("Building Windows binaries")
|
||||
utils.print_title("Building Windows binaries")
|
||||
parts = str(sys.version_info.major), str(sys.version_info.minor)
|
||||
ver = ''.join(parts)
|
||||
python_x86 = r'C:\Python{}-32\python.exe'.format(ver)
|
||||
@ -195,19 +194,19 @@ def build_windows():
|
||||
|
||||
artifacts = []
|
||||
|
||||
scriptutils.print_title("Running pyinstaller 32bit")
|
||||
utils.print_title("Running pyinstaller 32bit")
|
||||
_maybe_remove(out_32)
|
||||
call_tox('pyinstaller', '-r', python=python_x86)
|
||||
shutil.move(out_pyinstaller, out_32)
|
||||
patch_windows(out_32)
|
||||
|
||||
scriptutils.print_title("Running pyinstaller 64bit")
|
||||
utils.print_title("Running pyinstaller 64bit")
|
||||
_maybe_remove(out_64)
|
||||
call_tox('pyinstaller', '-r', python=python_x64)
|
||||
shutil.move(out_pyinstaller, out_64)
|
||||
patch_windows(out_64)
|
||||
|
||||
scriptutils.print_title("Building installers")
|
||||
utils.print_title("Building installers")
|
||||
subprocess.check_call(['makensis.exe',
|
||||
'/DVERSION={}'.format(qutebrowser.__version__),
|
||||
'misc/qutebrowser.nsi'])
|
||||
@ -228,12 +227,12 @@ def build_windows():
|
||||
'Windows 64bit installer'),
|
||||
]
|
||||
|
||||
scriptutils.print_title("Running 32bit smoke test")
|
||||
utils.print_title("Running 32bit smoke test")
|
||||
smoke_test(os.path.join(out_32, 'qutebrowser.exe'))
|
||||
scriptutils.print_title("Running 64bit smoke test")
|
||||
utils.print_title("Running 64bit smoke test")
|
||||
smoke_test(os.path.join(out_64, 'qutebrowser.exe'))
|
||||
|
||||
scriptutils.print_title("Zipping 32bit standalone...")
|
||||
utils.print_title("Zipping 32bit standalone...")
|
||||
name = 'qutebrowser-{}-windows-standalone-win32'.format(
|
||||
qutebrowser.__version__)
|
||||
shutil.make_archive(name, 'zip', 'dist', os.path.basename(out_32))
|
||||
@ -241,7 +240,7 @@ def build_windows():
|
||||
'application/zip',
|
||||
'Windows 32bit standalone'))
|
||||
|
||||
scriptutils.print_title("Zipping 64bit standalone...")
|
||||
utils.print_title("Zipping 64bit standalone...")
|
||||
name = 'qutebrowser-{}-windows-standalone-amd64'.format(
|
||||
qutebrowser.__version__)
|
||||
shutil.make_archive(name, 'zip', 'dist', os.path.basename(out_64))
|
||||
@ -254,7 +253,7 @@ def build_windows():
|
||||
|
||||
def build_sdist():
|
||||
"""Build an sdist and list the contents."""
|
||||
scriptutils.print_title("Building sdist")
|
||||
utils.print_title("Building sdist")
|
||||
|
||||
_maybe_remove('dist')
|
||||
|
||||
@ -277,10 +276,10 @@ def build_sdist():
|
||||
|
||||
assert '.pyc' not in by_ext
|
||||
|
||||
scriptutils.print_title("sdist contents")
|
||||
utils.print_title("sdist contents")
|
||||
|
||||
for ext, files in sorted(by_ext.items()):
|
||||
scriptutils.print_subtitle(ext)
|
||||
utils.print_subtitle(ext)
|
||||
print('\n'.join(files))
|
||||
|
||||
filename = 'qutebrowser-{}.tar.gz'.format(qutebrowser.__version__)
|
||||
@ -309,7 +308,7 @@ def github_upload(artifacts, tag):
|
||||
tag: The name of the release tag
|
||||
"""
|
||||
import github3
|
||||
scriptutils.print_title("Uploading to github...")
|
||||
utils.print_title("Uploading to github...")
|
||||
|
||||
token = read_github_token()
|
||||
gh = github3.login(token=token)
|
||||
@ -344,7 +343,7 @@ def main():
|
||||
parser.add_argument('--upload', help="Tag to upload the release for",
|
||||
nargs=1, required=False, metavar='TAG')
|
||||
args = parser.parse_args()
|
||||
scriptutils.change_cwd()
|
||||
utils.change_cwd()
|
||||
|
||||
upload_to_pypi = False
|
||||
|
||||
@ -355,7 +354,7 @@ def main():
|
||||
read_github_token()
|
||||
|
||||
run_asciidoc2html(args)
|
||||
if utils.is_windows:
|
||||
if os.name == 'nt':
|
||||
if sys.maxsize > 2**32:
|
||||
# WORKAROUND
|
||||
print("Due to a python/Windows bug, this script needs to be run ")
|
||||
@ -365,21 +364,21 @@ def main():
|
||||
print("https://github.com/pypa/virtualenv/issues/774")
|
||||
sys.exit(1)
|
||||
artifacts = build_windows()
|
||||
elif utils.is_mac:
|
||||
elif sys.platform == 'darwin':
|
||||
artifacts = build_mac()
|
||||
else:
|
||||
artifacts = build_sdist()
|
||||
upload_to_pypi = True
|
||||
|
||||
if args.upload is not None:
|
||||
scriptutils.print_title("Press enter to release...")
|
||||
utils.print_title("Press enter to release...")
|
||||
input()
|
||||
github_upload(artifacts, args.upload[0])
|
||||
if upload_to_pypi:
|
||||
pypi_upload(artifacts)
|
||||
else:
|
||||
print()
|
||||
scriptutils.print_title("Artifacts")
|
||||
utils.print_title("Artifacts")
|
||||
for artifact in artifacts:
|
||||
print(artifact)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user