From 50e9780e661d2befd00022a9166ad782c5fdb7c1 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Tue, 31 Mar 2020 00:26:53 -0300 Subject: [PATCH] Set to build a source distribution instead of build distribution for aqt on qt/Makefile, because .whl files are just zip simple zip files and do not support dynamic versioning. Also, there is no restriction for aqt to be shipped as source tarball because it does not ship any binaries. --- .github/workflows/checks.yml | 4 ++-- qt/Makefile | 12 +++++++++--- qt/pyproject.toml | 4 ++++ qt/setup.py | 5 +---- 4 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 qt/pyproject.toml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 13cefdeda..3405b57df 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -269,7 +269,7 @@ jobs: copy %pyaudio% dist cd dist setlocal EnableDelayedExpansion - cmd /C set "wheels=" && for /f "delims=" %%i in ('dir /b *.whl') DO set "wheels="%%i" !wheels!" + cmd /C set "wheels=" && for /f "delims=" %%i in ('dir /b *.*') DO set "wheels="%%i" !wheels!" python -m pip install %wheels% python -c "import aqt; # aqt.run()" @@ -278,7 +278,7 @@ jobs: run: | set -x cd dist - python -m pip install *.whl + python -m pip install *.* python -c "import aqt; # aqt.run()" - run: make check diff --git a/qt/Makefile b/qt/Makefile index 4fef3e92b..c27741da0 100644 --- a/qt/Makefile +++ b/qt/Makefile @@ -64,7 +64,7 @@ TSDEPS := $(wildcard ts/src/*.ts) $(wildcard ts/scss/*.scss) python -m black aqt/gui_hooks.py @touch $@ -BUILD_STEPS := .build/run-deps .build/dev-deps .build/js .build/ui aqt/buildinfo.py .build/hooks .build/i18n +BUILD_STEPS := .build/vernum .build/run-deps .build/dev-deps .build/js .build/ui aqt/buildinfo.py .build/hooks .build/i18n # Checking ###################### @@ -129,8 +129,8 @@ CHECKDEPS := $(shell ${FIND} aqt tests -name '*.py' | grep -v buildinfo.py) .PHONY: build build: $(BUILD_STEPS) rm -rf dist build - python setup.py -q bdist_wheel - rsync -a dist/*.whl ../dist/ + python setup.py -q sdist + rsync -a dist/*.tar.gz ../dist/ .PHONY: develop develop: $(BUILD_STEPS) @@ -138,3 +138,9 @@ develop: $(BUILD_STEPS) aqt/buildinfo.py: ../meta/version ../meta/buildhash echo "buildhash='$$(cat ../meta/buildhash)'" > $@ echo "version='$$(cat ../meta/version)'" >> $@ + +VER := $(shell cat ../meta/version) +.build/vernum: ../meta/version + sed -i.bak 's/.*automatically updated.*/ version="$(VER)", # automatically updated/' setup.py + rm setup.py.bak + @touch $@ diff --git a/qt/pyproject.toml b/qt/pyproject.toml new file mode 100644 index 000000000..754ed04e1 --- /dev/null +++ b/qt/pyproject.toml @@ -0,0 +1,4 @@ +[build-system] +# Minimum requirements for the build system to execute. +# https://stackoverflow.com/questions/48048745/setup-py-require-a-recent-version-of-setuptools-before-trying-to-install +requires = ["setuptools", "wheel"] diff --git a/qt/setup.py b/qt/setup.py index 30780189a..3a8f205ac 100644 --- a/qt/setup.py +++ b/qt/setup.py @@ -5,9 +5,6 @@ from distutils.version import LooseVersion import setuptools -with open("../meta/version") as fh: - version = fh.read().strip() - def package_files(directory): entries = [] @@ -59,7 +56,7 @@ if not IS_PYQT_INSTALLED or ( setuptools.setup( name="aqt", - version=version, + version="2.1.24", # automatically updated author="Ankitects Pty Ltd", description="Anki's Qt GUI code", long_description="Anki's QT GUI code",