Skip to content

Commit

Permalink
Preserve package's source when it has extras
Browse files Browse the repository at this point in the history
  • Loading branch information
maksbotan committed Sep 3, 2022
1 parent 58d2b99 commit 8e0febf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/poetry/puzzle/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,18 @@ def complete_package(
)
package = dependency_package.package
dependency = dependency_package.dependency
_dependencies.append(package.without_features().to_dependency())
new_dependency = package.without_features().to_dependency()

# When adding dependency foo[extra] -> foo, preserve foo's source, if it's
# specified. This prevents us from trying to get foo from PyPI
# when user explicitly set repo for foo[extra].
if (
not new_dependency.source_name
and dependency_package.dependency.source_name
):
new_dependency.source_name = dependency_package.dependency.source_name

_dependencies.append(new_dependency)

for dep in requires:
if not self._python_constraint.allows_any(dep.python_constraint):
Expand Down

0 comments on commit 8e0febf

Please sign in to comment.