Skip to content

Commit

Permalink
fix: Repositories configurable in project
Browse files Browse the repository at this point in the history
Fixes #3335

Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed Dec 6, 2024
1 parent a7ac964 commit 66af2bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/3335.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow configuring repositories in project.
11 changes: 9 additions & 2 deletions src/pdm/cli/commands/publish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,16 @@ def get_repository(project: Project, options: argparse.Namespace) -> Repository:
password = options.password or os.getenv("PDM_PUBLISH_PASSWORD")
ca_certs = options.ca_certs or os.getenv("PDM_PUBLISH_CA_CERTS")

config = project.global_config.get_repository_config(repository, "repository")
config = project.project_config.get_repository_config(repository, "repository")
if config is None:
raise PdmUsageError(f"Missing repository config of {repository}")
config = project.global_config.get_repository_config(repository, "repository")
if config is None:
raise PdmUsageError(f"Missing repository config of {repository}")
else:
global_config = project.global_config.get_repository_config(repository, "repository")
if global_config is not None:
config.passive_update(global_config)

assert config.url is not None
if username is not None:
config.username = username
Expand Down

0 comments on commit 66af2bd

Please sign in to comment.