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

From: Stefan Esser <se_at_freebsd.org>
Date: Sat, 04 Dec 2021 22:40:18 UTC
Am 04.12.21 um 14:19 schrieb Stefan Esser:
> Am 04.12.21 um 10:51 schrieb Alexey Dokuchaev:
>> On Sat, Dec 04, 2021 at 05:45:55PM +0800, Po-Chuan Hsieh wrote:
>>> The python dependencies are all correct.
>>> py-pyparsing DOES NOT REQUIRE py-packaging.
> 
> True, but apparently only when building in a clean jail.
> 
>> I concur; just built and packaged those ports successfully in my tinderbox
>> against Python versions 3.8 and 3.9.
> 
> Yes, it works when building with poudriere, but no, it does not
> work with a plain "make" on a system with other Python ports
> already installed.
> 
> In order to observe the issue, I had to delete the two packages
> with "pkg delete -f". They cannot be re-installed from a port
> using a plain "make" on the base system, thereafter.

A personal mail from Kai Knoblich mentioned PR 259981:

  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259981

The issue is that py-setuptools_scm depends on py-packaging and
py-pyparsing, and it is used for all dependency checks when a
ports setup.py is executed.

IMHO, a failure of setuptools_scm due to a missing run dependency
should lead to a fall-back mode that works as if setuptools_scm
was not installed at all.

Less than 70 of 7070 ports in devel/py-* have a direct dependency
on py-setuptools_scm.

But as soon as py-setuptools_scm is installed, it is invoked
even for ports that do not depend on it (like py-packaging and
py-pyparsing).

And if it fails due to failed imports, then it prevents configuring
of ports *that do not actually depend on it*.

If a execution of py-setuptools_scm was fatal only for ports that
have a direct dependency on it, then the build of py-packaging
and py-pyparsing could succeed, even with py-setuptools_scm not
usable.

I have tried all permutations of parameters in the following
command:

# portmaster devel/py-black devel/py-pyparsing devel/py-packaging \
	devel/py-setuptools_scm

And this command succeed every time and for each permutation that
I tried, independently of whether these ports were installed or not
at that time.

But if only py-pyparsing or py-packaging is missing, then the
existence of py-setuptools_scm prevents their installation from
a port, as described in this PR.

Again: IMHO a failure to execute py-setuptools_scm should not be
fatal, except for ports that directly depend on it. I have no
idea whether that can easily be achieved, but I do not see any
other solution.

Can an option be passed to a port's setup.py to prevent it from
trying to invoke py-setuptools_scm? (It would suffice to pass
such an option for builds of py-pyparsing and py-packaging.)

And again: this is not a portmaster issue. It affects building of
ports with plain make in the same way, if one of the two packages
py-setuptools_scm depends on has been lost.

Regards, STefan