Bug 257695 - www/py-requests-toolbelt: Fails to build with Python 3.10: ImportError: cannot import name 'Union' from 'types'
Summary: www/py-requests-toolbelt: Fails to build with Python 3.10: ImportError: canno...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on: 257770
Blocks:
  Show dependency treegraph
 
Reported: 2021-08-08 23:16 UTC by Yasuhiro Kimura
Modified: 2021-09-27 19:59 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (sunpoet)
koobs: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yasuhiro Kimura freebsd_committer 2021-08-08 23:16:02 UTC
While testing Python 3.10 I found build of www/py-requests-toolbelt
fails with 3.10 as default Python.

----------------------------------------------------------------------
=======================<phase: build          >============================
===>  Building for py310-requests-toolbelt-0.9.1
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 41, in <module>
    setup(
  File "/usr/local/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.10/distutils/core.py", line 134, in setup
    ok = dist.parse_command_line()
  File "/usr/local/lib/python3.10/distutils/dist.py", line 483, in parse_command_line
    args = self._parse_command_opts(parser, args)
  File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 1009, in _parse_command_opts
    nargs = _Distribution._parse_command_opts(self, parser, args)
  File "/usr/local/lib/python3.10/distutils/dist.py", line 539, in _parse_command_opts
    cmd_class = self.get_command_class(command)
  File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 848, in get_command_class
    self.cmdclass[command] = cmdclass = ep.load()
  File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2450, in load
    return self.resolve()
  File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.10/site-packages/sphinx/setup_command.py", line 20, in <module>
    from sphinx.application import Sphinx
  File "/usr/local/lib/python3.10/site-packages/sphinx/application.py", line 32, in <module>
    from sphinx.config import Config
  File "/usr/local/lib/python3.10/site-packages/sphinx/config.py", line 23, in <module>
    from sphinx.util import logging
  File "/usr/local/lib/python3.10/site-packages/sphinx/util/__init__.py", line 35, in <module>
    from sphinx.util import smartypants  # noqa
  File "/usr/local/lib/python3.10/site-packages/sphinx/util/smartypants.py", line 33, in <module>
    from sphinx.util.docutils import __version_info__ as docutils_version
  File "/usr/local/lib/python3.10/site-packages/sphinx/util/docutils.py", line 31, in <module>
    from sphinx.util.typing import RoleFunction
  File "/usr/local/lib/python3.10/site-packages/sphinx/util/typing.py", line 34, in <module>
    from types import Union as types_Union
ImportError: cannot import name 'Union' from 'types' (/usr/local/lib/python3.10/types.py)
*** Error code 1

Stop.
----------------------------------------------------------------------

Full build log: https://www.utahime.org/FreeBSD/poudriere/data/logs/bulk/130amd64-default-python310/2021-08-09_07h57m47s/logs/py310-requests-toolbelt-0.9.1.log
Comment 1 Yasuhiro Kimura freebsd_committer 2021-08-11 16:06:07 UTC
According to the investigation the source of the problem is that runtime error happens with textproc/py-sphinx if 3.10 is the default version of Python. I submitted the patch to fix it as bug #257770.
Comment 2 Po-Chuan Hsieh freebsd_committer 2021-09-27 19:59:05 UTC
Close this PR because this is a Sphinx issue which is fixed in bug #257770.