python-netsnmpagent
python-netsnmpagent copied to clipboard
Switch to setuptools
Unfortunately distutils is deprecated and will be removed in python 3.12
This solves only one part of the issue.
Recent setuptools
(> 66.0) enforce semantic versioning.
This causes build failure:
File "tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/python3-netsnmpagent/0.6.0+git/git/setup.py", line 19, in <module>
setup(
File "tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/python3-netsnmpagent/0.6.0+git/recipe-sysroot-native/usr/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 147, in setup
_setup_distribution = dist = klass(attrs)
^^^^^^^^^^^^
File "tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/python3-netsnmpagent/0.6.0+git/recipe-sysroot-native/usr/lib/python3.12/site-packages/setuptools/dist.py", line 314, in __init__
self.metadata.version = self._normalize_version(self.metadata.version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/python3-netsnmpagent/0.6.0+git/recipe-sysroot-native/usr/lib/python3.12/site-packages/setuptools/dist.py", line 350, in _normalize_version
normalized = str(Version(version))
^^^^^^^^^^^^^^^^
File "tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/python3-netsnmpagent/0.6.0+git/recipe-sysroot-native/usr/lib/python3.12/site-packages/setuptools/_vendor/packaging/version.py", line 198, in __init__
raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: '0.6.0_next32_g572fc10'
You need to also patch the Makefile
generating compatible version strings:
diff --git a/Makefile b/Makefile
index 3904373..1c27010 100755
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ VERSION := $(shell git describe)
ifeq ($(shell echo $(VERSION) | sed 's,^[[:digit:]]\+\.[[:digit:]]\+\(\.[[:digit:]]\+\)\?,,'),)
TAGGED := 1
else
- VERSION := $(shell echo $(VERSION) | sed 's,-,_next,;s,-,_,')
+ VERSION := $(shell echo $(VERSION) | sed 's,-,+next,')
endif
all: help
On debian unstable there is setuptools 68.1.2
.
And dpkg-buildpackage
of python-netsnmpagent
works. I just tried now.
The package includes the exact same patch that is found here.
So I believe you are mistaken.
I have tested with Python
v3.12.4 and setuptools
v69.1.1, hence the compatibility can also break later than expected.
Update
Configuring project version and egg_info.tag_* in such a way that results in invalid version strings (according to PEP 440) is no longer permitted. (#4066)
I took this from the setuptools
v69.0.0 release notes. So v69 enforces proper versions, not v66.
I have setuptools 70.3.0 installed.
Anyway if you don't have commit rights here, this is all moot.
I'm willing to merge this but I can't figure out: do we need the second patch or not? Not that it would hurt... if so, please add it to your MR.
@ltworf As I am not able to push to push to your branch, here's a complete git patch to apply with git am
:
From d919bad1a2550492910018132e04b95ab5ccb287 Mon Sep 17 00:00:00 2001
From: Stephan Wurm <[email protected]>
Date: Thu, 11 Jul 2024 14:27:08 +0200
Subject: [PATCH] Fix dynamic versions for recent setuptools
`setuptools` starting from v69.0.0 require all version strings to comply
to the semantic versioning schema.
Adapted dynamic versions according to semantic versioning in order to
prevent from `InvalidVersion` exception during build.
Signed-off-by: Stephan Wurm <[email protected]>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 3904373..1c27010 100755
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ VERSION := $(shell git describe)
ifeq ($(shell echo $(VERSION) | sed 's,^[[:digit:]]\+\.[[:digit:]]\+\(\.[[:digit:]]\+\)\?,,'),)
TAGGED := 1
else
- VERSION := $(shell echo $(VERSION) | sed 's,-,_next,;s,-,_,')
+ VERSION := $(shell echo $(VERSION) | sed 's,-,+next,')
endif
all: help
--
2.34.1
Ok I added your commit to the branch.
Next time it would be enough to make your own PR based on mine I think. And then mine could just be discarded.