Re: devel/py-pyparsing and devel/py-packaging have circular dependency

From: Stefan Esser <se_at_freebsd.org>
Date: Sat, 04 Dec 2021 12:46:08 UTC
Am 04.12.21 um 10:45 schrieb Po-Chuan Hsieh:
> This is totally a portmaster issue (wrong order of build, install and deinstall).
> The python dependencies are all correct.

Sorry, no, and please stop spreading this FUD and utter nonsense
about portmaster being at fault!

The error messages quoted by Iwao-san were obtained running a plain
"make" in both of the port directories.

> py-pyparsing DOES NOT REQUIRE py-packaging.

In poudriere it does not. But it does when building the port on my
system with other Python ports already installed:

-----------------------------------------------------------------------
$ cd /usr/ports/devel/py-pyparsing
$ make all
===>  License MIT accepted by the user
===>   py38-pyparsing-3.0.6 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by py38-pyparsing-3.0.6 for building
===>  Extracting for py38-pyparsing-3.0.6
=> SHA256 Checksum OK for pyparsing-3.0.6.tar.gz.
===>  Patching for py38-pyparsing-3.0.6
===>   py38-pyparsing-3.0.6 depends on package: py38-setuptools>0 - found
===>   py38-pyparsing-3.0.6 depends on file: /usr/local/bin/python3.8 - found
===>  Configuring for py38-pyparsing-3.0.6
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 23, in <module>
    setup(  # Distribution meta-data
  File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line
153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.8/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 455,
in __init__
    _Distribution.__init__(self, {
  File "/usr/local/lib/python3.8/distutils/dist.py", line 292, in __init__
    self.finalize_options()
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 800,
in finalize_options
    for ep in sorted(eps, key=by_order):
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 799,
in <lambda>
    eps = map(lambda e: e.load(), pkg_resources.iter_entry_points(group))
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line
2449, in load
    self.require(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line
2472, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line
772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'packaging>=20.0' distribution was not
found and is required by the application
*** Error code 1

Stop.
make[1]: stopped in /usr/git/ports/devel/py-pyparsing
*** Error code 1

Stop.
make: stopped in /usr/git/ports/devel/py-pyparsing
-----------------------------------------------------------------------

And, with similar outcoming for devel/py-packaging:

-----------------------------------------------------------------------
/usr/git/ports/devel/py-packaging
root@StefanEsser> make -DNO_DEPENDS
===>  Configuring for py38-packaging-21.3
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 40, in <module>
    setup(
  File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line
153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.8/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 455,
in __init__
    _Distribution.__init__(self, {
  File "/usr/local/lib/python3.8/distutils/dist.py", line 292, in __init__
    self.finalize_options()
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 800,
in finalize_options
    for ep in sorted(eps, key=by_order):
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 799,
in <lambda>
    eps = map(lambda e: e.load(), pkg_resources.iter_entry_points(group))
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line
2449, in load
    self.require(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line
2472, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line
772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pyparsing!=3.0.5,>=2.0.2' distribution
was not found and is required by packaging
*** Error code 1

Stop.
make: stopped in /usr/git/ports/devel/py-packaging
-----------------------------------------------------------------------

No portmaster involved, and devel/py-pyparsing definitely depends
on devel/py-packaging.

Apparently, both are BUILD_DEPENDS of each other, but apparently due
to some other Python package being present in the build environment.

I have 275 py38-* packages installed on my system, and I do not know how
to identify the one that adds the dependency on py-packaging.

And I have just rebuilt these 275 py39- packages on my system using
portmaster and this did not fix the issue.

I can build the packages with poudriere (and with my local version of
portmaster that supports building in a clean chroot jail), but not
directly on my system with lots of other packages installed.

Regards, STefan