diff options
author | Phillip J. Eby <pje@telecommunity.com> | 2006-03-30 02:12:14 (GMT) |
---|---|---|
committer | Phillip J. Eby <pje@telecommunity.com> | 2006-03-30 02:12:14 (GMT) |
commit | 2e550b3dd2a9c8a90e0811ce9f0f05690ecf05cb (patch) | |
tree | 95ec45240a788139eae67a412628f0cc5b08f385 /Lib/distutils | |
parent | 3c3346daa9bf900080428ed12b6d83aa04f7332b (diff) | |
download | cpython-2e550b3dd2a9c8a90e0811ce9f0f05690ecf05cb.zip cpython-2e550b3dd2a9c8a90e0811ce9f0f05690ecf05cb.tar.gz cpython-2e550b3dd2a9c8a90e0811ce9f0f05690ecf05cb.tar.bz2 |
Implementation for patch request #1457316: support --identity option
for setup.py "upload" command.
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/command/upload.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py index 62767a3..6f4ce81 100644 --- a/Lib/distutils/command/upload.py +++ b/Lib/distutils/command/upload.py @@ -29,6 +29,7 @@ class upload(Command): 'display full response text from server'), ('sign', 's', 'sign files to upload using gpg'), + ('identity=', 'i', 'GPG identity used to sign files'), ] boolean_options = ['show-response', 'sign'] @@ -38,8 +39,13 @@ class upload(Command): self.repository = '' self.show_response = 0 self.sign = False + self.identity = None 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'): rc = os.path.join(os.environ['HOME'], '.pypirc') if os.path.exists(rc): @@ -67,7 +73,10 @@ class upload(Command): def upload_file(self, command, pyversion, filename): # Sign if requested 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) # Fill in the data - send all the meta-data in case we need to |