git: 935065c7f7b4 - main - devel/py-pipdeptree: Fix runtime

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Wed, 18 Oct 2023 21:15:44 UTC
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=935065c7f7b49fc512df152f12859fcdd3ba476d

commit 935065c7f7b49fc512df152f12859fcdd3ba476d
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-10-18 20:47:30 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-10-18 21:15:32 +0000

    devel/py-pipdeptree: Fix runtime
    
    At runtime the program crashes due to an error like the following:
    ImportError: cannot import name '__version__' from 'pipdeptree.version'
    
    Which is caused due to the new template format of the setuptools_scm.
    Currently this is just a dirty hack to support older(<7) setuptools_scm
    format.
    
    PR:             274101
    Reported by:    vedran@miletic.net
---
 devel/py-pipdeptree/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/devel/py-pipdeptree/Makefile b/devel/py-pipdeptree/Makefile
index fae39f27b264..741dea072f10 100644
--- a/devel/py-pipdeptree/Makefile
+++ b/devel/py-pipdeptree/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	pipdeptree
 PORTVERSION=	2.13.0
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -20,4 +21,8 @@ USE_PYTHON=	autoplist concurrent pep517 pytest
 
 NO_ARCH=	yes
 
+post-patch:
+	@${REINPLACE_CMD} -e 's|import __version__|import version as __version__|g' \
+		${WRKSRC}/src/pipdeptree/_cli.py
+
 .include <bsd.port.mk>