Bug 266156 - devel/py-poetry2setup: Fix issue with latest update of devel/py-poetry-core
Summary: devel/py-poetry2setup: Fix issue with latest update of devel/py-poetry-core
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-01 12:26 UTC by Palle Girgensohn
Modified: 2022-09-04 05:13 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Palle Girgensohn freebsd_committer freebsd_triage 2022-09-01 12:26:03 UTC
notus-scanner fails to build in poudriere with a fresh ports tree:

ImportError: cannot import name 'Path' from 'poetry.core.utils._compat' (/usr/local/lib/python3.9/site-packages/poetry/core/utils/_compat.py)


------

NOTE:
Please read /usr/local/share/doc/ccache/ccache-howto-freebsd.txt for
information on using ccache with FreeBSD ports and src.
===>   py39-notus-scanner-22.4.1 depends on file: /usr/local/bin/ccache - found
===>   Returning to build of py39-notus-scanner-22.4.1
===========================================================================
=======================<phase: lib-depends    >============================
===========================================================================
=>> Recording filesystem state for prebuild... done
=======================<phase: configure      >============================
===>   py39-notus-scanner-22.4.1 depends on package: py39-poetry2setup>0 - found
===>   py39-notus-scanner-22.4.1 depends on package: py39-setuptools>=63.1.0 - found
===>   py39-notus-scanner-22.4.1 depends on file: /usr/local/bin/python3.9 - found
===>   py39-notus-scanner-22.4.1 depends on file: /usr/local/bin/ccache - found
===>  Configuring for py39-notus-scanner-22.4.1
Traceback (most recent call last):
  File "/usr/local/bin/poetry2setup", line 33, in <module>
    sys.exit(load_entry_point('poetry2setup==1.0.0', 'console_scripts', 'poetry2setup')())
  File "/usr/local/bin/poetry2setup", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/lib/python3.9/importlib/metadata.py", line 86, in load
    module = import_module(match.group('module'))
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/lib/python3.9/site-packages/poetry2setup.py", line 3, in <module>
    from poetry.core.utils._compat import Path
ImportError: cannot import name 'Path' from 'poetry.core.utils._compat' (/usr/local/lib/python3.9/site-packages/poetry/core/utils/_compat.py)
*** Error code 1

Stop.
make: stopped in /usr/ports/security/py-notus-scanner
build of security/py-notus-scanner | py39-notus-scanner-22.4.1 ended at Thu Sep  1 14:16:37 CEST 2022
build time: 00:00:09
Comment 1 Jose Alonso Cardenas Marquez freebsd_committer freebsd_triage 2022-09-01 18:51:59 UTC
Hi, it is not a problem related to py-notus-scanner. It seems like a py-poetry-core/py-poetry2setup issue. If you see py-poetry-core was updated to 1.1.0 yesterday.
Comment 2 Jose Alonso Cardenas Marquez freebsd_committer freebsd_triage 2022-09-01 20:32:36 UTC
It could fix issue withh py-poetry2setup

--- a/devel/py-poetry2setup/Makefile
+++ b/devel/py-poetry2setup/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=      poetry2setup
 PORTVERSION=   1.0.0
+PORTREVISION=  1
 CATEGORIES=    devel python
 MASTER_SITES=  CHEESESHOP
 PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@@ -10,11 +11,15 @@ COMMENT=    Convert python-poetry to setup.py
 LICENSE=       MIT
 LICENSE_FILE=  ${WRKSRC}/LICENSE
 
-RUN_DEPENDS=   ${PYTHON_PKGNAMEPREFIX}poetry-core>=1.0.0<2.0.0:devel/py-poetry-core@${PY_FLAVOR}
+RUN_DEPENDS=   ${PYTHON_PKGNAMEPREFIX}poetry-core>=1.0.0<2.0.0:devel/py-poetry-core@${PY_FLAVOR} \
+               ${PYTHON_PKGNAMEPREFIX}pathlib2>0:devel/py-pathlib2@${PY_FLAVOR}
 
 USES=          python:3.5+
 USE_PYTHON=    autoplist concurrent distutils
 
 NO_ARCH=       yes
 
+post-patch:
+       ${REINPLACE_CMD} -i "" -e 's|poetry.core.utils._compat|pathlib2|g' ${WRKSRC}/poetry2setup.py
+
 .include <bsd.port.mk>
Comment 3 Jose Alonso Cardenas Marquez freebsd_committer freebsd_triage 2022-09-01 20:36:31 UTC
Please, don't forget bump PORTREVISION of dependant ports. Thanks!
Comment 4 Palle Girgensohn freebsd_committer freebsd_triage 2022-09-02 08:33:17 UTC
Hi!

@acm will you commit or do you want me to do it?

Also, do we really need to bump dependant ports? It seems to me it doesn't even build? Which are the dependant ports?
Comment 5 Jose Alonso Cardenas Marquez freebsd_committer freebsd_triage 2022-09-03 23:01:24 UTC
(In reply to Palle Girgensohn from comment #4)
I think we need sunpoet@ approve it or have you a special commit bit/flag for do that? I think the best is bump PORTREVISION I knew it is a good practice.


py-notus-scanner and py-ospd-openvas will need bump PORTREVISION
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-09-04 05:02:34 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=45f1af52a8145dda35dbfd05a63d5735f8baed66

commit 45f1af52a8145dda35dbfd05a63d5735f8baed66
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-09-04 05:01:40 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-09-04 05:01:40 +0000

    devel/py-poetry2setup: Fix runtime after 002028b994f0de5ced1431bafbe20263c40ce3a3 (py-poetry-core 1.1.0 update)

    - Bump PORTREVISION for package change

    PR:             266156
    Reported by:    girgen

 devel/py-poetry2setup/Makefile                          |  1 +
 devel/py-poetry2setup/files/patch-poetry2setup.py (new) | 10 ++++++++++
 2 files changed, 11 insertions(+)
Comment 7 Po-Chuan Hsieh freebsd_committer freebsd_triage 2022-09-04 05:13:04 UTC
(In reply to Jose Alonso Cardenas Marquez from comment #5)

In fact, I did not notice that py-poetry2setup has dependent ports till now.

People won't have a package if they have a broken py-poetry2setup, therefore the bump is not needed.
Comment 8 Po-Chuan Hsieh freebsd_committer freebsd_triage 2022-09-04 05:13:19 UTC
Committed. Thanks!