tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Split python client from sysutils/ups-nut ?



On Fri, May 16, 2025 at 02:15:04PM +0200, Martin Husemann wrote:
> I'll test the build w/o python and see what it saves. Adding a default-on
> option for python support is another way to solve the issue (but build options
> are lame).

Since the build of python failed for me and fixing that will take longer
I went for a simple solution and in retrospect this is probably a good-enough
way forward: if using binary pkgs I wouldn't care for the addition python
client stuff (taking minimal disk space) and for the affected machines
(in my case things like sh3, mips, armv4, vax) I will have to do local
builds anyway - so a build option solves my issue and is quite non-intrusive.

Patch below, tested only for the 

	PKG_OPTIONS.ups-nut     += -python -openssl

case.

Martin

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/ups-nut/Makefile,v
retrieving revision 1.77
diff -c -u -r1.77 Makefile
--- Makefile	13 Feb 2025 19:18:36 -0000	1.77
+++ Makefile	16 May 2025 12:57:21 -0000
@@ -5,6 +5,8 @@
 PKGNAME=		ups-${DISTNAME}
 COMMENT=		Network UPS Tools
 
+PLIST_VARS+=		python
+
 SUBST_CLASSES+=		man-so
 SUBST_MESSAGE.man-so=	Fixing manpage .so references.
 SUBST_STAGE.man-so=	pre-build
@@ -31,10 +33,6 @@
 # https://github.com/networkupstools/nut/issues/1792 which upstream
 # declines to fix.
 CONFIGURE_ARGS+=	--without-python2
-# Force only our chosen python3 (same reason as above).
-CONFIGURE_ARGS+=	--with-python3=${PYTHONBIN}
-CONFIGURE_ARGS+=	--with-python=${PYTHONBIN}
-# \todo Move to split package.
 
 PKG_GROUPS_VARS+=	NUT_GROUP
 PKG_USERS_VARS+=	NUT_USER
@@ -94,5 +92,7 @@
 
 # nut-scanner needs libltdl, but this is not documented
 .include "../../devel/libltdl/buildlink3.mk"
+.if !empty(PKG_OPTIONS:Mpython)
 .include "../../lang/python/extension.mk"
+.endif
 .include "../../mk/bsd.pkg.mk"
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/ups-nut/PLIST,v
retrieving revision 1.33
diff -c -u -r1.33 PLIST
--- PLIST	3 Apr 2024 17:42:53 -0000	1.33
+++ PLIST	16 May 2025 12:57:21 -0000
@@ -23,8 +23,8 @@
 lib/pkgconfig/libnutclientstub.pc
 lib/pkgconfig/libnutscan.pc
 lib/pkgconfig/libupsclient.pc
-${PYSITELIB}/PyNUT.py
-${PYSITELIB}/test_nutclient.py
+${PLIST.python}${PYSITELIB}/PyNUT.py
+${PLIST.python}${PYSITELIB}/test_nutclient.py
 libexec/nut/al175
 libexec/nut/apcsmart
 libexec/nut/apcsmart-old
Index: options.mk
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/ups-nut/options.mk,v
retrieving revision 1.3
diff -c -u -r1.3 options.mk
--- options.mk	9 Nov 2023 21:02:48 -0000	1.3
+++ options.mk	16 May 2025 12:57:21 -0000
@@ -1,9 +1,10 @@
 # $NetBSD: options.mk,v 1.3 2023/11/09 21:02:48 gdt Exp $
 
 PKG_OPTIONS_VAR=		PKG_OPTIONS.ups-nut
+PKG_SUPPORTED_OPTIONS=		python
 PKG_OPTIONS_OPTIONAL_GROUPS=	ssl
 PKG_OPTIONS_GROUP.ssl=		nss openssl
-PKG_SUGGESTED_OPTIONS=		openssl
+PKG_SUGGESTED_OPTIONS=		openssl python
 
 .include "../../mk/bsd.options.mk"
 
@@ -16,3 +17,13 @@
 .else
 CONFIGURE_ARGS+=	--without-ssl
 .endif
+
+.if !empty(PKG_OPTIONS:Mpython)
+# Force only our chosen python3 (see Makefile comment for --without-python2)
+CONFIGURE_ARGS+=	--with-python3=${PYTHONBIN}
+CONFIGURE_ARGS+=	--with-python=${PYTHONBIN}
+PLIST.python=		yes
+# \todo Move to split package.
+.else
+CONFIGURE_ARGS+=	--without-python3
+.endif



Home | Main Index | Thread Index | Old Index