Skip to content

Commit 7ddbaf4

Browse files
committed
Fix weirdness with --repository-url
Closes pypagh-206
1 parent 1b95130 commit 7ddbaf4

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

tests/test_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ def test_get_repository_config_missing(tmpdir):
121121
}
122122
assert (utils.get_repository_from_config(pypirc, 'foo', repository_url) ==
123123
exp)
124+
assert (utils.get_repository_from_config(pypirc, 'pypi', repository_url) ==
125+
exp)
124126
exp = {
125127
"repository": utils.DEFAULT_REPOSITORY,
126128
"username": None,

twine/utils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ def get_config(path="~/.pypirc"):
104104

105105
def get_repository_from_config(config_file, repository, repository_url=None):
106106
# Get our config from the .pypirc file
107+
if repository_url and "://" in repository_url:
108+
# assume that the repository is actually an URL and just sent
109+
# them a dummy with the repo set
110+
return {
111+
"repository": repository_url,
112+
"username": None,
113+
"password": None,
114+
}
107115
try:
108116
return get_config(config_file)[repository]
109117
except KeyError:
110-
if repository_url and "://" in repository_url:
111-
# assume that the repsoitory is actually an URL and just sent
112-
# them a dummy with the repo set
113-
return {
114-
"repository": repository_url,
115-
"username": None,
116-
"password": None,
117-
}
118118
msg = (
119119
"Missing '{repo}' section from the configuration file\n"
120120
"or not a complete URL in --repository.\n"

0 commit comments

Comments
 (0)