11
0
forked from pool/python-apipkg

- Generate the _version.py file in %prep to remove completely hatch-vcs from

pyproject to make it build and run tests correctly

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-apipkg?expand=0&rev=15
This commit is contained in:
2022-11-30 17:07:08 +00:00
committed by Git OBS Bridge
parent 3923f8597c
commit fdda8ed2f5
2 changed files with 11 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Nov 30 17:05:54 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Generate the _version.py file in %prep to remove completely hatch-vcs from
pyproject to make it build and run tests correctly
-------------------------------------------------------------------
Wed Nov 30 16:45:02 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>

View File

@@ -61,7 +61,12 @@ can copy paste the ~200 lines of code into your project.
# Set the package version static, not dynamic, to build without the .git folder
sed -i ':a;N;$!ba;s/dynamic = \[[^]]*\]/version = "%{version}"/g' pyproject.toml
# Remove hatch-vcs dep to avoid cycles
rm .gitignore
sed -i '/tool.hatch.build.hooks.vcs/d' pyproject.toml
cat << EOF > src/apipkg/_version.py
version = "%{version}"
version_tuple = tuple(map(int, version.split(".")))
EOF
%build
%pyproject_wheel