Hi, everyone.
TL;DR I think I came up with a feasible plan towards cleanly removing dev-python/namespace-* packages that aren't technically needed anymore
with modern versions of Python.
What are namespace packages? Let's take "zope" as an example.
Normally, various subpackages like "zope.interface" and
"zope.configuration" would have all to be present in a single directory,
that is inside the "zope" package. However, if "zope" is made a
namespace package, its subpackages can be loaded from different
locations. Notably, in order to test zope.configuration prior to
installing it, we load it from build tree but its dependency
zope.interface from system site-packages.
Historically, for this to work, the "zope/__init__.py" had to specify
some magic incantations. On Gentoo, we've added dev-python/namespace-*
that installed these magical "__init__.py" files and made all
subpackages (e.g. dev-python/zope-*) depend on it.
However, Python 3.3 introduced PEP 420 implicit namespaces that made
magical incantations unnecessary -- if "zope" didn't include
"__init__.py", it was implicitly treated as a namespace. Unfortunately, there were some interoperability issues between the two kinds of magical incantations and implicit namespaces. So while we were able to retire pkgutil-style namespaces, setuptools-style namespaces remained.
I think we can change that now.
I've done some experiments, particularly with dev-python/zope-interface
and dev-python/zope-configuration. If nobody finds a problem with this solution, I think we can aim to bump all packages relying on namespaces
and retire them in 1-2 months.
The rough idea is to remove RDEP on dev-python/namespace-* from
the package, and updating python_test to use a temporary pkgutil-style incantation (yes, for setuptools-style packages), e.g.:
```
python_compile() {
distutils-r1_python_compile
find "${BUILD_DIR}" -name '*.pth' -delete || die
}
python_test() {
cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
# this is needed to keep the tests working while
# dev-python/namespace-zope is still installed
cat > zope/__init__.py <<-EOF || die
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
EOF
eunittest
rm zope/__init__.py || die
}
```
...
WDYT?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (3 / 13) |
Uptime: | 46:23:41 |
Calls: | 10,395 |
Calls today: | 3 |
Files: | 14,066 |
Messages: | 6,417,272 |