Bug 243358 - [PATCH] lang/python*: DISABLED_EXTENSIONS doesn't work as advertised
Summary: [PATCH] lang/python*: DISABLED_EXTENSIONS doesn't work as advertised
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-python (Nobody)
Depends on:
Reported: 2020-01-15 00:08 UTC by Enji Cooper
Modified: 2020-01-15 00:34 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (python)


Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer 2020-01-15 00:08:50 UTC
I tried building lang/python38 on a system with sqlite3 available, and unfortunately it failed `check-plist` because the extension had been installed.

Doing some grepping around, DISABLE_EXTENSIONS isn't actively referred to in setup.py nor in Makefile.pre*:

ports/lang/python38/work/Python-3.8.1/setup.py:DISABLED_MODULE_LIST = []
ports/lang/python38/work/Python-3.8.1/setup.py:                      if ext.name not in DISABLED_MODULE_LIST]
ports/lang/python38/work/Python-3.8.1/setup.py:        sysconf_dis = sysconfig.get_config_var('MODDISABLED_NAMES').split()

It turns out that the correct way to do this is via `Modules/Setup`, but this method seems to be broken.

An upstream bug is pending for the issue.
Comment 1 Enji Cooper freebsd_committer 2020-01-15 00:33:50 UTC
I take it back. My REINPLACE_CMD was wrong. This works:

$ git diff ports/lang/
diff --git a/ports/lang/python38/Makefile b/ports/lang/python38/Makefile
index 3bdf1c461846..968cd2b167f5 100644
--- a/ports/lang/python38/Makefile
+++ b/ports/lang/python38/Makefile
@@ -34,9 +34,9 @@ PYTHON_SUFFIX=                ${PYTHON_VER:S/.//g}
 DISABLED_EXTENSIONS=   _sqlite3 _tkinter _gdbm
 CONFIGURE_ARGS+=       --enable-shared --without-ensurepip
-CONFIGURE_ENV+=                OPT="" DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS}"     # Null out OPT to respect user CFLAGS and remove optimizations
+CONFIGURE_ENV+=                OPT=""                                                  # Null out OPT to respect user CFLAGS and remove optimizations
-INSTALL_TARGET=                altinstall                                              # Don't want cloberring of unprefixed files
+INSTALL_TARGET=                altinstall                                              # Don't want clobbering of unprefixed files
 TEST_TARGET=           buildbottest
@@ -132,6 +132,10 @@ post-patch:
 # which introduces hidden dependency and breaks build
        @${REINPLACE_CMD} -e 's|uuid/uuid.h|ignore_&|' ${WRKSRC}/configure
        @${REINPLACE_CMD} -e '/find_library_file/ s|uuid|ignore_&|' ${WRKSRC}/setup.py
+       @${REINPLACE_CMD} -e '/^#\*disabled\*/ s|^#||' ${WRKSRC}/Modules/Setup
+       @${ECHO_CMD} "${DISABLED_EXTENSIONS}" >> ${WRKSRC}/Modules/Setup