Bug 250380

Summary: textproc/py-feedparser: fails to import with lang/python39
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Adam Weinberger <adamw>
Status: New ---    
Severity: Affects Only Me CC: adamw, james, python, sbz
Priority: --- Flags: adamw: maintainer-feedback? (sbz)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 250411    
Attachments:
Description Flags
Patch to 6.0.1
none
Poudriere build log
none
Patch to 6.0.1, ship sgmllib (ported from Python2)
none
Poudriere build log
none
Patch to 6.0.1, Ship 2to3 sgmllib (ported from Py27)
none
Patch to 6.0.1, Ship 2to3 sgmllib (ported from Py27) none

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]