Bug 250380 - textproc/py-feedparser: fails to import with lang/python39
Summary: textproc/py-feedparser: fails to import with lang/python39
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Adam Weinberger
URL:
Keywords: needs-qa
Depends on:
Blocks: 250411
  Show dependency treegraph
 
Reported: 2020-10-15 23:39 UTC by Jan Beich
Modified: 2021-04-02 14:46 UTC (History)
6 users (show)

See Also:
adamw: maintainer-feedback? (sbz)
koobs: maintainer-feedback? (adamw)
koobs: merge-quarterly?


Attachments
Patch to 6.0.1 (1.11 KB, patch)
2020-10-17 02:10 UTC, James French
no flags Details | Diff
Poudriere build log (30.94 KB, text/plain)
2020-10-17 02:30 UTC, James French
no flags Details
Patch to 6.0.1, ship sgmllib (ported from Python2) (19.67 KB, patch)
2020-10-17 03:43 UTC, James French
no flags Details | Diff
Poudriere build log (31.11 KB, text/plain)
2020-10-17 03:45 UTC, James French
no flags Details
Patch to 6.0.1, Ship 2to3 sgmllib (ported from Py27) (1.57 KB, patch)
2020-10-28 00:27 UTC, James French
no flags Details | Diff
Patch to 6.0.1, Ship 2to3 sgmllib (ported from Py27) (19.85 KB, patch)
2020-10-28 02:12 UTC, James French
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2020-10-15 23:39:52 UTC
Can you update to >= 6.0 or apply https://github.com/kurtmckee/feedparser/commit/7798957b66c9 ?

$ python3.9
Python 3.9.0 (default, Oct 15 2020, 22:11:05)
[Clang 11.0.0 (git@github.com:llvm/llvm-project.git llvmorg-11.0.0-rc5-0-g60a25 on freebsd13
Type "help", "copyright", "credits" or "license" for more information.
>>> import feedparser
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/feedparser.py", line 93, in <module>
    _base64decode = getattr(base64, 'decodebytes', base64.decodestring)
AttributeError: module 'base64' has no attribute 'decodestring'
Comment 1 James French 2020-10-17 02:10:09 UTC
Created attachment 218819 [details]
Patch to 6.0.1

The attached patch should bring this up to date.
Comment 2 James French 2020-10-17 02:30:21 UTC
Created attachment 218820 [details]
Poudriere build log
Comment 3 Jan Beich freebsd_committer 2020-10-17 02:48:45 UTC
Comment on attachment 218819 [details]
Patch to 6.0.1

Appears broken: py27 build and py3? runtime.

$ make install FLAVOR=py37
$ python3.7
Python 3.7.9 (default, Oct 15 2020, 12:55:07)
[Clang 8.0.1 (tags/RELEASE_801/final 366581)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import feedparser
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/feedparser/__init__.py", line 28, in <module>
    from .api import parse
  File "/usr/local/lib/python3.7/site-packages/feedparser/api.py", line 36, in <module>
    from .html import _BaseHTMLProcessor
  File "/usr/local/lib/python3.7/site-packages/feedparser/html.py", line 31, in <module>
    from .sgml import *
  File "/usr/local/lib/python3.7/site-packages/feedparser/sgml.py", line 30, in <module>
    import sgmllib
ModuleNotFoundError: No module named 'sgmllib'

$ make deinstall FLAVOR=py37
$ make install FLAVOR=py39 BUILD_ALL_PYTHON_FLAVORS=1
$ python3.9
Python 3.9.0 (default, Oct 13 2020, 06:49:46)
[Clang 8.0.1 (tags/RELEASE_801/final 366581)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import feedparser
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/feedparser/__init__.py", line 28, in <module>
    from .api import parse
  File "/usr/local/lib/python3.9/site-packages/feedparser/api.py", line 36, in <module>
    from .html import _BaseHTMLProcessor
  File "/usr/local/lib/python3.9/site-packages/feedparser/html.py", line 31, in <module>
    from .sgml import *
  File "/usr/local/lib/python3.9/site-packages/feedparser/sgml.py", line 30, in <module>
    import sgmllib
ModuleNotFoundError: No module named 'sgmllib'

$ make deinstall FLAVOR=py39
$ make install FLAVOR=py27
[...]
===>  Configuring for py27-feedparser-6.0.1
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 40
    name = f"{name}_{os.getenv('NAME_SUFFIX')}"
                                              ^
SyntaxError: invalid syntax
*** Error code 1
Comment 4 James French 2020-10-17 03:09:19 UTC
Oops - I missed that new dependency, will rectify shortly.

2.7 is expected behaviour as support was dropped in 6.0.0, I'll set it to python 3.6+ in the next patch.
Comment 5 James French 2020-10-17 03:43:29 UTC
Created attachment 218823 [details]
Patch to 6.0.1, ship sgmllib (ported from Python2)

The plot thickens somewhat. Sgmllib was in the Python 2 standard library and was dropped in Python 3. The recommended practice from Feedparser upstream is to 2to3 it and ship it until they can tidy it up (which is what I've done).

Python version set to 3.6+, License set to multi, BSD2ClAUSE (Feedparser) and PFSL (sgmllib).

Not the cleanest solution, but not sure what other options we have other than marking the port broken.
Comment 6 James French 2020-10-17 03:45:32 UTC
Created attachment 218824 [details]
Poudriere build log
Comment 7 Adam Weinberger freebsd_committer 2020-10-27 23:27:41 UTC
For some reason, Sofian was never added to this PR, so it's unclear whether he is even aware of it.

Sofian: I broke sabnzbdplus in quarterly, and this patch needs to be committed to fix it. Can you look it over please? If you're unable to get to this soon then I'll back out the commit in 250411.


Also, James: ${CP} shouldn't generally be used in any of the install phases. Can you please change this to INSTALL_DATA or INSTALL_SCRIPT or whatever it needs to be?
Comment 8 commit-hook freebsd_committer 2020-10-27 23:38:27 UTC
A commit references this bug:

Author: adamw
Date: Tue Oct 27 23:37:38 UTC 2020
New revision: 553512
URL: https://svnweb.freebsd.org/changeset/ports/553512

Log:
  news/sabnzbdplus: Back out r553378

  Feedburner needs to be a hard dependency, and the version currently
  in ports is incompatible.

  PR:		250411, 250380

Changes:
  head/news/sabnzbdplus/Makefile
  head/news/sabnzbdplus/distinfo
  head/news/sabnzbdplus/pkg-plist
Comment 9 commit-hook freebsd_committer 2020-10-27 23:39:29 UTC
A commit references this bug:

Author: adamw
Date: Tue Oct 27 23:38:36 UTC 2020
New revision: 553513
URL: https://svnweb.freebsd.org/changeset/ports/553513

Log:
  MFH: r553512
  Approved by:	portmgr (with hat)

  news/sabnzbdplus: Back out r553378

  Feedburner needs to be a hard dependency, and the version currently
  in ports is incompatible.

  PR:		250411, 250380

Changes:
_U  branches/2020Q4/
  branches/2020Q4/news/sabnzbdplus/Makefile
  branches/2020Q4/news/sabnzbdplus/distinfo
  branches/2020Q4/news/sabnzbdplus/pkg-plist
Comment 10 James French 2020-10-28 00:27:29 UTC
Created attachment 219157 [details]
Patch to 6.0.1, Ship 2to3 sgmllib (ported from Py27)

Uses INSTALL_DATA rather than CP as requested.
Comment 11 James French 2020-10-28 02:12:30 UTC
Created attachment 219162 [details]
Patch to 6.0.1, Ship 2to3 sgmllib (ported from Py27)

sgmllib.py was missing from attachment 219157 [details]
Comment 12 James French 2021-01-26 16:31:49 UTC
Any chance on getting this committed please? I suspect this port is now entirely broken with the removal of Python 2.
Comment 13 Adam Weinberger freebsd_committer 2021-02-10 23:06:51 UTC
Sorry about the delay. I'm overwhelmed with $IRL right now. Any committer who's interested, please feel free to make this happen. FreeNAS's plugin ends up blocking on this PR too.
Comment 14 Kubilay Kocak freebsd_committer freebsd_triage 2021-02-10 23:11:16 UTC
(In reply to Adam Weinberger from comment #13)

I can try to sort this for you today Adam. Can you summarise steps/whats left to do so i don't miss-interpret the history
Comment 15 Kubilay Kocak freebsd_committer freebsd_triage 2021-04-01 02:06:40 UTC
Ping on comment 14

I can get this done tomorrow afternoon if I'm clear whats left
Comment 16 Adam Weinberger freebsd_committer 2021-04-02 14:46:20 UTC
(In reply to Kubilay Kocak from comment #15)
Thanks, koobs. Should be this patch, and then the patch in bug #250411.