git: 3b7f6b8abf96 - main - devel/py-pathtools: Fix build on Python 3.12+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 30 Jun 2026 09:03:44 UTC
The branch main has been updated by nivit:
URL: https://cgit.FreeBSD.org/ports/commit/?id=3b7f6b8abf96acdc47ef24016766b7fe9544a49b
commit 3b7f6b8abf96acdc47ef24016766b7fe9544a49b
Author: Nicola Vitale <nivit@FreeBSD.org>
AuthorDate: 2026-06-30 08:50:22 +0000
Commit: Nicola Vitale <nivit@FreeBSD.org>
CommitDate: 2026-06-30 08:50:22 +0000
devel/py-pathtools: Fix build on Python 3.12+
- The patch provided [1] comes from
https://github.com/gorakhargosh/pathtools/issues/13
and it is already used by other projects: e.g.
https://salsa.debian.org/python-team/packages/python-pathtools/-/blob/debian/master/debian/patches/python-3.12-support.patch?ref_type=heads
- Convert port to PEP517
- Pet portclippy
PR: 294676 [1]
---
devel/py-pathtools/Makefile | 13 ++++++++-----
devel/py-pathtools/files/patch-setup.py | 25 +++++++++++++++++++++++++
2 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/devel/py-pathtools/Makefile b/devel/py-pathtools/Makefile
index 4cd3ef25b399..93367c244817 100644
--- a/devel/py-pathtools/Makefile
+++ b/devel/py-pathtools/Makefile
@@ -11,19 +11,22 @@ WWW= https://github.com/gorakhargosh/pathtools
LICENSE= MIT
+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools>=63.1:devel/py-setuptools \
+ ${PYTHON_PKGNAMEPREFIX}wheel>=0.47:devel/py-wheel
+
USES= python
-USE_PYTHON= distutils autoplist
+USE_PYTHON= autoplist pep517
+
+DOCSDIR= ${PREFIX}/share/doc/${PKGNAMEPREFIX}${PORTNAME}
NO_ARCH= yes
+PORTDOCS= *
+
OPTIONS_DEFINE= DOCS
DOCS_BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sphinx>=0,1:textproc/py-sphinx@${PY_FLAVOR}
-DOCSDIR= ${PREFIX}/share/doc/${PKGNAMEPREFIX}${PORTNAME}
-
-PORTDOCS= *
-
post-build-DOCS-on:
@(cd ${WRKSRC}/docs ; ${MAKE} SPHINXBUILD=sphinx-build-${PYTHON_VER} html)
diff --git a/devel/py-pathtools/files/patch-setup.py b/devel/py-pathtools/files/patch-setup.py
new file mode 100644
index 000000000000..6b16ec5b441f
--- /dev/null
+++ b/devel/py-pathtools/files/patch-setup.py
@@ -0,0 +1,25 @@
+--- setup.py.orig 2011-08-25 09:25:25 UTC
++++ setup.py
+@@ -22,11 +22,20 @@ import os
+ # THE SOFTWARE.
+
+ import os
+-import imp
++import importlib.util
++import importlib.machinery
+ from setuptools import setup
+
+ PKG_DIR = 'pathtools'
+-version = imp.load_source('version',
++
++def load_source(modname, filename):
++ loader = importlib.machinery.SourceFileLoader(modname, filename)
++ spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
++ module = importlib.util.module_from_spec(spec)
++ loader.exec_module(module)
++ return module
++
++version = load_source('version',
+ os.path.join(PKG_DIR, 'version.py'))
+
+ def read_file(filename):