Created
October 7, 2023 07:18
-
-
Save ewenmcneill/c30b58a83e4768e537eaa35f2b74829e to your computer and use it in GitHub Desktop.
Ubuntu 20.04 LTS python 3.9 "glasgow --version" crash while enumerating plugin requirements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ewen@parthenon:~$ glasgow --version | |
> /src/glasgow/software/glasgow/support/plugin.py(18)_entry_points() | |
-> for distribution in importlib.metadata.distributions(): | |
(Pdb) b 25 | |
Breakpoint 1 at /src/glasgow/software/glasgow/support/plugin.py:25 | |
(Pdb) c | |
> /src/glasgow/software/glasgow/support/plugin.py(25)_entry_points() | |
-> yield entry_point | |
(Pdb) display entry_point | |
display entry_point: EntryPoint(name='analyzer', value='glasgow.applet.interface.analyzer:AnalyzerApplet', group='glasgow.applet') | |
(Pdb) c | |
> /src/glasgow/software/glasgow/support/plugin.py(25)_entry_points() | |
-> yield entry_point | |
display entry_point: EntryPoint(name='audio-dac', value='glasgow.applet.audio.dac:AudioDACApplet', group='glasgow.applet') [old: EntryPoint(name='analyzer', value='glasgow.applet.interface.analyzer:AnalyzerApplet', group='glasgow.applet')] | |
(Pdb) c | |
> /src/glasgow/software/glasgow/support/plugin.py(25)_entry_points() | |
-> yield entry_point | |
display entry_point: EntryPoint(name='audio-yamaha-opx', value='glasgow.applet.audio.yamaha_opx:AudioYamahaOPxApplet [http]', group='glasgow.applet') [old: EntryPoint(name='audio-dac', value='glasgow.applet.audio.dac:AudioDACApplet', group='glasgow.applet')] | |
(Pdb) c | |
calling requirement.marker.evalulate({"extra": <re.Match object; span=(1, 5), match='http'>}) | |
Traceback (most recent call last): | |
File "/usr/local/share/pipx/bin/glasgow", line 8, in <module> | |
sys.exit(main()) | |
File "/src/glasgow/software/glasgow/cli.py", line 903, in main | |
exit(loop.run_until_complete(_main())) | |
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete | |
return future.result() | |
File "/src/glasgow/software/glasgow/cli.py", line 486, in _main | |
args = get_argparser().parse_args() | |
File "/src/glasgow/software/glasgow/cli.py", line 279, in get_argparser | |
add_applet_arg(p_run, mode="interact", required=True) | |
File "/src/glasgow/software/glasgow/cli.py", line 124, in add_applet_arg | |
for handle, metadata in GlasgowAppletMetadata.all().items(): | |
File "/src/glasgow/software/glasgow/support/plugin.py", line 93, in all | |
return {ep.name: cls(ep) for ep in _entry_points(group=cls.GROUP_NAME)} | |
File "/src/glasgow/software/glasgow/support/plugin.py", line 93, in <dictcomp> | |
return {ep.name: cls(ep) for ep in _entry_points(group=cls.GROUP_NAME)} | |
File "/src/glasgow/software/glasgow/support/plugin.py", line 103, in __init__ | |
self.requirements = _requirements_for_optional_dependencies( | |
File "/src/glasgow/software/glasgow/support/plugin.py", line 37, in _requirements_for_optional_dependencies | |
if requirement.marker and requirement.marker.evaluate({"extra": dependency}): | |
File "/usr/local/share/pipx/venvs/glasgow/lib/python3.9/site-packages/packaging/markers.py", line 252, in evaluate | |
return _evaluate_markers(self._markers, current_environment) | |
File "/usr/local/share/pipx/venvs/glasgow/lib/python3.9/site-packages/packaging/markers.py", line 157, in _evaluate_markers | |
lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key) | |
File "/usr/local/share/pipx/venvs/glasgow/lib/python3.9/site-packages/packaging/markers.py", line 131, in _normalize | |
return tuple(canonicalize_name(v) for v in values) | |
File "/usr/local/share/pipx/venvs/glasgow/lib/python3.9/site-packages/packaging/markers.py", line 131, in <genexpr> | |
return tuple(canonicalize_name(v) for v in values) | |
File "/usr/local/share/pipx/venvs/glasgow/lib/python3.9/site-packages/packaging/utils.py", line 47, in canonicalize_name | |
value = _canonicalize_regex.sub("-", name).lower() | |
TypeError: expected string or bytes-like object | |
ewen@parthenon:~$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FTR, the smallest fix for this seems to be to cooerce the re.Match() (ie, match group) "string" to be a real string before we try to use it. Ie in
_requirements_for_optional_dependencies()
check the dependency, and if necessarystr()
ify it.