As mentioned in a thread in ports@freebsd.org, the problem seems to be related with outdated versions of py-setuptools/py-setuptools_scm On Mon, 18 Oct 2021 12:51:05 +0200, Xavier Humbert wrote: > [root@numenor ~]# cd /usr/ports/devel/py-platformdirs/ > [root@numenor py-platformdirs]# make > ===> py38-platformdirs-2.4.0 depends on package: py38-setuptools>0 - > found > ===> py38-platformdirs-2.4.0 depends on file: > /usr/local/bin/python3.8 - found > ===> Configuring for py38-platformdirs-2.4.0 > Traceback (most recent call last): > File "<string>", line 1, in <module> > File "setup.py", line 3, 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 > 801, in finalize_options > ep(self) > File > "/usr/local/lib/python3.8/site-packages/setuptools_scm/integration.py", > line 48, in infer_version > dist.metadata.version = _get_version(config) > File > "/usr/local/lib/python3.8/site-packages/setuptools_scm/__init__.py", > line 156, in _get_version > dump_version( > File > "/usr/local/lib/python3.8/site-packages/setuptools_scm/__init__.py", > line 84, in dump_version > fp.write(template.format(version=version)) > KeyError: 'version_tuple' OK, the build error is caused by devel/py-setuptools_scm. It works if I - update devel/py-setuptools to version 58.2.0 - update devel/py-setuptools_scm to version 6.3.2 - install texproc/py-tomli Tested with python39 only and it possibly will break other ports. Can you open a PR at https://bugs.freebsd.org? Maybe python@ or sunpoet@ can help. Regards, Xavier
Did a certain port version (this port, or a dependency) update cause this issue?
Upstream declares as build dependencies: [build-system] requires = ["setuptools >= 44", "wheel >= 0.30", "setuptools_scm[toml]>=5"] This port depends on setuptools_scm > 5 where the current portversion is 4.x It's unlikely that all Python ports dependening on setuptools_scm will support both 4/5 versions, likely necessitating creation of a setuptools_scm4 for those ports to depend on. @Sunpoet Can you create a separate issue to track that ^ please Regarding toml, Python packages depending on optional dependencies of their dependencies, *must* [1] depend on those transitive/optional dependencies directly. This is the same issue as bug 256872 [1] https://wiki.freebsd.org/Python/PortsPolicy#Optional_.2F_Transitive_Dependencies
(In reply to xavier from comment #0) Thanks for reporting. I'll check that. I'm not sure why I did not get pkg-fallout mail of this port. (In reply to Kubilay Kocak from comment #2) Kai has submitted a 5.0.2 update in bug #259420. I'll submit any PR for exp-run of latest version (6.3.2). > Regarding toml, Python packages depending on optional dependencies of their dependencies, *must* [1] depend on those transitive/optional dependencies directly. This is the same issue as bug 256872 In this case, we have 2 choices: - Add TOML dependency (py-toml now and py-tomli for 6+) to RUN_DEPENDS unconditionally. Add a comment to declare that [toml] is added. - Keep TOML option and change its description to inform users that disabling it may lead to build failure of dependent ports. If people disable it, it's their choice to get build failure.
(In reply to Po-Chuan Hsieh from comment #3) > Thanks for reporting. I'll check that. > I'm not sure why I did not get pkg-fallout mail of this port. The issue occurs only if devel/py-setuptools_scm is already present in the environment. You can reproduce it by adding devel/py-setuptools_scm to BUILD_DEPENDS and devel/py-platformdirs should fail in the "configure" phase. (In reply to Po-Chuan Hsieh from comment #3) (In reply to Kubilay Kocak from comment #2) > In this case, we have 2 choices: > - Add TOML dependency (py-toml now and py-tomli for 6+) to RUN_DEPENDS unconditionally. Add a comment to declare that [toml] is added. > - Keep TOML option and change its description to inform users that disabling it may lead to build failure of dependent ports. If people disable it, it's their choice to get build failure. I would try to keep the TOML option and change its description first and would do so like with the 5.0.2 update for devel/py-setuptools_scm. As a last resort, if issues are still reported about the TOML option, we can fold the TOML option and add it with a appropriate comment to RUN_DEPENDS.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=33a4a1d205bd4323d330b7cc5f39925e5b3e811c commit 33a4a1d205bd4323d330b7cc5f39925e5b3e811c Author: Kai Knoblich <kai@FreeBSD.org> AuthorDate: 2021-10-26 10:08:35 +0000 Commit: Kai Knoblich <kai@FreeBSD.org> CommitDate: 2021-10-26 10:08:35 +0000 devel/py-setuptools_scm: Update to 5.0.2 * Use this release as an intermediate step before the port is updated to the 6.x release, because it contains mostly bugfixes and is also required for the 2021Q4 branch. The latter is necessary in order to be able to build certain ports successfully if devel/py-setuptools_scm is already present in the build environment. For instance, devel/py-platformdirs, which can be built without it but if devel/py-setuptools is already installed, it requires the 5.x release of it for build. [1] * Also adjust the description of the TOML option slightly with an appropriate warning to avoid build issues related to parsing "pyproject.toml" files during setup. [2] Changelog since 4.1.2: https://github.com/pypa/setuptools_scm/blob/v5.0.2/CHANGELOG.rst PR: 259381 [2], 259420 (both related) MFH: 2021Q4 (after 1 week) [1] devel/py-setuptools_scm/Makefile | 5 ++--- devel/py-setuptools_scm/distinfo | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-)
A commit in branch 2021Q4 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=5bfd0738fbe861b2a371801dbe7f12daf5d93f33 commit 5bfd0738fbe861b2a371801dbe7f12daf5d93f33 Author: Kai Knoblich <kai@FreeBSD.org> AuthorDate: 2021-10-26 10:08:35 +0000 Commit: Kai Knoblich <kai@FreeBSD.org> CommitDate: 2021-11-02 11:53:57 +0000 devel/py-setuptools_scm: Update to 5.0.2 * Use this release as an intermediate step before the port is updated to the 6.x release, because it contains mostly bugfixes and is also required for the 2021Q4 branch. The latter is necessary in order to be able to build certain ports successfully if devel/py-setuptools_scm is already present in the build environment. For instance, devel/py-platformdirs, which can be built without it but if devel/py-setuptools is already installed, it requires the 5.x release of it for build. [1] * Also adjust the description of the TOML option slightly with an appropriate warning to avoid build issues related to parsing "pyproject.toml" files during setup. [2] Changelog since 4.1.2: https://github.com/pypa/setuptools_scm/blob/v5.0.2/CHANGELOG.rst PR: 259381 [2], 259420 (both related) MFH: 2021Q4 (after 1 week) [1] (cherry picked from commit 33a4a1d205bd4323d330b7cc5f39925e5b3e811c) devel/py-setuptools_scm/Makefile | 5 ++--- devel/py-setuptools_scm/distinfo | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-)