On 2021/01/26 18:59, Christian Weisgerber wrote:
> textproc/py-sphinx,python3 failed to build in my latest amd64 bulk
> build.
> 
> ModuleNotFoundError: No module named 'setuptools_scm'

If the setuptools_scm plugin is present at the start of build, setuptools
adds a hook via setuptools.finalize_distribution_options. Here setuptools_scm
is pulled in by another port so is present on the build machine, sphinx
configures/builds and somewhere during that setuptools_scm was junked,
but it still tries to run the hook.

Adding setuptools_scm as a dependency to ports where we notice the problem
shouldn't be done as it will just move the problem elsewhere (the more
ports that have it as a listed dep, the more we'll run into it).

One method would be to modify setuptools to prevent picking up plugins
automatically (similar to pytest's PYTEST_DISABLE_PLUGIN_AUTOLOAD - hey
Kurt, did you know about that one?). I think we'd want upstream support
if we did that, I imagine it will be a pain to maintain.

Another option, we could do this. It's not very nice because it will
turn on nojunk for pretty much everything Python, but it is simple.
Thoughts?


Index: python.port.mk
===================================================================
RCS file: /cvs/ports/lang/python/python.port.mk,v
retrieving revision 1.124
diff -u -p -r1.124 python.port.mk
--- python.port.mk      29 Dec 2020 23:59:06 -0000      1.124
+++ python.port.mk      26 Jan 2021 19:42:47 -0000
@@ -132,6 +132,11 @@ MODPY_SETUPUTILS = Yes
 TEST_TARGET ?= test
 _MODPY_USERBASE =
 _MODPY_PRE_BUILD_STEPS += ;${MODPY_CMD} egg_info || true
+# Setuptools opportunistically picks up plugins. If it picks one up that
+# uses finalize_distribution_options (usually setuptools_scm), junking
+# that plugin will cause failure at the end of build.
+# In the absence of a targetted means of disabling this, use a big hammer:
+DPB_PROPERTIES +=      nojunk
 .else
 # Try to detect the case where a port will build regardless of setuptools
 # but the final plist will be different if it's present.

Reply via email to