Hello community,

here is the log from the commit of package python-gnupg for openSUSE:Factory 
checked in at 2012-09-14 12:35:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-gnupg (Old)
 and      /work/SRC/openSUSE:Factory/.python-gnupg.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-gnupg", Maintainer is ""

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-gnupg/python-gnupg.changes        
2012-05-22 08:18:19.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python-gnupg.new/python-gnupg.changes   
2012-09-14 12:35:33.000000000 +0200
@@ -1,0 +2,14 @@
+Sat Sep  1 23:19:25 UTC 2012 - [email protected]
+
+- Update to 0.3.1:
+  - Fixed Issue #45 : Allow additional arguments to gpg executable.
+    Fixed Issue #50 : Use latin-1 encoding in tests when it's known
+    to be required.
+    Fixed Issue #51: Test now returns non-zero exit status on test
+    failure.
+    Fixed Issue #53: Now handles INV_SGNR and KEY_NOT_CREATED
+    statuses.
+    Fixed Issue #55: Verification and decryption now return trust
+    level of signer in integer and text form.
+
+-------------------------------------------------------------------

Old:
----
  python-gnupg-0.3.0.tar.bz2

New:
----
  python-gnupg-0.3.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-gnupg.spec ++++++
--- /var/tmp/diff_new_pack.3JZnri/_old  2012-09-14 12:35:51.000000000 +0200
+++ /var/tmp/diff_new_pack.3JZnri/_new  2012-09-14 12:35:51.000000000 +0200
@@ -20,7 +20,7 @@
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
 
 Name:           python-gnupg
-Version:        0.3.0
+Version:        0.3.1
 Release:        0
 Url:            http://code.google.com/p/python-gnupg/
 Summary:        A wrapper for the Gnu Privacy Guard (GPG or GnuPG)

++++++ python-gnupg-0.3.0.tar.bz2 -> python-gnupg-0.3.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gnupg-0.3.0/PKG-INFO 
new/python-gnupg-0.3.1/PKG-INFO
--- old/python-gnupg-0.3.0/PKG-INFO     2012-05-12 11:54:20.000000000 +0200
+++ new/python-gnupg-0.3.1/PKG-INFO     2012-09-01 21:34:12.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: python-gnupg
-Version: 0.3.0
+Version: 0.3.1
 Summary: A wrapper for the Gnu Privacy Guard (GPG or GnuPG)
 Home-page: http://www.red-dove.com/python_gnupg.html
 Author: Vinay Sajip
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gnupg-0.3.0/gnupg.py 
new/python-gnupg-0.3.1/gnupg.py
--- old/python-gnupg-0.3.0/gnupg.py     2012-05-12 11:49:10.000000000 +0200
+++ new/python-gnupg-0.3.1/gnupg.py     2012-09-01 21:19:36.000000000 +0200
@@ -33,9 +33,9 @@
 """
 import locale
 
-__version__ = "0.3.0"
+__version__ = "0.3.1"
 __author__ = "Vinay Sajip"
-__date__  = "$12-May-2012 10:49:10$"
+__date__  = "$01-Sep-2012 20:02:51$"
 
 try:
     from io import StringIO
@@ -129,12 +129,32 @@
 class Verify(object):
     "Handle status messages for --verify"
 
+    TRUST_UNDEFINED = 0
+    TRUST_NEVER = 1
+    TRUST_MARGINAL = 2
+    TRUST_FULLY = 3
+    TRUST_ULTIMATE = 4
+
+    TRUST_LEVELS = {
+        "TRUST_UNDEFINED" : TRUST_UNDEFINED,
+        "TRUST_NEVER" : TRUST_NEVER,
+        "TRUST_MARGINAL" : TRUST_MARGINAL,
+        "TRUST_FULLY" : TRUST_FULLY,
+        "TRUST_ULTIMATE" : TRUST_ULTIMATE,
+    }
+
     def __init__(self, gpg):
         self.gpg = gpg
         self.valid = False
         self.fingerprint = self.creation_date = self.timestamp = None
         self.signature_id = self.key_id = None
         self.username = None
+        self.status = None
+        self.pubkey_fingerprint = None
+        self.expire_timestamp = None
+        self.sig_timestamp = None
+        self.trust_text = None
+        self.trust_level = None
 
     def __nonzero__(self):
         return self.valid
@@ -142,10 +162,12 @@
     __bool__ = __nonzero__
 
     def handle_status(self, key, value):
-        if key in ("TRUST_UNDEFINED", "TRUST_NEVER", "TRUST_MARGINAL",
-                   "TRUST_FULLY", "TRUST_ULTIMATE", "RSA_OR_IDEA", "NODATA",
-                   "IMPORT_RES", "PLAINTEXT", "PLAINTEXT_LENGTH",
-                   "POLICY_URL", "DECRYPTION_INFO", "DECRYPTION_OKAY"):
+        if key in self.TRUST_LEVELS:
+            self.trust_text = key
+            self.trust_level = self.TRUST_LEVELS[key]
+        elif key in ("RSA_OR_IDEA", "NODATA", "IMPORT_RES", "PLAINTEXT",
+                   "PLAINTEXT_LENGTH", "POLICY_URL", "DECRYPTION_INFO",
+                   "DECRYPTION_OKAY"):
             pass
         elif key == "BADSIG":
             self.valid = False
@@ -273,9 +295,9 @@
 
     def summary(self):
         l = []
-        l.append('%d imported'%self.imported)
+        l.append('%d imported' % self.imported)
         if self.not_imported:
-            l.append('%d not imported'%self.not_imported)
+            l.append('%d not imported' % self.not_imported)
         return ', '.join(l)
 
 class ListKeys(list):
@@ -400,7 +422,7 @@
         return self.fingerprint or ''
 
     def handle_status(self, key, value):
-        if key in ("PROGRESS", "GOOD_PASSPHRASE", "NODATA"):
+        if key in ("PROGRESS", "GOOD_PASSPHRASE", "NODATA", "KEY_NOT_CREATED"):
             pass
         elif key == "KEY_CREATED":
             (self.type,self.fingerprint) = value.split()
@@ -446,7 +468,7 @@
 
     def handle_status(self, key, value):
         if key in ("USERID_HINT", "NEED_PASSPHRASE", "BAD_PASSPHRASE",
-                   "GOOD_PASSPHRASE", "BEGIN_SIGNING", "CARDCTRL"):
+                   "GOOD_PASSPHRASE", "BEGIN_SIGNING", "CARDCTRL", "INV_SGNR"):
             pass
         elif key == "SIG_CREATED":
             (self.type,
@@ -473,7 +495,7 @@
 
     "Encapsulate access to the gpg executable"
     def __init__(self, gpgbinary='gpg', gnupghome=None, verbose=False,
-                 use_agent=False, keyring=None):
+                 use_agent=False, keyring=None, options=None):
         """Initialize a GPG process wrapper.  Options are:
 
         gpgbinary -- full pathname for GPG binary.
@@ -482,12 +504,16 @@
         private keyrings.  Default is whatever gpg defaults to.
         keyring -- name of alternative keyring file to use. If specified,
         the default keyring is not used.
+        options =-- a list of additional options to pass to the GPG binary.
         """
         self.gpgbinary = gpgbinary
         self.gnupghome = gnupghome
         self.keyring = keyring
         self.verbose = verbose
         self.use_agent = use_agent
+        if isinstance(options, str):
+            options = [options]
+        self.options = options
         self.encoding = locale.getpreferredencoding()
         if self.encoding is None: # This happens on Jython!
             self.encoding = sys.stdin.encoding
@@ -500,9 +526,12 @@
             raise ValueError("Error invoking gpg: %s: %s" % (p.returncode,
                                                              result.stderr))
 
-    def _open_subprocess(self, args, passphrase=False):
-        # Internal method: open a pipe to a GPG subprocess and return
-        # the file objects for communicating with it.
+    def make_args(self, args, passphrase):
+        """
+        Make a list of command line elements for GPG. The value of ``args``
+        will be appended. The ``passphrase`` argument needs to be True if
+        a passphrase will be sent to GPG, else False.
+        """
         cmd = [self.gpgbinary, '--status-fd 2 --no-tty']
         if self.gnupghome:
             cmd.append('--homedir "%s" ' % self.gnupghome)
@@ -512,8 +541,15 @@
             cmd.append('--batch --passphrase-fd 0')
         if self.use_agent:
             cmd.append('--use-agent')
+        if self.options:
+            cmd.extend(self.options)
         cmd.extend(args)
-        cmd = ' '.join(cmd)
+        return cmd
+
+    def _open_subprocess(self, args, passphrase=False):
+        # Internal method: open a pipe to a GPG subprocess and return
+        # the file objects for communicating with it.
+        cmd = ' '.join(self.make_args(args, passphrase))
         if self.verbose:
             print(cmd)
         logger.debug("%s", cmd)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gnupg-0.3.0/test_gnupg.py 
new/python-gnupg-0.3.1/test_gnupg.py
--- old/python-gnupg-0.3.0/test_gnupg.py        2012-03-29 22:29:07.000000000 
+0200
+++ new/python-gnupg-0.3.1/test_gnupg.py        2012-09-01 21:06:39.000000000 
+0200
@@ -16,7 +16,7 @@
 import gnupg
 
 __author__ = "Vinay Sajip"
-__date__  = "$01-Mar-2010 12:30:04$"
+__date__  = "$01-Sep-2012 20:06:04$"
 
 ALL_TESTS = True
 
@@ -138,7 +138,24 @@
         result = self.generate_key("Barbara", "Brown", "beta.com")
         self.assertNotEqual(None, result, "Non-null result")
         return result
-    
+
+    def test_key_generation_with_invalid_key_type(self):
+        "Test that key generation handles invalid key type"
+        params = {
+            'Key-Type': 'INVALID',
+            'Key-Length': 1024,
+            'Subkey-Type': 'ELG-E',
+            'Subkey-Length': 2048,
+            'Name-Comment': 'A test user',
+            'Expire-Date': 0,
+            'Name-Real': 'Test Name',
+            'Name-Email': '[email protected]',
+        }
+        cmd = self.gpg.gen_key_input(**params)
+        result = self.gpg.gen_key(cmd)
+        self.assertFalse(result.data, 'Null data result')
+        self.assertEqual(None, result.fingerprint, 'Null fingerprint result')
+
     def test_list_keys_after_generation(self):
         "Test that after key generation, the generated key is available"
         self.test_list_keys_initial()
@@ -159,6 +176,7 @@
         key = self.generate_key("Barbara", "Brown", "beta.com")
         barbara = key.fingerprint
         gpg = self.gpg
+        gpg.encoding = 'latin-1'
         if gnupg._py3k:
             data = 'Hello, André!'
         else:
@@ -189,7 +207,8 @@
         logger.debug("test_import_and_export begins")
         self.test_list_keys_initial()
         gpg = self.gpg
-        gpg.import_keys(KEYS_TO_IMPORT)
+        result = gpg.import_keys(KEYS_TO_IMPORT)
+        self.assertEqual(result.summary(), '2 imported')
         public_keys = gpg.list_keys()
         self.assertTrue(is_list_with_len(public_keys, 2),
                         "2-element list expected")
@@ -238,6 +257,7 @@
         "Test that signing and verification works"
         logger.debug("test_signature_verification begins")
         key = self.generate_key("Andrew", "Able", "alpha.com")
+        self.gpg.encoding = 'latin-1'
         if gnupg._py3k:
             data = 'Hello, André!'
         else:
@@ -253,6 +273,8 @@
             logger.debug("ver: %r", verified.fingerprint)
         self.assertEqual(key.fingerprint, verified.fingerprint,
                          "Fingerprints must match")
+        self.assertEqual(verified.trust_level, verified.TRUST_ULTIMATE)
+        self.assertEqual(verified.trust_text, 'TRUST_ULTIMATE')
         if not os.path.exists('random_binary_data'):
             data_file = open('random_binary_data', 'wb')
             data_file.write(os.urandom(5120 * 1024))
@@ -309,6 +331,13 @@
         self.assertRaises(ValueError, gnupg.GPG, gnupghome=self.homedir,
                           gpgbinary='frob')
 
+    def test_make_args(self):
+        "Test argument line construction"
+        self.gpg.options = ['--foo', '--bar']
+        args = self.gpg.make_args(['a', 'b'], False)
+        self.assertTrue(len(args) > 4)
+        self.assertEqual(args[-4:], ['--foo', '--bar', 'a', 'b'])
+
     def test_file_encryption_and_decryption(self):
         "Test that encryption/decryption to/from file works"
         logger.debug("test_file_encryption_and_decryption begins")
@@ -359,7 +388,7 @@
                  'test_list_keys_after_generation']),
     'import' : set(['test_import_only']),
     'basic' : set(['test_environment', 'test_list_keys_initial',
-                   'test_nogpg']),
+                   'test_nogpg', 'test_make_args']),
 }
 
 def suite(args=None):
@@ -390,8 +419,9 @@
 def main():
     init_logging()
     tests = suite()
-    unittest.TextTestRunner(verbosity=2).run(tests)
+    results = unittest.TextTestRunner(verbosity=2).run(tests)
+    return not results.wasSuccessful()
 
 
 if __name__ == "__main__":
-    main()
+    sys.exit(main())

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to