Projects
Eulaceura:Factory
python-keyczar
_service:obs_scm:0001-fit-to-python3.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0001-fit-to-python3.patch of Package python-keyczar
From 837b679c117235cd7220e10cb6c0f49c7db6efe2 Mon Sep 17 00:00:00 2001 From: wangge <wang__ge@126.com> Date: Fri, 23 Oct 2020 18:39:41 +0800 Subject: [PATCH] fit to python3 --- keyczar/keyczar.py | 16 ++++++++-------- keyczar/keydata.py | 4 ++-- keyczar/keyinfo.py | 2 +- keyczar/keys.py | 8 ++++---- keyczar/readers.py | 10 +++++----- keyczar/test/__init__.py | 21 ++++++++++++--------- keyczar/test/collision_test.py | 4 ++-- keyczar/test/crypter_test.py | 16 ++++++++-------- keyczar/test/interop_test.py | 4 ++-- keyczar/test/keyczart_test.py | 12 ++++++------ keyczar/test/session_test.py | 4 ++-- keyczar/test/signer_test.py | 10 +++++----- keyczar/test/util_test.py | 6 +++--- keyczar/tool/keyczart.py | 34 +++++++++++++++++----------------- keyczar/util.py | 4 ++-- keyczar/writers.py | 4 ++-- 16 files changed, 81 insertions(+), 78 deletions(-) diff --git a/keyczar/keyczar.py b/keyczar/keyczar.py index 09b2b59..e242894 100644 --- a/keyczar/keyczar.py +++ b/keyczar/keyczar.py @@ -29,14 +29,14 @@ import io from abc import ABCMeta -from keyczar import errors -from keyczar import keydata -from keyczar import keyinfo -from keyczar import keys -from keyczar import readers -from keyczar import writers -from keyczar import util -from keyczar import constants +import errors +import keydata +import keyinfo +import keys +import readers +import writers +import util +import constants class Keyczar(object): diff --git a/keyczar/keydata.py b/keyczar/keydata.py index af9bf4d..f9e1a87 100644 --- a/keyczar/keydata.py +++ b/keyczar/keydata.py @@ -24,8 +24,8 @@ from __future__ import absolute_import import json -from keyczar import errors -from keyczar import keyinfo +import errors +import keyinfo class KeyMetadata(object): """Encodes metadata for a keyset with a name, purpose, type, and versions.""" diff --git a/keyczar/keyinfo.py b/keyczar/keyinfo.py index ef030cf..b66d874 100644 --- a/keyczar/keyinfo.py +++ b/keyczar/keyinfo.py @@ -20,7 +20,7 @@ status, purpose, and the cipher mode. """ from __future__ import absolute_import -from keyczar import errors +import errors class _NameId(object): def __init__(self, name, key_id): diff --git a/keyczar/keys.py b/keyczar/keys.py index b1cf0a5..b75b944 100644 --- a/keyczar/keys.py +++ b/keyczar/keys.py @@ -43,10 +43,10 @@ except ImportError: # overideable crypt library selection ACTIVE_CRYPT_LIB = 'm2crypto' if EVP else 'pycrypto' -from keyczar import errors -from keyczar import keyinfo -from keyczar import util -from keyczar import constants +import errors +import keyinfo +import util +import constants #TODO: Note that simplejson deals in Unicode strings. So perhaps we should #modify all Read() methods to wrap data obtained from simplejson with str(). diff --git a/keyczar/readers.py b/keyczar/readers.py index 9726a6f..d191ac3 100644 --- a/keyczar/readers.py +++ b/keyczar/readers.py @@ -24,11 +24,11 @@ import os from abc import ABCMeta, abstractmethod, abstractproperty -from keyczar import errors -from keyczar import keydata -from keyczar import keyinfo -from keyczar import keys -from keyczar import util +import errors +import keydata +import keyinfo +import keys +import util def CreateReader(location): """Factory function for Reader's diff --git a/keyczar/test/__init__.py b/keyczar/test/__init__.py index 4b68038..dcc1b27 100644 --- a/keyczar/test/__init__.py +++ b/keyczar/test/__init__.py @@ -1,4 +1,4 @@ -# +#!/usr/bin/python3 # Copyright 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,13 +24,13 @@ from __future__ import absolute_import import unittest -from . import crypter_test -from . import keyczart_test -from . import signer_test -from . import util_test -from . import session_test -from . import interop_test -from . import collision_test +import crypter_test +import keyczart_test +import signer_test +import util_test +import session_test +import interop_test +import collision_test def allsuite(): alltests = unittest.TestSuite() @@ -41,4 +41,7 @@ def allsuite(): alltests.addTest(session_test.suite()) alltests.addTest(interop_test.suite()) alltests.addTest(collision_test.suite()) - return alltests \ No newline at end of file + return alltests + +#if __name__ == '__main__': +# unittest.main(defaultTest='suite') diff --git a/keyczar/test/collision_test.py b/keyczar/test/collision_test.py index 93dc447..a8b5257 100644 --- a/keyczar/test/collision_test.py +++ b/keyczar/test/collision_test.py @@ -25,8 +25,8 @@ import os import unittest import datetime -from keyczar import keyczar -from keyczar import util +import keyczar +import util class CollisionTest(unittest.TestCase): diff --git a/keyczar/test/crypter_test.py b/keyczar/test/crypter_test.py index 8fafef0..4e9a1f9 100755 --- a/keyczar/test/crypter_test.py +++ b/keyczar/test/crypter_test.py @@ -26,14 +26,14 @@ import random import unittest import io -from keyczar import constants -from keyczar import errors -from keyczar import keyczar -from keyczar import readers -from keyczar import writers -from keyczar import util -from keyczar import keys -from keyczar import keyinfo +import constants +import errors +import keyczar +import readers +import writers +import util +import keys +import keyinfo TEST_DATA = os.path.realpath(os.path.join(os.getcwd(), "test-data", "existing-data", "python")) diff --git a/keyczar/test/interop_test.py b/keyczar/test/interop_test.py index d881ac8..80b6f11 100644 --- a/keyczar/test/interop_test.py +++ b/keyczar/test/interop_test.py @@ -29,8 +29,8 @@ import os import unittest import datetime -from keyczar import keyczar -from keyczar import util +import keyczar +import util class BaseInteropTest(unittest.TestCase): def __init__(self, imp, methodname='runTest'): diff --git a/keyczar/test/keyczart_test.py b/keyczar/test/keyczart_test.py index 4498cbf..8193ec6 100755 --- a/keyczar/test/keyczart_test.py +++ b/keyczar/test/keyczart_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # # Copyright 2008 Google Inc. # @@ -23,11 +23,11 @@ from __future__ import absolute_import import unittest -from keyczar import readers -from keyczar import writers -from keyczar.tool import keyczart -from keyczar import keyczar -from keyczar import keyinfo +import readers +import writers +from tool import keyczart +import keyczar +import keyinfo class KeyczartTest(unittest.TestCase): diff --git a/keyczar/test/session_test.py b/keyczar/test/session_test.py index 665363c..63b9839 100644 --- a/keyczar/test/session_test.py +++ b/keyczar/test/session_test.py @@ -23,8 +23,8 @@ from __future__ import absolute_import import os import unittest -from keyczar import keyczar -from keyczar import util +import keyczar +import util TEST_DATA = os.path.realpath(os.path.join(os.getcwd(), "test-data", "existing-data", "python")) diff --git a/keyczar/test/signer_test.py b/keyczar/test/signer_test.py index b83a7f8..ec462ae 100755 --- a/keyczar/test/signer_test.py +++ b/keyczar/test/signer_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # # Copyright 2008 Google Inc. # @@ -24,10 +24,10 @@ from __future__ import absolute_import import os import unittest -from keyczar import errors -from keyczar import keyczar -from keyczar import util -from keyczar import constants +import errors +import keyczar +import util +import constants TEST_DATA = os.path.realpath(os.path.join(os.getcwd(), "test-data", "existing-data", "python")) diff --git a/keyczar/test/util_test.py b/keyczar/test/util_test.py index 7b43c56..6629467 100755 --- a/keyczar/test/util_test.py +++ b/keyczar/test/util_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # # Copyright 2011 LightKeeper LLC. # @@ -27,7 +27,7 @@ import random import os import io -from keyczar import util +import util class Base64WSStreamingReadTest(unittest.TestCase): @@ -98,7 +98,7 @@ class ParseX509Test(unittest.TestCase): 'l9d+zbuoBc4YMASUZa+vKqRZ3a+d15WdlBjtEzB2NbBbnbCJKjfGSmOCbg==' params = util.ParseX509(publickey) expected = { - 'q': 1131081433714279493125447137485919672696369887159L, + 'q': 1131081433714279493125447137485919672696369887159, 'p': long( '142769326027561200015702846633037171844738546159067892543586' + '089819169405771071960306351240015809035099105692642283483274' + diff --git a/keyczar/tool/keyczart.py b/keyczar/tool/keyczart.py index ef82e87..32b4823 100644 --- a/keyczar/tool/keyczart.py +++ b/keyczar/tool/keyczart.py @@ -24,13 +24,13 @@ import os import sys import datetime -from keyczar import errors -from keyczar import keyinfo -from keyczar import keydata -from keyczar import util -from keyczar import writers -from keyczar import readers -from keyczar import keyczar +import errors +import keyinfo +import keydata +import util +import writers +import readers +import keyczar KEYSETS = [('aes', keyinfo.DECRYPT_AND_ENCRYPT, 'crypt', None, None), ('aes-crypted', keyinfo.DECRYPT_AND_ENCRYPT, 'crypt', None, 'aes'), @@ -177,9 +177,9 @@ def _CreateCrypter(location): return keyczar.Crypter.Read(location) def GenKeySet(loc): - print "Generating private key sets..." + print ("Generating private key sets...") for (name, purpose, form, asymmetric, crypter) in KEYSETS: - print "." + print (".") dir_path = os.path.join(loc, name) if crypter: crypter = _CreateCrypter(os.path.join(loc, crypter)) @@ -192,13 +192,13 @@ def GenKeySet(loc): UseKey(form, dir_path, os.path.join(dir_path, "2.out"), crypter, msg="This is some test data") - print "Exporting public key sets..." + print ("Exporting public key sets...") for name in ('dsa', 'rsa-sign'): - print "." + print (".") dir_path = os.path.join(loc, name) dest = os.path.join(loc, name + '.public') PubKey(dir_path, dest) - print "Done!" + print ("Done!") def Clean(directory): for filename in os.listdir(directory): @@ -232,7 +232,7 @@ def UseKey(purpose, loc, dest, crypter=None, dest2=None, loc2 = None, "%Y-%m-%dT%H:%M:%SZ") answer = keyczar.TimeoutSigner(reader).Sign(msg, expire_date) else: - print "Needs UTC time as extra parameter for timeout expiration" + print ("Needs UTC time as extra parameter for timeout expiration") elif purpose == "sign-attached": hidden = "" if len(param) > 0: @@ -259,7 +259,7 @@ def UseKey(purpose, loc, dest, crypter=None, dest2=None, loc2 = None, reader2.Close() def Usage(): - print '''Usage: "keyczart command flags" + print ('''Usage: "keyczart command flags" Commands: create addkey pubkey promote demote revoke Flags: location name size status purpose destination version asymmetric crypter Command Usage: @@ -295,7 +295,7 @@ revoke --location=/path/to/keys --version=versionNumber promote command. WARNING: The key will be destroyed. Optional flags are in [brackets]. The notation (a|b|c) means "a", "b", and "c" -are the valid choices''' +are the valid choices''') def CreateGenericKeyczar(loc, crypter=None): if mock is not None: @@ -343,7 +343,7 @@ def main(argv): [flag, val] = arg.split("=") flags[GetFlag(flag)] = val except ValueError: - print "Flags incorrectly formatted" + print ("Flags incorrectly formatted") Usage() else: other.append(arg) @@ -352,7 +352,7 @@ def main(argv): size = int(flags.get(SIZE, -1)) # -1 if non-existent except ValueError: - print "Size and version flags require an integer" + print ("Size and version flags require an integer") Usage() loc = flags.get(LOCATION) # all commands need location diff --git a/keyczar/util.py b/keyczar/util.py index efb8d6b..97026d7 100644 --- a/keyczar/util.py +++ b/keyczar/util.py @@ -44,8 +44,8 @@ from pyasn1.codec.der import decoder from pyasn1.codec.der import encoder from pyasn1.type import univ -from keyczar import errors as kzr_errors -from keyczar import constants +import errors as kzr_errors +import constants HLEN = sha1().digest_size # length of the hash output diff --git a/keyczar/writers.py b/keyczar/writers.py index ff1bdb4..af9b575 100644 --- a/keyczar/writers.py +++ b/keyczar/writers.py @@ -24,8 +24,8 @@ import os from abc import ABCMeta, abstractmethod, abstractproperty -from keyczar import errors -from keyczar import util +import errors +import util def CreateWriter(location): """Factory function for Writers -- 2.23.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2