aboutcode-org / aboutcode-org/scancode-toolkit

Exception in parsing cfg file

Abierto
#3,009 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Python
Estrellas
2.6k
Forks
791
Merge medio
1 d 12 h
PR fusionados (30 d)
5

Descripción

### Description

> Please leave a brief description of the bug or feature request:

### How To Reproduce
Parse this cfg file with SetupCfgHandler.
```
[metadata]
name = importlib_resources
author = Barry Warsaw
author_email = barry@python.org
description = Read resources from Python packages
long_description = file: README.rst
url = https://github.com/python/importlib_resources
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
project_urls =
Documentation = https://importlib-resources.readthedocs.io/

[options]
packages = find_namespace:
include_package_data = true
python_requires = >=3.7
install_requires =
zipp >= 3.1.0; python_version < '3.10'

[options.packages.find]
exclude =
build*
dist*
docs*
tests*

[options.extras_require]
testing =
pytest >= 6
pytest-checkdocs >= 2.4
pytest-flake8
pytest-black >= 0.3.7; \
python_implementation != "PyPy"
pytest-cov
pytest-mypy >= 0.9.1; \
python_implementation != "PyPy"
pytest-enabler >= 1.0.1
docs =
sphinx
jaraco.packaging >= 9
rst.linker >= 1.9

[egg_info]
tag_build =
tag_date = 0
```

Got this error while parsing this file
```
Traceback (most recent call last):
File "/home/tg1999/Desktop/python-inspector/venv/lib/python3.8/site-packages/dparse2/parser.py", line 74, in setuptools_parse_requirements_backport
line += next(lines)
StopIteration
File "/home/tg1999/Desktop/python-inspector/src/_packagedcode/pypi.py", line 722, in parse
dependencies = parse_with_dparse2(
File "/home/tg1999/Desktop/python-inspector/src/_packagedcode/pypi.py", line 1268, in parse_with_dparse2
dep_file = dparse2.parse(content, file_name=file_name)
File "/home/tg1999/Desktop/python-inspector/venv/lib/python3.8/site-packages/dparse2/parser.py", line 256, in parse
return dep_file.parse()
File "/home/tg1999/Desktop/python-inspector/venv/lib/python3.8/site-packages/dparse2/dependencies.py", line 139, in parse
self.parser.parse()
File "/home/tg1999/Desktop/python-inspector/venv/lib/python3.8/site-packages/dparse2/parser.py", line 236, in parse
self._parse_content(content)
File "/home/tg1999/Desktop/python-inspector/venv/lib/python3.8/site-packages/dparse2/parser.py", line 242, in _parse_content
req = parse_requirement_line(line)
File "/home/tg1999/Desktop/python-inspector/venv/lib/python3.8/site-packages/dparse2/parser.py", line 87, in parse_requirement_line
(parsed,) = setuptools_parse_requirements_backport(line)
RuntimeError: generator raised StopIteration
```
Adding one more file for input
```
[metadata]
name = importlib_metadata
author = Jason R. Coombs
author_email = jaraco@jaraco.com
description = Read metadata from Python packages
long_description = file:README.rst
url = https://github.com/python/importlib_metadata
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only

[options]
packages = find_namespace:
include_package_data = true
python_requires = >=3.7
install_requires =
zipp>=0.5
typing-extensions>=3.6.4; python_version < "3.8"

[options.packages.find]
exclude =
build*
dist*
docs*
tests*
prepare*

[options.extras_require]
testing =
pytest >= 6
pytest-checkdocs >= 2.4
pytest-flake8
pytest-black >= 0.3.7; \
python_implementation != "PyPy"
pytest-cov
pytest-mypy >= 0.9.1; \
python_implementation != "PyPy"
pytest-enabler >= 1.3

importlib_resources>=1.3; python_version < "3.9"
packaging
pyfakefs
flufl.flake8
pytest-perf >= 0.9.2
docs =
sphinx
jaraco.packaging >= 9
rst.linker >= 1.9
perf =
ipython

[options.entry_points]

[egg_info]
tag_build =
tag_date = 0
```

> For bug reports, it really helps us to know:

* What OS are you running on? Linux
* What version of scancode-toolkit was used to generate the scan file?
* What installation method was used to install/run scancode? source download

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.