From fdda8ed2f5920f70dbdab046c8dead866c4884449e20eee3d5d8c3ac0beeb90c Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 30 Nov 2022 17:07:08 +0000 Subject: [PATCH] - 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 --- python-apipkg.changes | 6 ++++++ python-apipkg.spec | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/python-apipkg.changes b/python-apipkg.changes index f104497..b98121e 100644 --- a/python-apipkg.changes +++ b/python-apipkg.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Nov 30 17:05:54 UTC 2022 - Daniel Garcia + +- 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 diff --git a/python-apipkg.spec b/python-apipkg.spec index 6cab142..38f9e0e 100644 --- a/python-apipkg.spec +++ b/python-apipkg.spec @@ -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