use proper version number in build outputs

This commit is contained in:
Damien Elmes 2020-01-03 14:36:14 +10:00
parent e2ede3af0e
commit c25e106f88
8 changed files with 26 additions and 7 deletions

1
meta/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
buildhash

1
meta/version Normal file
View file

@ -0,0 +1 @@
2.1.17

View file

@ -78,7 +78,7 @@ CHECKDEPS := $(shell find anki tests -name '*.py' | grep -v buildhash.py)
.PHONY: build .PHONY: build
build: $(BUILD_STEPS) $(CHECKDEPS) build: $(BUILD_STEPS) $(CHECKDEPS)
rm -rf dist 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 python setup.py bdist_wheel
rsync -a dist/*.whl ../dist/ rsync -a dist/*.whl ../dist/

View file

@ -3,6 +3,9 @@ import setuptools, sys
with open("README.md", "r") as fh: with open("README.md", "r") as fh:
long_description = fh.read() long_description = fh.read()
with open("../meta/version") as fh:
version = fh.read().strip()
platform_reqs = [] platform_reqs = []
if sys.platform == "win32": if sys.platform == "win32":
platform_reqs.append("psutil") platform_reqs.append("psutil")
@ -11,7 +14,7 @@ if sys.platform != "win32" and sys.platform != "darwin":
setuptools.setup( setuptools.setup(
name="anki", name="anki",
version="0.1.0", version=version,
author="Ankitects Pty Ltd", author="Ankitects Pty Ltd",
description="Anki's library code", description="Anki's library code",
long_description=long_description, long_description=long_description,

View file

@ -3,6 +3,9 @@ import setuptools, sys, os
with open("README.md", "r") as fh: with open("README.md", "r") as fh:
long_description = fh.read() long_description = fh.read()
with open("../meta/version") as fh:
version = fh.read().strip()
platform_reqs = [] platform_reqs = []
if sys.platform == "win32": if sys.platform == "win32":
platform_reqs.append("psutil") platform_reqs.append("psutil")
@ -17,7 +20,7 @@ extra_files = package_files('aqt_data')
setuptools.setup( setuptools.setup(
name="aqt", name="aqt",
version="0.1.0", version=version,
author="Ankitects Pty Ltd", author="Ankitects Pty Ltd",
description="Anki's Qt GUI code", description="Anki's Qt GUI code",
long_description=long_description, long_description=long_description,

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ankirspy" name = "ankirspy"
version = "0.1.0" version = "2.1.17" # automatically updated
edition = "2018" edition = "2018"
authors = ["Ankitects Pty Ltd and contributors"] authors = ["Ankitects Pty Ltd and contributors"]

View file

@ -13,10 +13,10 @@ BUILDFLAGS := --release --strip
all: develop all: develop
develop: .build/tools develop: .build/tools .build/vernum
maturin develop $(BUILDFLAGS) maturin develop $(BUILDFLAGS)
build: .build/tools build: .build/tools .build/vernum
rm -rf $(OUTDIR)/ankirspy* rm -rf $(OUTDIR)/ankirspy*
maturin build -i $(shell which python3) -o $(OUTDIR) $(BUILDFLAGS) maturin build -i $(shell which python3) -o $(OUTDIR) $(BUILDFLAGS)
@ -42,3 +42,8 @@ RUST_TOOLCHAIN := $(shell cat rust-toolchain)
cargo fmt -- --check cargo fmt -- --check
cargo clippy -- -D warnings cargo clippy -- -D warnings
@touch $@ @touch $@
VER := $(shell cat ../meta/version)
.build/vernum: ../meta/version
sed -i '' 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' Cargo.toml
@touch $@

View file

@ -20,6 +20,12 @@ else
. pyenv/bin/activate . pyenv/bin/activate
fi fi
# add qt if missing # add qt if missing
python -c 'import PyQt5' 2>/dev/null || pip install -r qt/requirements.qt 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