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

fix: ignore empty source when merging sources #2131

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/2130.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Skip sources with empty URL when merging sources.
7 changes: 5 additions & 2 deletions src/pdm/project/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,13 @@ def merge_sources(other_sources: Iterable[RepositoryConfig]) -> None:
result["pypi"].passive_update(self.default_source)
merge_sources(self.project_config.iter_sources())
merge_sources(self.global_config.iter_sources())
sources: list[RepositoryConfig] = []
for source in result.values():
assert source.url, f"Source URL must not be empty for {source.name}"
if not source.url:
continue
source.url = expand_env_vars_in_auth(source.url)
return list(result.values())
sources.append(source)
return sources

def get_repository(
self, cls: type[BaseRepository] | None = None, ignore_compatibility: bool = True
Expand Down