[Python-checkins] r43427 - in sandbox/trunk/setuptools: setuptools.txt setuptools/command/upload.py

phillip.eby python-checkins at python.org
Wed Mar 29 23:45:02 CEST 2006


Author: phillip.eby
Date: Wed Mar 29 23:45:01 2006
New Revision: 43427

Modified:
   sandbox/trunk/setuptools/setuptools.txt
   sandbox/trunk/setuptools/setuptools/command/upload.py
Log:
Added ``--identity`` option to ``upload`` command.


Modified: sandbox/trunk/setuptools/setuptools.txt
==============================================================================
--- sandbox/trunk/setuptools/setuptools.txt	(original)
+++ sandbox/trunk/setuptools/setuptools.txt	Wed Mar 29 23:45:01 2006
@@ -2156,6 +2156,11 @@
     Sign each uploaded file using GPG (GNU Privacy Guard).  The ``gpg`` program
     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``
     Display the full response text from server; this is useful for debugging
     PyPI problems.
@@ -2366,6 +2371,8 @@
 ----------------------------
 
 0.6a11
+ * Added ``--identity`` option to ``upload`` command.
+
  * Added ``dependency_links`` to allow specifying URLs for ``--find-links``.
 
  * Enhanced test loader to scan packages as well as modules, and call

Modified: sandbox/trunk/setuptools/setuptools/command/upload.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/upload.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/upload.py	Wed Mar 29 23:45:01 2006
@@ -29,6 +29,7 @@
          '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 @@
         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 @@
     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


More information about the Python-checkins mailing list