Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--index-url not parsed correctly #189

Open
bennati opened this issue Aug 23, 2024 · 1 comment
Open

--index-url not parsed correctly #189

bennati opened this issue Aug 23, 2024 · 1 comment

Comments

@bennati
Copy link
Contributor

bennati commented Aug 23, 2024

Analyzing a requirements.txt file that contains -i URL or --index-url URL fails with the error below.
This was tested with 0.12.1 and 0.10.0, the parsing happens correctly in version 0.10.0.
Replacing -i with --extra-index-url solves the issue.

Error:

environment: Environment(python_version='311', operating_system='linux')
repos:
 PypiSimpleRepository(index_url='https://pypi.org/simple', credentials=None)
 PypiSimpleRepository(index_url='h', credentials=None)
 PypiSimpleRepository(index_url='t', credentials=None)
 PypiSimpleRepository(index_url='t', credentials=None)
 PypiSimpleRepository(index_url='p', credentials=None)
 PypiSimpleRepository(index_url='s', credentials=None)
 PypiSimpleRepository(index_url=':', credentials=None)
 PypiSimpleRepository(index_url='', credentials=None)
 PypiSimpleRepository(index_url='', credentials=None)
 PypiSimpleRepository(index_url='a', credentials=None)
... (the remaining spells out each character of the provided URL)
Traceback (most recent call last):
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/resolve_cli.py", line 259, in resolve_dependencies
    resolution_result: Dict = resolver_api(
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/api.py", line 289, in resolve_dependencies
    resolution, purls = resolve(
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/api.py", line 353, in resolve
    resolved_dependencies, packages = get_resolved_dependencies(
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/api.py", line 394, in get_resolved_dependencies
    resolver_results = resolver.resolve(
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/resolvelib/resolvers.py", line 397, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/resolvelib/resolvers.py", line 148, in _add_to_criteria
    matches = self._p.find_matches(
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/resolution.py", line 621, in find_matches
    candidates = sorted(
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/resolution.py", line 597, in _iter_matches
    self.get_versions_for_package(name=name, repo=repo))
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/resolution.py", line 401, in get_versions_for_package
    return self.get_versions_for_package_from_repo(name, repo)
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/resolution.py", line 412, in get_versions_for_package_from_repo
    for version, package in repo.get_package_versions(name).items():
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/utils_pypi.py", line 1550, in get_package_versions
    self._get_package_versions_map(
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/utils_pypi.py", line 1518, in _get_package_versions_map
    links = self.fetch_links(
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/utils_pypi.py", line 1596, in fetch_links
    text = CACHE.get(
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/utils_pypi.py", line 1687, in get
    content = get_file_content(
  File "/Users/bennati/.pyenv/versions/scancode/lib/python3.8/site-packages/python_inspector/utils_pypi.py", line 1736, in get_file_content
    raise Exception(f"Unsupported URL scheme: {path_or_url}")
Exception: Unsupported URL scheme: h/aiofiles
@sschuberth
Copy link
Contributor

Looks like a duplicate of #173.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants