tech-pkg archive

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

Remove partial-extraction hack for Python modules



Hello all,
we build a number of Python packages separately as they require
additional depencies. Those are:
  databases/py-gdbm
  databases/py-sqlite3
  devel/py-curses
  devel/py-cursespanel
  devel/py-idle
  devel/py-readline
  textproc/py-cElementTree
  textproc/py-expat
  x11/py-Tk

For historic reasons, those only extract a small part of the Python
distfile and hack around the patch failure for non-existing files by
ignoring the error status. I think that hack has mostly outlived its
usefulness. Recent changes in Python 3.8 for example broke all the
packages by requiring additional files to be extracted. The attached
patch removes the hack. Downside is that it will require more disk space
and associated writes during a build.

Joerg
Index: databases/py-gdbm/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/databases/py-gdbm/Makefile,v
retrieving revision 1.40
diff -u -p -r1.40 Makefile
--- databases/py-gdbm/Makefile	15 Dec 2019 14:42:27 -0000	1.40
+++ databases/py-gdbm/Makefile	25 Dec 2019 00:08:47 -0000
@@ -17,7 +17,6 @@ GDBM_MODNAME=	_gdbm
 GDBM_MODNAME=	gdbm
 .endif
 
-EXTRACT_ELEMENTS=	${PYSUBDIR}/Modules/${GDBM_MODNAME}module.c
 PYDISTUTILSPKG=		yes
 
 PY_SETUP_SUBST+=	GDBMPREFIX=${BUILDLINK_PREFIX.gdbm}
@@ -25,14 +24,6 @@ PY_SETUP_SUBST+=	GDBM_MODNAME=${GDBM_MOD
 PLIST_SUBST+=		GDBM_MODNAME=${GDBM_MODNAME}
 PYSETUPINSTALLARGS+=	--install-lib ${PREFIX}/${PYLIB}/lib-dynload
 
-# ignore errors due to missing files (EXTRACT_ELEMENTS!)
-do-patch:
-	set -e;								\
-	cd ${WRKSRC};							\
-	for f in ${PATCHDIR}/patch-*; do				\
-		${PATCH} --batch < "$$f" || ${TRUE};			\
-	done
-
 .include "../../databases/gdbm/buildlink3.mk"
 .include "../../lang/python/extension.mk"
 .include "../../lang/python/srcdist.mk"
Index: databases/py-sqlite3/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/databases/py-sqlite3/Makefile,v
retrieving revision 1.35
diff -u -p -r1.35 Makefile
--- databases/py-sqlite3/Makefile	2 Nov 2019 15:38:10 -0000	1.35
+++ databases/py-sqlite3/Makefile	25 Dec 2019 00:08:47 -0000
@@ -11,21 +11,11 @@ COMMENT=	Built-in sqlite support for Pyt
 USE_GCC_RUNTIME=	yes
 USE_TOOLS+=		patch
 
-EXTRACT_ELEMENTS=	${PYSUBDIR}/Modules/_sqlite
-
 # part of python itself; using distutils.mk will install a useless egg
 PYDISTUTILSPKG=		yes
 PY_SETUP_SUBST+=	SQLITE_PREFIX=${BUILDLINK_PREFIX.sqlite3}
 PYSETUPINSTALLARGS+=	--install-lib ${PREFIX}/${PYLIB}/lib-dynload
 
-# ignore errors due to missing files (EXTRACT_ELEMENTS!)
-do-patch:
-	set -e;								\
-	cd ${WRKSRC};							\
-	for f in ${PATCHDIR}/patch-*; do				\
-		${PATCH} --batch < "$$f" || ${TRUE};			\
-	done
-
 .include "../../databases/sqlite3/buildlink3.mk"
 .include "../../lang/python/extension.mk"
 .include "../../lang/python/srcdist.mk"
Index: devel/py-curses/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/devel/py-curses/Makefile,v
retrieving revision 1.50
diff -u -p -r1.50 Makefile
--- devel/py-curses/Makefile	15 Dec 2019 14:42:27 -0000	1.50
+++ devel/py-curses/Makefile	25 Dec 2019 00:08:47 -0000
@@ -8,7 +8,6 @@ MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 #HOMEPAGE=	https://www.python.org/doc/current/lib/module-curses.html
 COMMENT=	Curses module for Python
 
-EXTRACT_ELEMENTS=	${PYSUBDIR}/Modules/_cursesmodule.c
 PYDISTUTILSPKG=		yes
 PY_PATCHPLIST=		yes
 
@@ -20,14 +19,6 @@ FAKE_NCURSES=	yes
 PY_SETUP_SUBST=		NCURSESPREFIX=${BUILDLINK_PREFIX.ncurses}
 PYSETUPINSTALLARGS+=	--install-lib ${PREFIX}/${PYLIB}/lib-dynload
 
-# ignore errors due to missing files (EXTRACT_ELEMENTS!)
-do-patch:
-	set -e;								\
-	cd ${WRKSRC};							\
-	for f in ${PATCHDIR}/patch-*; do				\
-		${PATCH} --batch < "$$f" || ${TRUE};			\
-	done
-
 .include "../../lang/python/extension.mk"
 .include "../../lang/python/srcdist.mk"
 .include "../../mk/curses.buildlink3.mk"
Index: devel/py-cursespanel/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/devel/py-cursespanel/Makefile,v
retrieving revision 1.33
diff -u -p -r1.33 Makefile
--- devel/py-cursespanel/Makefile	15 Dec 2019 14:42:27 -0000	1.33
+++ devel/py-cursespanel/Makefile	25 Dec 2019 00:08:47 -0000
@@ -13,19 +13,11 @@ DEPENDS+=	${PYPKGPREFIX}-curses-[0-9]*:.
 USE_CURSES=	getsyx
 FAKE_NCURSES=	yes
 
-EXTRACT_ELEMENTS=	${PYSUBDIR}/Modules/_curses_panel.c
 PYDISTUTILSPKG=		yes
 
 PY_SETUP_SUBST=		NCURSESPREFIX=${BUILDLINK_PREFIX.ncurses}
 PYSETUPINSTALLARGS+=	--install-lib ${PREFIX}/${PYLIB}/lib-dynload
 
-# ignore errors due to missing files (EXTRACT_ELEMENTS!)
-do-patch:
-	(cd ${WRKSRC}; \
-	for f in ${PATCHDIR}/patch-*;do \
-	${PATCH} --batch <$$f || ${TRUE}; \
-	done)
-
 .include "../../lang/python/extension.mk"
 .include "../../lang/python/srcdist.mk"
 .include "../../mk/curses.buildlink3.mk"
Index: devel/py-idle/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/devel/py-idle/Makefile,v
retrieving revision 1.38
diff -u -p -r1.38 Makefile
--- devel/py-idle/Makefile	3 Nov 2019 10:18:28 -0000	1.38
+++ devel/py-idle/Makefile	25 Dec 2019 00:08:47 -0000
@@ -11,13 +11,6 @@ DEPENDS+=	${PYPKGPREFIX}-Tk-[0-9]*:../..
 
 PY_PATCHPLIST=	yes
 
-# ignore errors due to missing files (EXTRACT_ELEMENTS!)
-do-patch:
-	(cd ${WRKSRC}; \
-	for f in ${PATCHDIR}/patch-*;do \
-	${PATCH} --batch <$$f || ${TRUE}; \
-	done)
-
 #
 # With Python-2.3 and up, the Idle code is part of the base library.
 # We just install a wrapper script. Also, threads are required now.
@@ -31,7 +24,6 @@ IDLE_NAME=	idle3
 IDLE_NAME=	idle
 .endif
 
-EXTRACT_ELEMENTS=	${PYSUBDIR}/Tools/scripts/${IDLE_NAME}
 REPLACE_PYTHON=		Tools/scripts/${IDLE_NAME}
 NO_BUILD=		yes
 INSTALLATION_DIRS=	bin
Index: devel/py-readline/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/devel/py-readline/Makefile,v
retrieving revision 1.34
diff -u -p -r1.34 Makefile
--- devel/py-readline/Makefile	15 Dec 2019 14:42:26 -0000	1.34
+++ devel/py-readline/Makefile	25 Dec 2019 00:08:58 -0000
@@ -7,8 +7,6 @@ MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	https://docs.python.org/3/library/readline.html
 COMMENT=	Line editing support for Python
 
-EXTRACT_ELEMENTS=	${PYSUBDIR}/Modules/readline.c
-
 USE_GCC_RUNTIME=	yes
 
 PYDISTUTILSPKG=		yes
@@ -16,13 +14,6 @@ PY_SETUP_SUBST+=	RLPREFIX=${BUILDLINK_PR
 PY_SETUP_SUBST+=	RLRTPREFIX=${BUILDLINK_PREFIX.readline}
 PYSETUPINSTALLARGS+=	--install-lib ${PREFIX}/${PYLIB}/lib-dynload
 
-# ignore errors due to missing files (EXTRACT_ELEMENTS!)
-do-patch:
-	(cd ${WRKSRC}; \
-	for f in ${PATCHDIR}/patch-*;do \
-	${PATCH} --batch <$$f || ${TRUE}; \
-	done)
-
 .include "../../devel/readline/buildlink3.mk"
 .include "../../lang/python/extension.mk"
 .include "../../lang/python/srcdist.mk"
Index: lang/python/srcdist.mk
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/lang/python/srcdist.mk,v
retrieving revision 1.39
diff -u -p -r1.39 srcdist.mk
--- lang/python/srcdist.mk	15 Dec 2019 14:42:26 -0000	1.39
+++ lang/python/srcdist.mk	25 Dec 2019 00:08:47 -0000
@@ -11,10 +11,6 @@ WRKSRC=		${WRKDIR}/${PYSUBDIR}
 # This is used for standard modules shipped with Python but build as
 # separate packages.
 
-.  if ${_PYTHON_VERSION} != 27
-EXTRACT_ELEMENTS+=	${PYSUBDIR}/Modules/clinic
-.  endif
-
 # Standard modules depend on their own version
 BUILDLINK_API_DEPENDS.${PYPACKAGE}+=	${PYPACKAGE}>=${PY_DISTVERSION}
 BUILDLINK_ABI_DEPENDS.${PYPACKAGE}+=	${PYPACKAGE}>=${PY_DISTVERSION}
@@ -23,5 +19,5 @@ python-std-patchsetup:
 	${SED} ${PY_SETUP_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/} \
 		<${FILESDIR}/setup.py >${WRKSRC}/setup.py
 
-post-extract: python-std-patchsetup
+post-patch: python-std-patchsetup
 .endif
Index: textproc/py-cElementTree/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/textproc/py-cElementTree/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- textproc/py-cElementTree/Makefile	4 Nov 2019 21:43:45 -0000	1.15
+++ textproc/py-cElementTree/Makefile	25 Dec 2019 00:08:47 -0000
@@ -7,12 +7,6 @@ MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	http://www.effbot.org/zone/celementtree.htm
 COMMENT=	C implementation of Python ElementTree API
 
-EXTRACT_ELEMENTS=	${PYSUBDIR}/Modules/_elementtree.c
-.include "../../lang/python/pyversion.mk"
-.if ${_PYTHON_VERSION} != 27
-EXTRACT_ELEMENTS+=	${PYSUBDIR}/Modules/clinic/_elementtree.c.h
-.endif
-
 USE_GCC_RUNTIME=	yes
 USE_TOOLS+=		patch
 
@@ -23,13 +17,6 @@ PY_SETUP_SUBST+=	EXPATRTPREFIX=${BUILDLI
 
 PYSETUPINSTALLARGS+=	--install-lib ${PREFIX}/${PYLIB}/lib-dynload
 
-# ignore errors due to missing files (EXTRACT_ELEMENTS!)
-do-patch:
-	(cd ${WRKSRC}; \
-	for f in ${PATCHDIR}/patch-*;do \
-	${PATCH} --batch <$$f || ${TRUE}; \
-	done)
-
 .include "../../textproc/expat/buildlink3.mk"
 .include "../../lang/python/extension.mk"
 .include "../../lang/python/srcdist.mk"
Index: textproc/py-expat/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/textproc/py-expat/Makefile,v
retrieving revision 1.29
diff -u -p -r1.29 Makefile
--- textproc/py-expat/Makefile	4 Nov 2019 21:43:45 -0000	1.29
+++ textproc/py-expat/Makefile	25 Dec 2019 00:08:47 -0000
@@ -7,12 +7,6 @@ MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	https://www.python.org/
 COMMENT=	Python interface to expat
 
-EXTRACT_ELEMENTS=	${PYSUBDIR}/Modules/pyexpat.c
-.include "../../lang/python/pyversion.mk"
-.if ${_PYTHON_VERSION} != 27
-EXTRACT_ELEMENTS+=	${PYSUBDIR}/Modules/clinic/pyexpat.c.h
-.endif
-
 USE_GCC_RUNTIME=	yes
 
 PYDISTUTILSPKG=		yes
Index: x11/py-Tk/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/x11/py-Tk/Makefile,v
retrieving revision 1.67
diff -u -p -r1.67 Makefile
--- x11/py-Tk/Makefile	12 Dec 2019 10:46:15 -0000	1.67
+++ x11/py-Tk/Makefile	25 Dec 2019 00:08:47 -0000
@@ -11,8 +11,6 @@ LICENSE=	python-software-foundation
 
 USE_GCC_RUNTIME=	yes
 
-EXTRACT_ELEMENTS=	${PYSUBDIR}/Modules/_tkinter.c \
-			${PYSUBDIR}/Modules/tkappinit.c
 PYDISTUTILSPKG=		yes
 PY_PATCHPLIST=		yes
 PY_SETUP_SUBST+=	BLPREFIX=${LOCALBASE}
@@ -31,20 +29,6 @@ PY_SETUP_SUBST+=	X11LIB=\'X11\'
 .endif
 
 .include "../../lang/python/extension.mk"
-
-.if ${_PYTHON_VERSION} >= 27
-EXTRACT_ELEMENTS+=	${PYSUBDIR}/Modules/tkinter.h
-.endif
-.if ${_PYTHON_VERSION} >= 38
-EXTRACT_ELEMENTS+=	${PYSUBDIR}/Modules/clinic
-.endif
-
-# ignore errors due to missing files (EXTRACT_ELEMENTS!)
-do-patch:
-	set -e; cd ${WRKSRC} && for f in ${PATCHDIR}/patch-*; do \
-	${PATCH} ${PATCHARGS} --batch <$$f || ${TRUE}; \
-	done
-
 .include "../../lang/python/srcdist.mk"
 .include "../../lang/tcl/buildlink3.mk"
 .include "../../x11/tk/buildlink3.mk"


Home | Main Index | Thread Index | Old Index