mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-16 20:27:05 +03:00
Standalone binary built with PyInstaller
- Call PyInstaller directly from builder script - Drop depenency to gravitybee - Change artifact path `dist/` on ci, test and upload scripts - Move standalone builder python script in `tools` - Also add pseudo launcher script in `tools` for PyInstaller - Actions: Update binary build and release scripts - Binary is built on venv that is removed after built - Support not only Windows but also linux/mac - Built on powershell on Windows, bash on others - Clean up duplicated configurations on setup.cfg - Leaves `entry_points` and `package_data` options Signed-off-by: Hiroshi Miura <miurahr@linux.com>
This commit is contained in:
36
.github/workflows/test-install-qt.yml
vendored
36
.github/workflows/test-install-qt.yml
vendored
@@ -41,15 +41,28 @@ jobs:
|
||||
if: matrix.artifact == 'standard'
|
||||
run: |
|
||||
python -m pip install ./ --user
|
||||
- name: Build Standalone binary
|
||||
if: matrix.artifact == 'binary'
|
||||
- name: Build Standalone binary(linux,mac)
|
||||
if: matrix.artifact == 'binary' && matrix.os != 'windows-latest'
|
||||
run: |
|
||||
python -m venv venv
|
||||
source venv/Scripts/activate
|
||||
python -m pip install -U pip wheel setuptools setuptools_scm gravitybee
|
||||
python -m pip install -e .
|
||||
python ci/build_standalone.py
|
||||
source venv/bin/activate
|
||||
python -m pip install -U pip wheel setuptools setuptools_scm pyinstaller
|
||||
python -m pip install .
|
||||
python tools/build_standalone.py
|
||||
deactivate
|
||||
rm -rf venv
|
||||
shell: bash
|
||||
- name: Build Standalone binary(windows)
|
||||
if: matrix.artifact == 'binary' && matrix.os == 'windows-latest'
|
||||
run: |
|
||||
python -m venv venv
|
||||
venv/Scripts/activate.ps1
|
||||
python -m pip install -U pip wheel setuptools setuptools_scm pyinstaller
|
||||
python -m pip install .
|
||||
python tools/build_standalone.py
|
||||
deactivate
|
||||
Remove-Item venv -Recurse -Force
|
||||
shell: pwsh
|
||||
- name: Run aqt
|
||||
run: |
|
||||
import os
|
||||
@@ -61,11 +74,14 @@ jobs:
|
||||
artifact = "${{ matrix.artifact }}"
|
||||
platform = "${{ matrix.os }}"
|
||||
qtver = "${{ matrix.qtver }}"
|
||||
env = os.environ.copy()
|
||||
github_workspace = pathlib.Path(env["GITHUB_WORKSPACE"])
|
||||
if artifact == "binary":
|
||||
if platform.startswith("windows"):
|
||||
prefix = ["../.gravitybee/dist/latest/aqt.exe", "install"]
|
||||
bin_path = str(github_workspace / "dist" / "aqt.exe")
|
||||
else:
|
||||
prefix = ["../.gravitybee/dist/latest/aqt", "install"]
|
||||
bin_path = (github_workspace / "dist" / "aqt").as_posix()
|
||||
prefix = [bin_path, "install"]
|
||||
else:
|
||||
prefix = ["python", "-m", "aqt", "install"]
|
||||
command_line = []
|
||||
@@ -85,8 +101,6 @@ jobs:
|
||||
args = [qtver, "linux", "desktop", "gcc_64"]
|
||||
command_line.extend(args)
|
||||
command_line.extend(["--archives", "qtbase", "icu", "qt"])
|
||||
env = os.environ.copy()
|
||||
github_workspace = pathlib.Path(env["GITHUB_WORKSPACE"])
|
||||
env["AQT_CONFIG"] = (github_workspace / "ci" / "settings.ini").as_posix()
|
||||
env["LOG_CFG"] = (github_workspace / "ci" / "logging.ini").as_posix()
|
||||
print("Execute: {}".format(command_line))
|
||||
@@ -168,4 +182,4 @@ jobs:
|
||||
if: matrix.artifact == 'binary'
|
||||
with:
|
||||
name: aqt-${{ matrix.os }}-standalone
|
||||
path: .gravitybee\dist\latest\aqt*
|
||||
path: dist\aqt*
|
||||
|
||||
26
.github/workflows/upload-release-artifacts.yml
vendored
26
.github/workflows/upload-release-artifacts.yml
vendored
@@ -31,28 +31,31 @@ jobs:
|
||||
- name: Build standalone binary
|
||||
run: |
|
||||
python -m venv venv
|
||||
source venv/Scripts/activate
|
||||
python -m pip install -U pip wheel setuptools setuptools_scm gravitybee
|
||||
python -m pip install -e .
|
||||
python ci/build_standalone.py ${{ matrix.arch }}
|
||||
shell: bash
|
||||
venv/Scripts/activate.ps1
|
||||
python -m pip install -U pip wheel setuptools setuptools_scm pyinstaller
|
||||
python -m pip install .
|
||||
python tools/build_standalone.py ${{ matrix.arch }}
|
||||
deactivate
|
||||
Remove-Item venv -Recurse -Force
|
||||
shell: pwsh
|
||||
|
||||
- name: Upload to Release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: .gravitybee\dist\latest\aqt_x64.exe
|
||||
file: dist\aqt_x64.exe
|
||||
asset_name: aqt.exe
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
if: matrix.arch=='x64'
|
||||
if: matrix.arch=='x64' && startsWith(github.ref, 'refs/tags/v')
|
||||
- name: Upload to Release for all architectures
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: .gravitybee\dist\latest\aqt_${{ matrix.arch }}.exe
|
||||
file: dist\aqt_${{ matrix.arch }}.exe
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
- name: Update continuous build
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
@@ -60,9 +63,9 @@ jobs:
|
||||
overwrite: true
|
||||
prerelease: true
|
||||
tag: Continuous
|
||||
file: .gravitybee\dist\latest\aqt_x64.exe
|
||||
file: dist\aqt_x64.exe
|
||||
asset_name: aqt.exe
|
||||
if: matrix.arch=='x64'
|
||||
if: matrix.arch=='x64' && startsWith(github.ref, 'refs/tags/v')
|
||||
- name: Update continuous build for all architectures
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
@@ -70,4 +73,5 @@ jobs:
|
||||
overwrite: true
|
||||
prerelease: true
|
||||
tag: Continuous
|
||||
file: .gravitybee\dist\latest\aqt_${{ matrix.arch }}.exe
|
||||
file: dist\aqt_${{ matrix.arch }}.exe
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import argparse
|
||||
|
||||
import gravitybee
|
||||
|
||||
VENV_BIN_PATH="venv/Scripts/"
|
||||
SCRIPTBIN=VENV_BIN_PATH + "aqtinstall.py"
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("arch", nargs="?")
|
||||
args = parser.parse_args()
|
||||
|
||||
# generate pseudo script
|
||||
# pip does not generate console_script any more but gravitybee expect it.
|
||||
with open(SCRIPTBIN, "w") as f:
|
||||
f.write("import aqt\nif __name__ == \"__main__\":\n aqt.main()\n")
|
||||
|
||||
# generate setup.py
|
||||
# pyppyn build wheel with deprecated setup.py bdist_wheel
|
||||
# so fake it with dummy setup.py
|
||||
with open("setup.py", "w") as f:
|
||||
f.write("import setuptools\nsetuptools.setup()\n")
|
||||
|
||||
gbargs = gravitybee.Arguments(
|
||||
app_name="aqtinstall",
|
||||
pkg_name="aqt",
|
||||
script_path=SCRIPTBIN,
|
||||
src_dir=".",
|
||||
pkg_dir=".",
|
||||
clean=False,
|
||||
with_latest=True,
|
||||
name_format="aqt" if args.arch is None else "aqt_" + args.arch,
|
||||
)
|
||||
|
||||
pg = gravitybee.PackageGenerator(gbargs)
|
||||
pg.generate()
|
||||
@@ -75,9 +75,6 @@ Wiki = "https://github.com/miurahr/aqtinstall/wiki"
|
||||
Source = "https://github.com/miurahr/aqtinstall"
|
||||
Changelog = "https://github.com/miurahr/aqtinstall/blob/master/CHANGELOG.rst"
|
||||
|
||||
[tool.poetry]
|
||||
include = ["*.yml", "*.json", "*.ini"]
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools>=61", "wheel", "setuptools_scm[toml]>=6.4"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
75
setup.cfg
75
setup.cfg
@@ -1,79 +1,6 @@
|
||||
[metadata]
|
||||
name = aqtinstall
|
||||
description = Another unofficial Qt installer
|
||||
long_description = file: README.rst
|
||||
long_description_content_type = text/x-rst
|
||||
license = MIT
|
||||
author = Hiroshi Miura
|
||||
author_email = miurahr@linux.com
|
||||
url = http://github.com/miurahr/aqtinstall
|
||||
project_urls =
|
||||
Documentation = https://aqtinstall.readthedocs.io/
|
||||
Bug Tracker = https://github.com/miurahr/aqtinstall/issues
|
||||
Wiki = https://github.com/miurahr/aqtinstall/wiki
|
||||
Source = https://github.com/miurahr/aqtinstall
|
||||
Changelog = https://github.com/miurahr/aqtinstall/blob/master/CHANGELOG.rst
|
||||
classifiers =
|
||||
Development Status :: 4 - Beta
|
||||
Environment :: Console
|
||||
Environment :: X11 Applications :: Qt
|
||||
Intended Audience :: Developers
|
||||
License :: OSI Approved :: MIT License
|
||||
Operating System :: MacOS :: MacOS X
|
||||
Operating System :: Microsoft :: Windows
|
||||
Operating System :: POSIX
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: C++
|
||||
Topic :: Software Development
|
||||
Topic :: Software Development :: Libraries
|
||||
|
||||
[options]
|
||||
python_requires = >= 3.6
|
||||
install_requires =
|
||||
bs4
|
||||
dataclasses;python_version<'3.7'
|
||||
defusedxml
|
||||
humanize
|
||||
patch>=1.16
|
||||
py7zr>=0.18.3
|
||||
requests
|
||||
semantic_version
|
||||
texttable
|
||||
setup_requires =
|
||||
setuptools-scm[toml]>=6.4
|
||||
setuptools>=61
|
||||
packages = aqt
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
aqt = aqt.__main__:main
|
||||
|
||||
[options.package_data]
|
||||
aqt = *.yml, *.json, *.ini
|
||||
|
||||
[options.extras_require]
|
||||
test =
|
||||
pytest
|
||||
pytest-pep8
|
||||
pytest-remotedata
|
||||
pytest-cov
|
||||
pytest-socket
|
||||
pytest-leaks
|
||||
pympler
|
||||
check =
|
||||
flake8
|
||||
flake8-black
|
||||
flake8-colors
|
||||
flake8-isort
|
||||
flake8-pyi
|
||||
flake8-typing-imports
|
||||
docutils
|
||||
check-manifest
|
||||
readme-renderer
|
||||
pygments
|
||||
packaging
|
||||
docs =
|
||||
sphinx>=2.3
|
||||
sphinx_rtd_theme
|
||||
sphinx-py3doc-enhanced-theme
|
||||
aqt = *.yml, *.json, *.ini
|
||||
|
||||
33
tools/build_standalone.py
Normal file
33
tools/build_standalone.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import argparse
|
||||
import os
|
||||
import PyInstaller.__main__
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("arch", nargs="?")
|
||||
args = parser.parse_args()
|
||||
|
||||
# build PyInstaller arguments
|
||||
tools_dir = os.path.dirname(__file__)
|
||||
name = "aqt" if args.arch is None else "aqt_" + args.arch
|
||||
args = [
|
||||
'--noconfirm',
|
||||
'--onefile',
|
||||
'--name', name,
|
||||
'--paths', ".",
|
||||
'--hidden-import', "aqt",
|
||||
]
|
||||
|
||||
# Add data files
|
||||
if os.name == 'nt':
|
||||
adddata_arg = "{src:s};aqt"
|
||||
else:
|
||||
adddata_arg = "{src:s}:aqt"
|
||||
for data in ["aqt/logging.ini", "aqt/settings.ini", "aqt/combinations.json"]:
|
||||
args.append('--add-data')
|
||||
args.append(adddata_arg.format(src=data))
|
||||
args.append(os.path.join(tools_dir, "launch_aqt.py"))
|
||||
|
||||
# launch PyInstaller
|
||||
PyInstaller.__main__.run(args)
|
||||
8
tools/launch_aqt.py
Normal file
8
tools/launch_aqt.py
Normal file
@@ -0,0 +1,8 @@
|
||||
#!python.exe
|
||||
import aqt
|
||||
import re
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(aqt.main())
|
||||
Reference in New Issue
Block a user