Commit 529b06d3 authored by PJ Eby's avatar PJ Eby

Added ``--identity`` option to ``upload`` command.

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4043427
parent b6bb3314
...@@ -2156,6 +2156,11 @@ The ``upload`` command has a few options worth noting: ...@@ -2156,6 +2156,11 @@ The ``upload`` command has a few options worth noting:
Sign each uploaded file using GPG (GNU Privacy Guard). The ``gpg`` program Sign each uploaded file using GPG (GNU Privacy Guard). The ``gpg`` program
must be available for execution on the system ``PATH``. must be available for execution on the system ``PATH``.
``--identity=NAME, -i NAME``
Specify the identity or key name for GPG to use when signing. The value of
this option will be passed through the ``--local-user`` option of the
``gpg`` program.
``--show-response`` ``--show-response``
Display the full response text from server; this is useful for debugging Display the full response text from server; this is useful for debugging
PyPI problems. PyPI problems.
...@@ -2366,6 +2371,8 @@ Release Notes/Change History ...@@ -2366,6 +2371,8 @@ Release Notes/Change History
---------------------------- ----------------------------
0.6a11 0.6a11
* Added ``--identity`` option to ``upload`` command.
* Added ``dependency_links`` to allow specifying URLs for ``--find-links``. * Added ``dependency_links`` to allow specifying URLs for ``--find-links``.
* Enhanced test loader to scan packages as well as modules, and call * Enhanced test loader to scan packages as well as modules, and call
......
...@@ -29,6 +29,7 @@ class upload(Command): ...@@ -29,6 +29,7 @@ class upload(Command):
'display full response text from server'), 'display full response text from server'),
('sign', 's', ('sign', 's',
'sign files to upload using gpg'), 'sign files to upload using gpg'),
('identity=', 'i', 'GPG identity used to sign files'),
] ]
boolean_options = ['show-response', 'sign'] boolean_options = ['show-response', 'sign']
...@@ -38,8 +39,13 @@ class upload(Command): ...@@ -38,8 +39,13 @@ class upload(Command):
self.repository = '' self.repository = ''
self.show_response = 0 self.show_response = 0
self.sign = False self.sign = False
self.identity = None
def finalize_options(self): def finalize_options(self):
if self.identity and not self.sign:
raise DistutilsOptionError(
"Must use --sign for --identity to have meaning"
)
if os.environ.has_key('HOME'): if os.environ.has_key('HOME'):
rc = os.path.join(os.environ['HOME'], '.pypirc') rc = os.path.join(os.environ['HOME'], '.pypirc')
if os.path.exists(rc): if os.path.exists(rc):
...@@ -67,7 +73,10 @@ class upload(Command): ...@@ -67,7 +73,10 @@ class upload(Command):
def upload_file(self, command, pyversion, filename): def upload_file(self, command, pyversion, filename):
# Sign if requested # Sign if requested
if self.sign: if self.sign:
spawn(("gpg", "--detach-sign", "-a", filename), gpg_args = ["gpg", "--detach-sign", "-a", filename]
if self.identity:
gpg_args[2:2] = ["--local-user", self.identity)]
spawn(gpg_args,
dry_run=self.dry_run) dry_run=self.dry_run)
# Fill in the data # Fill in the data
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment