FS#74725 - Last python-setuptools update breaks Firefox builds

Attached to Project: Arch Linux
Opened by Emilio Cobos Álvarez (ecobos) - Friday, 13 May 2022, 11:31 GMT
Last edited by Antonio Rojas (arojas) - Sunday, 19 June 2022, 09:38 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: After updating python-setuptools to 1:60.0.0-1, I can't build Firefox anymore, with an exception that looks like:

Traceback (most recent call last):
File "/home/emilio/src/moz/gecko-2/mach", line 96, in <module>
main(sys.argv[1:])
File "/home/emilio/src/moz/gecko-2/mach", line 88, in main
mach = check_and_get_mach(os.path.dirname(os.path.realpath(__file__)))
File "/home/emilio/src/moz/gecko-2/mach", line 35, in check_and_get_mach
return load_mach(dir_path, mach_path)
File "/home/emilio/src/moz/gecko-2/mach", line 21, in load_mach
return mach_initialize.initialize(dir_path)
File "/home/emilio/src/moz/gecko-2/build/mach_initialize.py", line 153, in initialize
_activate_python_environment(
File "/home/emilio/src/moz/gecko-2/build/mach_initialize.py", line 93, in _activate_python_environment
from mach.site import MachSiteManager
File "/home/emilio/src/moz/gecko-2/python/mach/mach/site.py", line 26, in <module>
from mach.requirements import (
File "/home/emilio/src/moz/gecko-2/python/mach/mach/requirements.py", line 7, in <module>
from packaging.requirements import Requirement
File "/home/emilio/src/moz/gecko-2/third_party/python/packaging/packaging/requirements.py", line 24, in <module>
from .markers import MARKER_EXPR, Marker
File "/home/emilio/src/moz/gecko-2/third_party/python/packaging/packaging/markers.py", line 25, in <module>
from .specifiers import InvalidSpecifier, Specifier
File "/home/emilio/src/moz/gecko-2/third_party/python/packaging/packaging/specifiers.py", line 14, in <module>
from .utils import canonicalize_version
File "/home/emilio/src/moz/gecko-2/third_party/python/packaging/packaging/utils.py", line 9, in <module>
from .tags import Tag, parse_tag
File "/home/emilio/src/moz/gecko-2/third_party/python/packaging/packaging/tags.py", line 7, in <module>
import distutils.util
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 674, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "/usr/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 92, in create_module
return importlib.import_module('setuptools._distutils')
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "/usr/lib/python3.10/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3102, in <module>
class RequirementParseError(packaging.requirements.InvalidRequirement):
AttributeError: module 'packaging' has no attribute 'requirements'

Additional info:

Downgrading to 1:59.8.0-1 "fixes" it. From the stack, I suspect this has something to do with Firefox importing a third-party "packaging" module and that getting imported instead of the built-in one from `pkg_resources`. Can dig a bit more.

Steps to reproduce:

* Have a firefox checkout as described in https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
* ./mach build
This task depends upon

Closed by  Antonio Rojas (arojas)
Sunday, 19 June 2022, 09:38 GMT
Reason for closing:  Fixed
Comment by Andrew Crerar (andrewSC) - Friday, 13 May 2022, 14:50 GMT
FWIW someone's opened an upstream bug as well: https://bugzilla.mozilla.org/show_bug.cgi?id=1769205
Comment by Imran Iqbal (myii) - Friday, 13 May 2022, 16:47 GMT
Had a related problem with https://archlinux.org/packages/community/any/salt/ -- up to `1:59.8.0-1` has been working fine. However, with `1:60.0.0-1`, hit this traceback:

```
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "/usr/lib/python3.10/site-packages/salt/__init__.py", line 138, in <module>
import salt._logging # isort:skip
File "/usr/lib/python3.10/site-packages/salt/_logging/__init__.py", line 12, in <module>
from salt._logging.impl import (
File "/usr/lib/python3.10/site-packages/salt/_logging/impl.py", line 505, in <module>
import pip._internal.utils._log as pip_log_module # pylint: disable=no-name-in-module,import-error
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1002, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 945, in _find_spec
File "/usr/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 83, in find_spec
return method()
File "/usr/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 104, in spec_for_pip
if self.pip_imported_during_build():
File "/usr/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 115, in pip_imported_during_build
return any(
File "/usr/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 116, in <genexpr>
frame.f_globals['__file__'].endswith('setup.py')
KeyError: '__file__'
```

Tracked it down to this issue, where the comment I've linked suggested that `60.0.3` could fix the problem:

* https://github.com/pypa/setuptools/issues/2941#issuecomment-998536282

In the meantime, `1:60.0.1-1` was released, which still wasn't working. But there's just been an update to `1:60.0.3-1`, which sure enough, has fixed the problem at my end.

Perhaps this will resolve the broken Firefox builds as well.

Loading...