Skip to content

Commit

Permalink
feat: dynamic versionstamping
Browse files Browse the repository at this point in the history
  • Loading branch information
Laikulo committed Nov 18, 2024
1 parent c89f63c commit 6661e85
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/pyproject-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 7 additions & 0 deletions version-setup.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 6661e85

Please sign in to comment.