commit:     ffb2d93b1085c600cee9bd6fa2cf17c098c3bc2c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 27 21:33:07 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Dec 30 21:42:26 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=ffb2d93b

gkeys: Move all GKEYS definitions to it's own file

Fix imports in other files.

---
 gkeys/gkeys/actions.py     |  2 +-
 gkeys/gkeys/checks.py      |  2 +-
 gkeys/gkeys/config.py      | 41 +---------------------------------
 gkeys/gkeys/gkey.py        | 55 ++++++++++++++++++++++++++++++++++++++++++++++
 gkeys/gkeys/seed.py        |  2 +-
 gkeys/gkeys/seedhandler.py |  2 +-
 6 files changed, 60 insertions(+), 44 deletions(-)

diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py
index be1823f..9baecaa 100644
--- a/gkeys/gkeys/actions.py
+++ b/gkeys/gkeys/actions.py
@@ -27,7 +27,7 @@ from shutil import rmtree
 
 from gkeys.lib import GkeysGPG
 from gkeys.seedhandler import SeedHandler
-from gkeys.config import GKEY
+from gkeys.gkey import GKEY
 from gkeys.checks import SPECCHECK_SUMMARY, convert_pf, convert_yn
 
 

diff --git a/gkeys/gkeys/checks.py b/gkeys/gkeys/checks.py
index 69df9c4..bddad5f 100644
--- a/gkeys/gkeys/checks.py
+++ b/gkeys/gkeys/checks.py
@@ -12,7 +12,7 @@
 import time
 from collections import namedtuple, OrderedDict
 
-from gkeys.config import GKEY_CHECK
+from gkeys.gkey import GKEY_CHECK
 
 from pyGPG.mappings import (ALGORITHM_CODES, CAPABILITY_MAP,
     KEY_VERSION_FPR_LEN, VALIDITY_MAP, VALID_LIST)

diff --git a/gkeys/gkeys/config.py b/gkeys/gkeys/config.py
index 6eba2b3..8fa4c1b 100644
--- a/gkeys/gkeys/config.py
+++ b/gkeys/gkeys/config.py
@@ -6,14 +6,13 @@
 
     Holds configuration keys and values
 
-    @copyright: 2012 by Brian Dolbec <dol-...@gentoo.org>
+    @copyright: 2012-2015 by Brian Dolbec <dol-...@gentoo.org>
     @license: GNU GNU GPL2, see COPYING for details.
 """
 
 import os
 
 from collections import OrderedDict
-from collections import namedtuple
 
 from pyGPG.config import GPGConfig
 
@@ -30,16 +29,6 @@ EPREFIX = "@GENTOO_PORTAGE_EPREFIX@"
 if "GENTOO_PORTAGE_EPREFIX" in EPREFIX:
     EPREFIX = ''
 
-GKEY_STRING = '''    ----------
-    Name.........: %(name)s
-    Nick.........: %(nick)s
-    Keydir.......: %(keydir)s
-'''
-
-GKEY_FINGERPRINTS = \
-'''    Keyid........: %(keyid)s
-      Fingerprint: %(fingerprint)s
-'''
 
 MAPSEEDS = { 'dev' : 'gentoodevs.seeds', 'rel': 'gentoo.seeds' }
 
@@ -137,31 +126,3 @@ class GKeysConfig(GPGConfig):
         else:
             return super(GKeysConfig, self)._get_(key, subkey)
 
-
-class GKEY(namedtuple('GKEY', ['nick', 'name', 'keydir', 'fingerprint'])):
-    '''Class to hold the relavent info about a key'''
-
-    field_types = {'nick': str, 'name': str, 'keydir': str, 'fingerprint': 
list}
-    __slots__ = ()
-
-
-    @property
-    def keyid(self):
-        '''Keyid is a substring value of the fingerprint'''
-        return ['0x' + x[-16:] for x in self.fingerprint]
-
-
-    @property
-    def pretty_print(self):
-        '''Pretty printing a GKEY'''
-        gkey = {'name': self.name, 'nick': self.nick, 'keydir': self.keydir}
-        output = GKEY_STRING % gkey
-        for f in self.fingerprint:
-            fingerprint = {'fingerprint': f, 'keyid': '0x' + f[-16:]}
-            output += GKEY_FINGERPRINTS % fingerprint
-        return output
-
-
-class GKEY_CHECK(namedtuple('GKEY_CHECK', ['keyid', 'revoked', 'expired', 
'invalid', 'sign'])):
-
-    __slots__ = ()

diff --git a/gkeys/gkeys/gkey.py b/gkeys/gkeys/gkey.py
new file mode 100644
index 0000000..41c6d8b
--- /dev/null
+++ b/gkeys/gkeys/gkey.py
@@ -0,0 +1,55 @@
+#
+#-*- coding:utf-8 -*-
+
+"""
+    Gentoo-keys - gkey.py
+
+    Holds GKEY class and related values
+
+    @copyright: 2012-2015 by Brian Dolbec <dol-...@gentoo.org>
+    @license: GNU GNU GPL2, see COPYING for details.
+"""
+
+
+from collections import namedtuple
+
+
+GKEY_STRING = '''    ----------
+    Name.........: %(name)s
+    Nick.........: %(nick)s
+    Keydir.......: %(keydir)s
+'''
+
+GKEY_FINGERPRINTS = \
+'''    Keyid........: %(keyid)s
+      Fingerprint: %(fingerprint)s
+'''
+
+
+class GKEY(namedtuple('GKEY', ['nick', 'name', 'keydir', 'fingerprint'])):
+    '''Class to hold the relavent info about a key'''
+
+    field_types = {'nick': str, 'name': str, 'keydir': str, 'fingerprint': 
list}
+    __slots__ = ()
+
+
+    @property
+    def keyid(self):
+        '''Keyid is a substring value of the fingerprint'''
+        return ['0x' + x[-16:] for x in self.fingerprint]
+
+
+    @property
+    def pretty_print(self):
+        '''Pretty printing a GKEY'''
+        gkey = {'name': self.name, 'nick': self.nick, 'keydir': self.keydir}
+        output = GKEY_STRING % gkey
+        for f in self.fingerprint:
+            fingerprint = {'fingerprint': f, 'keyid': '0x' + f[-16:]}
+            output += GKEY_FINGERPRINTS % fingerprint
+        return output
+
+
+class GKEY_CHECK(namedtuple('GKEY_CHECK', ['keyid', 'revoked', 'expired', 
'invalid', 'sign'])):
+
+    __slots__ = ()

diff --git a/gkeys/gkeys/seed.py b/gkeys/gkeys/seed.py
index 2406c1a..16fe0fd 100644
--- a/gkeys/gkeys/seed.py
+++ b/gkeys/gkeys/seed.py
@@ -20,7 +20,7 @@ import json
 import os
 
 from gkeys.log import logger
-from gkeys.config import GKEY
+from gkeys.gkey import GKEY
 from gkeys.fileops import ensure_dirs
 
 

diff --git a/gkeys/gkeys/seedhandler.py b/gkeys/gkeys/seedhandler.py
index 2222bd2..33ed787 100644
--- a/gkeys/gkeys/seedhandler.py
+++ b/gkeys/gkeys/seedhandler.py
@@ -14,7 +14,7 @@ import os
 import re
 from json import load
 
-from gkeys.config import GKEY
+from gkeys.gkey import GKEY
 from gkeys.seed import Seeds
 from gkeys.fileops import ensure_dirs
 

Reply via email to