From c25e106f8816ff7d3e43fdba19c74f9eea8a66f9 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 3 Jan 2020 14:36:14 +1000 Subject: [PATCH] use proper version number in build outputs --- meta/.gitignore | 1 + meta/version | 1 + pylib/Makefile | 2 +- pylib/setup.py | 5 ++++- qt/setup.py | 5 ++++- rspy/Cargo.toml | 2 +- rspy/Makefile | 9 +++++++-- scripts.inc | 8 +++++++- 8 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 meta/.gitignore create mode 100644 meta/version diff --git a/meta/.gitignore b/meta/.gitignore new file mode 100644 index 000000000..b583da4c4 --- /dev/null +++ b/meta/.gitignore @@ -0,0 +1 @@ +buildhash diff --git a/meta/version b/meta/version new file mode 100644 index 000000000..2f1a5aa9c --- /dev/null +++ b/meta/version @@ -0,0 +1 @@ +2.1.17 diff --git a/pylib/Makefile b/pylib/Makefile index 877bb4c31..e5b85b43c 100644 --- a/pylib/Makefile +++ b/pylib/Makefile @@ -78,7 +78,7 @@ CHECKDEPS := $(shell find anki tests -name '*.py' | grep -v buildhash.py) .PHONY: build build: $(BUILD_STEPS) $(CHECKDEPS) rm -rf dist - echo "build='$$(git rev-parse --short HEAD)'" > anki/buildhash.py + echo "build='$$(cat ../meta/buildhash)'" > anki/buildhash.py python setup.py bdist_wheel rsync -a dist/*.whl ../dist/ diff --git a/pylib/setup.py b/pylib/setup.py index 3fee2cdcb..e6c82ef4c 100644 --- a/pylib/setup.py +++ b/pylib/setup.py @@ -3,6 +3,9 @@ import setuptools, sys with open("README.md", "r") as fh: long_description = fh.read() +with open("../meta/version") as fh: + version = fh.read().strip() + platform_reqs = [] if sys.platform == "win32": platform_reqs.append("psutil") @@ -11,7 +14,7 @@ if sys.platform != "win32" and sys.platform != "darwin": setuptools.setup( name="anki", - version="0.1.0", + version=version, author="Ankitects Pty Ltd", description="Anki's library code", long_description=long_description, diff --git a/qt/setup.py b/qt/setup.py index 4a3e68d71..672bc5b3c 100644 --- a/qt/setup.py +++ b/qt/setup.py @@ -3,6 +3,9 @@ import setuptools, sys, os with open("README.md", "r") as fh: long_description = fh.read() +with open("../meta/version") as fh: + version = fh.read().strip() + platform_reqs = [] if sys.platform == "win32": platform_reqs.append("psutil") @@ -17,7 +20,7 @@ extra_files = package_files('aqt_data') setuptools.setup( name="aqt", - version="0.1.0", + version=version, author="Ankitects Pty Ltd", description="Anki's Qt GUI code", long_description=long_description, diff --git a/rspy/Cargo.toml b/rspy/Cargo.toml index 30faedafe..955ba4f7a 100644 --- a/rspy/Cargo.toml +++ b/rspy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ankirspy" -version = "0.1.0" +version = "2.1.17" # automatically updated edition = "2018" authors = ["Ankitects Pty Ltd and contributors"] diff --git a/rspy/Makefile b/rspy/Makefile index a635db172..a895af7b8 100644 --- a/rspy/Makefile +++ b/rspy/Makefile @@ -13,10 +13,10 @@ BUILDFLAGS := --release --strip all: develop -develop: .build/tools +develop: .build/tools .build/vernum maturin develop $(BUILDFLAGS) -build: .build/tools +build: .build/tools .build/vernum rm -rf $(OUTDIR)/ankirspy* maturin build -i $(shell which python3) -o $(OUTDIR) $(BUILDFLAGS) @@ -42,3 +42,8 @@ RUST_TOOLCHAIN := $(shell cat rust-toolchain) cargo fmt -- --check cargo clippy -- -D warnings @touch $@ + +VER := $(shell cat ../meta/version) +.build/vernum: ../meta/version + sed -i '' 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' Cargo.toml + @touch $@ diff --git a/scripts.inc b/scripts.inc index 3c031766c..f04e28148 100644 --- a/scripts.inc +++ b/scripts.inc @@ -20,6 +20,12 @@ else . pyenv/bin/activate fi - # add qt if missing python -c 'import PyQt5' 2>/dev/null || pip install -r qt/requirements.qt + +# update build hash +oldhash=$(test -f meta/buildhash && cat meta/buildhash || true) +newhash=$(git rev-parse --short HEAD) +if [ "$oldhash" != "$newhash" ]; then + echo $newhash > meta/buildhash +fi