Skip to content

Commit

Permalink
Add ability to specify location of .pypirc file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferguzz committed Mar 22, 2015
1 parent 6cb70f4 commit b8bc387
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Jannis Leidel <[email protected]>
Ralf Schmitt <[email protected]>
Ian Cordasco <[email protected]>
Marc Abramowitz <[email protected]> (http://marc-abramowitz.com/)
Tom Myers <[email protected]>
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ Options
The password to authenticate to the repository with
-c COMMENT, --comment COMMENT
The comment to include with the distribution file
--config-file FILE
The .pypirc config file to use
Resources
Expand Down
11 changes: 8 additions & 3 deletions twine/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def sign_file(sign_with, filename, identity):


def upload(dists, repository, sign, identity, username, password, comment,
sign_with):
sign_with, config_file):
# Check that a nonsensical option wasn't given
if not sign and identity:
raise ValueError("sign must be given along with identity")
Expand All @@ -90,9 +90,9 @@ def upload(dists, repository, sign, identity, username, password, comment,
)
dists = [i for i in dists if not i.endswith(".asc")]

# Get our config from ~/.pypirc
# Get our config from the .pypirc file
try:
config = get_config()[repository]
config = get_config(config_file)[repository]
except KeyError:
raise KeyError(
"Missing '{0}' section from the configuration file".format(
Expand Down Expand Up @@ -252,6 +252,11 @@ def main(args):
"-c", "--comment",
help="The comment to include with the distribution file",
)
parser.add_argument(
"--config-file",
default="~/.pypirc",
help="The .pypirc config file to use",
)
parser.add_argument(
"dists",
nargs="+",
Expand Down

0 comments on commit b8bc387

Please sign in to comment.