Bug 259797 - devel/py-setuptools_scm: update fail, missing tomli dep
Summary: devel/py-setuptools_scm: update fail, missing tomli dep
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Kai Knoblich
Depends on:
Blocks: 259830
  Show dependency treegraph
Reported: 2021-11-12 13:26 UTC by Ivan Rozhuk
Modified: 2022-02-19 16:43 UTC (History)
3 users (show)

See Also:
kai: maintainer-feedback+

py-setuptools_scm-fix-build-issues-v1.patch (593 bytes, patch)
2021-11-12 13:36 UTC, Kai Knoblich
kai: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2021-11-12 13:26:53 UTC
===>>> The following actions will be taken if you choose to proceed:
	Upgrade py38-setuptools_scm-5.0.2 to py38-setuptools_scm-6.3.2
	Install devel/py-packaging@py38
	Install devel/py-pyparsing@py38
	Install textproc/py-tomli@py38

===>>> Proceed? y/n [y] 

===>>> Starting build for ports that need updating <<<===

===>>> Launching child to install devel/py-setuptools_scm@py38

===>>> All >> devel/py-setuptools_scm@py38 (1/4)

===>>> Currently installed version: py38-setuptools_scm-5.0.2
===>>> Port directory: /usr/ports/devel/py-setuptools_scm@py38

===>>> Starting check for build dependencies
===>>> Gathering dependency list for devel/py-setuptools_scm@py38 from ports
===>>> Starting dependency check
===>>> Checking dependency: devel/ccache-devel
===>>> Checking dependency: devel/py-setuptools@py38
===>>> Checking dependency: lang/python38
===>>> Checking dependency: ports-mgmt/pkg
===>>> Dependency check complete for devel/py-setuptools_scm@py38

===>>> All >> py38-setuptools_scm-5.0.2 (1/4)

===>  Cleaning for py38-setuptools_scm-6.3.2
===>  License MIT accepted by the user
===>   py38-setuptools_scm-6.3.2 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by py38-setuptools_scm-6.3.2 for building
===>  Extracting for py38-setuptools_scm-6.3.2
=> SHA256 Checksum OK for setuptools_scm-6.3.2.tar.gz.
===>  Patching for py38-setuptools_scm-6.3.2
===>  Applying FreeBSD patches for py38-setuptools_scm-6.3.2 from /usr/ports/devel/py-setuptools_scm/files
===>   py38-setuptools_scm-6.3.2 depends on package: py38-setuptools>0 - found
===>   py38-setuptools_scm-6.3.2 depends on file: /usr/local/bin/python3.8 - found
===>   py38-setuptools_scm-6.3.2 depends on file: /usr/local/bin/ccache - found
===>  Configuring for py38-setuptools_scm-6.3.2
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 58, in <module>
  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__
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 801, in finalize_options
  File "/tmp/ports/usr/ports/devel/py-setuptools_scm/work-py38/setuptools_scm-6.3.2/src/setuptools_scm/integration.py", line 90, in infer_version
    config = Configuration.from_file(dist_name=dist_name)
  File "/tmp/ports/usr/ports/devel/py-setuptools_scm/work-py38/setuptools_scm-6.3.2/src/setuptools_scm/config.py", line 181, in from_file
    defn = _load_toml(data)
  File "/tmp/ports/usr/ports/devel/py-setuptools_scm/work-py38/setuptools_scm-6.3.2/src/setuptools_scm/config.py", line 53, in _lazy_tomli_load
    from tomli import loads
ModuleNotFoundError: No module named 'tomli'
*** Error code 1

make[1]: stopped in /usr/ports/devel/py-setuptools_scm
*** Error code 1

make: stopped in /usr/ports/devel/py-setuptools_scm

===>>> make build failed for devel/py-setuptools_scm@py38
===>>> Aborting update

===>>> Update for devel/py-setuptools_scm@py38 failed
===>>> Aborting update
Comment 1 Kai Knoblich freebsd_committer 2021-11-12 13:36:42 UTC
Created attachment 229448 [details]

(In reply to Ivan Rozhuk from comment #0)

Hi Ivan, thanks for the report. Can you please try the attached patch?
Comment 2 Ivan Rozhuk 2021-11-12 13:47:39 UTC
(In reply to Kai Knoblich from comment #1)

Yes, this patch fix build issue.
Thanks for quick response!
Comment 3 Ivan Rozhuk 2021-11-12 13:54:47 UTC
Fix work in case TOML option is set, but port fail to build if option is UNSET.
Comment 4 commit-hook freebsd_committer 2021-11-12 13:56:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0ff406ab9fe97470ebdab5ea55fb5b201f7d332b

commit 0ff406ab9fe97470ebdab5ea55fb5b201f7d332b
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2021-11-12 13:53:22 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2021-11-12 13:54:20 +0000

    devel/py-setuptools_scm: Fix update with portmaster

    * In environments where devel/py-setuptools_scm is already installed
      the port textproc/py-tomli is required during build time.

    PR:             259797
    Reported by:    Ivan Rozhuk <rozhuk.im@gmail.com>

 devel/py-setuptools_scm/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 5 commit-hook freebsd_committer 2021-11-12 14:17:37 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6fea29c9fcfe61c89fbbac3035ca1b7174609789

commit 6fea29c9fcfe61c89fbbac3035ca1b7174609789
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2021-11-12 14:15:26 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2021-11-12 14:15:26 +0000

    devel/py-setuptools_scm: Fix portmaster build with option TOML unset

    * The port textproc/py-tomli is required in environments, where
      devel/py-setuptools_scm is already installed, even if the TOML option
      is unset.

    PR:             259797
    Reported by:    Ivan Rozhuk <rozhuk.im@gmail.com>

 devel/py-setuptools_scm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 6 Kai Knoblich freebsd_committer 2021-11-12 14:21:11 UTC
(In reply to Ivan Rozhuk from comment #3)

Thank you for the quick feedback and the info regarding the TOML option. I converted textproc/py-tomli into an unconditional BUILD_DEPENDS in the second commit.

I'll leave this bug open a few hours/days for reference.
Comment 7 Ivan Rozhuk 2021-11-12 15:52:04 UTC
System with unset TOML upgraded OK.

PS: are you sure that port will work without installed toml packet?
I do not use these ports and can not test it.
Comment 8 Kai Knoblich freebsd_committer 2021-11-12 16:42:55 UTC
(In reply to Ivan Rozhuk from comment #7)

The TOML option is set as default for good reason and should not be deactivated (which is also indicated in the description).

Apart from that the "setup.py", "setup.cfg" and "pyproject.toml" files are somewhat out of sync with the 6.3.2 release.  With the next release of devel/py-setuptools_scm the textproc/py-tomli dependency in "setup.py" will be converted into an unconditional dependency:

Comment 9 Cy Schubert freebsd_committer 2021-11-15 00:24:33 UTC
Same error as PR/259830.
Comment 10 Cy Schubert freebsd_committer 2021-11-15 00:25:26 UTC
Affects amd64. My i386 poudriere builds are good, so far.
Comment 11 Kubilay Kocak freebsd_committer freebsd_triage 2021-11-25 05:59:54 UTC
Comment 12 Kubilay Kocak freebsd_committer freebsd_triage 2021-11-25 06:01:18 UTC
@Kai I'm -1 on unconditional dependencies, which is a workaround, over the correct permanent resolution: packages that declare dependencies on other Python packages extras[requires] need to depend on those (transitive) dependencies directly
Comment 13 Kai Knoblich freebsd_committer 2021-11-25 18:31:20 UTC
(In reply to Kubilay Kocak from comment #12)

As it currently looks, the next release of devel/py-setuptools_scm will have the textproc/py-tomli is an unconditional requirement in:

- pyproject.toml
- setup.cfg

The "toml" option in "setup.py" will then only have devel/py-setuptools thus the TOML option in the port's Makefile would be obsolete.

So I hope that the 6.3.3 will be released in the next few days/weeks because it would save everyone a lot of work regarding the transitional dependencies of the consumers of devel/py-setuptools_scm.
Comment 14 Michael Büker 2021-11-28 12:56:29 UTC
Thank you for clearing this up. I was seeing near-incomprehensible build failures with various python packages in poudriere. In the end, it came down to having the TOML options disabled on py-setuptools_scm for no good reason. Re-enabling it fixed the issues.
Comment 15 commit-hook freebsd_committer 2022-02-12 10:45:11 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=86eb4911c16c3feb076d8f2c6c10d1561b9ae7ca

commit 86eb4911c16c3feb076d8f2c6c10d1561b9ae7ca
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2022-02-12 10:41:02 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2022-02-12 10:41:02 +0000

    devel/py-setuptools_scm: Update to 6.4.2

    * Fold the TOML option because its dependency is no longer an optional
      requirement as noted in "setup.{py,cfg}".  This should also fix some
      cases with build errors where the TOML option was disabled. [1]

    Changelog since 6.3.2:


    PR:             259797 [1], 261698 [1]
    MFH:            No (feature release)

 devel/py-setuptools_scm/Makefile                       | 18 +++++++++---------
 devel/py-setuptools_scm/distinfo                       |  6 +++---
 .../files/patch-testing_test__integration.py (new)     | 13 +++++++++++++
 3 files changed, 25 insertions(+), 12 deletions(-)
Comment 16 Kai Knoblich freebsd_committer 2022-02-12 10:56:07 UTC
As noted in comment #13 the newer release of devel/py-setuptools_scm have textproc/py-tomli as a fixed dependency. This issue and other issues with ports that require "setuptools_scm[toml]" should be fixed.

I'll leave this bug a few days open for reference.
Comment 17 Kai Knoblich freebsd_committer 2022-02-19 16:40:01 UTC
Close this bug as the reported issue is resolved with the 6.4.2 release of devel/py-setuptools_scm.