diff --git a/.github/workflows/pyproject-build.yml b/.github/workflows/pyproject-build.yml index 04f97c9..cdbafb3 100644 --- a/.github/workflows/pyproject-build.yml +++ b/.github/workflows/pyproject-build.yml @@ -47,6 +47,9 @@ jobs: python -m pip install --upgrade pip python -m pip install build if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Prepare to build + run: | + ./version-setup.py - name: Build sdist run: | python -m build --sdist diff --git a/pyproject.toml b/pyproject.toml index 0a2f918..61f49dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,12 +32,13 @@ klipper-klippy = "klippy.klippy:main" klipper_klippy = "klippy.klippy:main" [tool.setuptools.dynamic] -version = { file = "klippy/.version" } +version = { file = ".py_version" } [tool.setuptools.packages.find] include = [ "klippy", "klippy.*", + "build_data" ] [tool.setuptools.package-data] diff --git a/version-setup.sh b/version-setup.sh new file mode 100755 index 0000000..5f479a8 --- /dev/null +++ b/version-setup.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +raw_version="$(cat klippy/.version)" +declare -a versontags +IFS="-" read -r -a versiontags <<<"$raw_version" +# TODO: Handle a single tag, for actual release tags +py_version="${versiontags[0]}-dev${versiontags[1]}+git.${versiontags[2]}" +echo "$py_version" > ".py_version"