Bug 250380 - textproc/py-feedparser: fails to import with lang/python39
Summary: textproc/py-feedparser: fails to import with lang/python39
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks: 250411
  Show dependency treegraph
 
Reported: 2020-10-15 23:39 UTC by Jan Beich
Modified: 2020-10-17 03:45 UTC (History)
3 users (show)

See Also:


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

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