public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2015-01-05 23:12 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2015-01-05 23:12 UTC (permalink / raw
  To: gentoo-commits

commit:     4485a6e491b7df9fa54314bae87df4d29318867e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  5 01:01:08 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan  5 22:15:18 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=4485a6e4

py2man: Make authors configurable

---
 py2man/command.template     |  5 +----
 py2man/manpages.py          | 15 +++++++++++++--
 py2man/sub-command.template |  5 +----
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/py2man/command.template b/py2man/command.template
index 71ee35e..5879a05 100644
--- a/py2man/command.template
+++ b/py2man/command.template
@@ -22,10 +22,7 @@ Please assign bug to <gkeys@gentoo.org> email alias.
 Gentoo Keys project is under GPL-2 License.
 
 .SH AUTHORS
-.br
-Brian Dolbec <dolsen@gentoo.org>
-.br
-Pavlos Ratis <dastergon@gentoo.org>
+%(authors)
 
 .SH "SEE ALSO"
 .BR gkeys.conf (1),

diff --git a/py2man/manpages.py b/py2man/manpages.py
index 2490fcc..0fd82ed 100644
--- a/py2man/manpages.py
+++ b/py2man/manpages.py
@@ -22,11 +22,12 @@ SubCmdHdr = '.SH \\  %s'
 
 class ManPage(object):
 
-    def __init__(self, prog, version, template, path):
+    def __init__(self, prog, version, template, docpath, authors):
         self.prog = prog
         self.version = version
         self.template = template
-        self.path = path
+        self.path = docpath
+        self.authors = authors
 
 
     @staticmethod
@@ -62,6 +63,14 @@ class ManPage(object):
 
 
     @staticmethod
+    def gen_brlist(_list):
+        output = []
+        for member in _list:
+            output.append(BreakStr % member)
+        return '\n'.join(output)
+
+
+    @staticmethod
     def gen_actions(actions):
         acts = []
         for act in actions:
@@ -113,6 +122,7 @@ class ManPage(object):
         data['prog'] = self.prog
         data['version'] = self.version
         data['date'] = datetime.strftime(datetime.today(),'%B %d, %Y')
+        data['authors'] = self.gen_brlist(self.authors)
         data['action'] = action
         data['actions'] = self.gen_actions(actions)
         data['options'] = self.gen_options(Action_Map[action]['options'])
@@ -154,6 +164,7 @@ class ManPage(object):
         data['prog'] = self.prog
         data['version'] = self.version
         data['date'] = datetime.strftime(datetime.today(),'%B %d, %Y')
+        data['authors'] = self.gen_brlist(self.authors)
         data['actions'] = self.gen_actions(list(prog_map['sub-cmds']))
         data['options'] = self.gen_options(prog_map['options'])
         data['desc'] = prog_map['desc']

diff --git a/py2man/sub-command.template b/py2man/sub-command.template
index 41de926..89d1b1b 100644
--- a/py2man/sub-command.template
+++ b/py2man/sub-command.template
@@ -25,10 +25,7 @@ Please assign bug to <gkeys@gentoo.org> email alias.
 Gentoo Keys project is under GPL-2 License.
 
 .SH AUTHORS
-.br
-Brian Dolbec <dolsen@gentoo.org>
-.br
-Pavlos Ratis <dastergon@gentoo.org>
+%(authors)
 
 .SH "SEE ALSO"
 .BR gkeys (1),


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2015-01-05 23:12 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2015-01-05 23:12 UTC (permalink / raw
  To: gentoo-commits

commit:     4ca72a8d531a7a794b1973a01f792836bb42ed18
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  3 18:13:18 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan  5 22:14:35 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=4ca72a8d

Initial py2man pkg for auto-generating our man pages

---
 py2man/__init__.py |   1 +
 py2man/manpages.py | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 py2man/options.py  |  93 +++++++++++++++++++++++++++++
 3 files changed, 266 insertions(+)

diff --git a/py2man/__init__.py b/py2man/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/py2man/__init__.py
@@ -0,0 +1 @@
+

diff --git a/py2man/manpages.py b/py2man/manpages.py
new file mode 100644
index 0000000..2490fcc
--- /dev/null
+++ b/py2man/manpages.py
@@ -0,0 +1,172 @@
+#
+#-*- coding:utf-8 -*-
+
+
+import os
+from datetime import datetime
+
+from .options import LONG_OPTIONS, SHORT_OPTS
+
+
+ActionStr = '.BR gkeys-%s (1),'
+
+ExampleHeader = '''.SH Example'''
+
+BreakStr = '''.br
+%s'''
+
+SubCmdStr = '''.IP %(cmd)s
+%(cmd-desc)s'''
+
+SubCmdHdr = '.SH \\  %s'
+
+class ManPage(object):
+
+    def __init__(self, prog, version, template, path):
+        self.prog = prog
+        self.version = version
+        self.template = template
+        self.path = path
+
+
+    @staticmethod
+    def gen_opts(options):
+        _opts = list()
+        for opt in options:
+            _opts.append(SHORT_OPTS.get(opt))
+        return _opts
+
+
+    @staticmethod
+    def gen_optsStr(firstline, data, opts):
+        indent = '                                 '
+        escapes = 15
+        wrapl = 72 + escapes
+        output = []
+        line = firstline.rstrip('%(opts)s') % data
+        ll = len(line)
+        l1 = True
+        for opt in opts:
+            if (ll + len(SHORT_OPTS[opt])) < wrapl:
+                line = line + '%s ' % SHORT_OPTS[opt]
+                ll = len(line)
+            else:
+                if l1:
+                    output.append(line)
+                    l1 = False
+                else:
+                    output.append(BreakStr % line)
+                line = indent + '%s ' % SHORT_OPTS[opt]
+                ll = len(line)
+        return '\n'.join(output)
+
+
+    @staticmethod
+    def gen_actions(actions):
+        acts = []
+        for act in actions:
+            if not act.startswith("--"):
+                acts.append(ActionStr % act)
+        return '\n'.join(acts)
+
+
+    @staticmethod
+    def gen_options(options):
+        _opts = []
+        for opt in options:
+            _opts.append(LONG_OPTIONS[opt])
+        return '\n'.join(_opts)
+
+
+    @staticmethod
+    def gen_example(text):
+        example = []
+        if text:
+            for line in text.split('\n'):
+                if line and line[0] in [' ']:
+                    example.append(line)
+                else:
+                    example.append(BreakStr % line)
+        return '\n'.join(example)
+
+
+    @staticmethod
+    def gen_subcmd(cmds):
+        #print(cmds.values())
+        output = []
+        for cmd in list(cmds):
+            print(cmd)
+            if cmd.startswith('--'):
+                output.append(SubCmdHdr % cmd.strip('-').upper())
+            else:
+                output.append(SubCmdStr % {'cmd': cmd, 'cmd-desc': cmds[cmd]})
+        return '\n'.join(output)
+
+
+    def make_subpage(self, action, Action_Map, actions):
+        '''Create and saves one sub-command man page using the
+        classes template definition setting'''
+        actions.remove(action)
+        # remove the help group separators
+        actions = [x for x in actions if not x.startswith("---")]
+        data = {}
+        data['prog'] = self.prog
+        data['version'] = self.version
+        data['date'] = datetime.strftime(datetime.today(),'%B %d, %Y')
+        data['action'] = action
+        data['actions'] = self.gen_actions(actions)
+        data['options'] = self.gen_options(Action_Map[action]['options'])
+        data['desc'] = Action_Map[action]['desc']
+        data['long_desc'] = Action_Map[action]['long_desc']
+        if Action_Map[action]['example']:
+            data['example'] = self.gen_example(Action_Map[action]['example'])
+            data['exampleheader'] = ExampleHeader
+        else:
+            data['example'] = ''
+            data['exampleheader'] = ''
+        doc = []
+        for line in self.template.split('\n'):
+            if '%(opts)s' in line:
+                doc.append(self.gen_optsStr(
+                    line, data, Action_Map[action]['options']))
+            else:
+                doc.append(line % data)
+        filepath = os.path.join(self.path, "%s-%s.1" % (self.prog, action))
+        with open(filepath, 'w', encoding='utf-8') as man:
+            man.write('\n'.join(doc))
+
+
+    def make_subpages(self, Action_Map, actions):
+        '''Create man pages for all sub-commands listed
+
+        @param prog: string of the base application command
+        @param version: string to embed in the man pages
+        @param Action_Map: Dictionary of sub-command actions and other data
+        @param actions: list of keys in Action_Map to generate pages for
+        @param location: string, path to save the newly created man pages
+        '''
+        for action in actions:
+            self.make_subpage(action, Action_Map, actions)
+
+
+    def make_prog(self, prog_map):
+        data = {}
+        data['prog'] = self.prog
+        data['version'] = self.version
+        data['date'] = datetime.strftime(datetime.today(),'%B %d, %Y')
+        data['actions'] = self.gen_actions(list(prog_map['sub-cmds']))
+        data['options'] = self.gen_options(prog_map['options'])
+        data['desc'] = prog_map['desc']
+        data['long_desc'] = prog_map['long_desc']
+        data['sub-cmds'] = self.gen_subcmd(prog_map['sub-cmds'])
+        doc = []
+        for line in self.template.split('\n'):
+                doc.append(line % data)
+        filepath = os.path.join(self.path, "%s.1" % (self.prog))
+        with open(filepath, 'w', encoding='utf-8') as man:
+            man.write('\n'.join(doc))
+
+    def read_template(self, path, filename):
+        filepath = os.path.join(path, filename)
+        with open(filepath, 'r', encoding='utf-8') as template:
+            self.template = template.read()

diff --git a/py2man/options.py b/py2man/options.py
new file mode 100644
index 0000000..1beb132
--- /dev/null
+++ b/py2man/options.py
@@ -0,0 +1,93 @@
+#
+#-*- coding:utf-8 -*-
+
+from collections import OrderedDict
+
+
+LONG_OPTIONS = OrderedDict({
+    'help': '''.IP "-h, --help"
+show this help message and exit''',
+    'status': '''.IP "-A, --status"
+Toggles the active status of a member for LDAP searches''',
+    'all': '''.IP "-a, --all"
+Toggles matching all input arguments for searches''',
+    'category': '''.IP "-C \\fICATEGORY\\fR, --category \\fICATEGORY"
+The category name of the seed file being added to.
+.br
+This name must be listed in the gkeys.conf file's
+[seeds], [seedurls] and [verify-seeds] sections''',
+    'cleankey': '''.IP " --clean-key"
+Clean the key from the keyring due to failures.''',
+    'cleanseed': '''.IP " --clean-seed"
+Clean the seed from the seedfile due to failures.
+.br
+Used during binary keyring release creation.''',
+    'config': '''.IP "-c \\fICONFIG\\fR, --config \\fICONFIG\\fR"
+The path to an alternate config file''',
+    'debug': '''.IP "-D, --debug \\fI{WARNING,INFO,FATAL,NOTSET,WARN,DEBUG,ERROR,CRITICAL}\\fR"
+The logging level to set for the logfile''',
+    'dest': '''.IP "-d \\fIDESTINATION\\fR, --dest \\fIDESTINATION"
+The category name of the seed file being added to.''',
+    'exact': '''.IP "-e, --exact"
+Use CASE matching in searches''',
+    'file': '''.IP "-F \\fIFILENAME\\fR, --file \\fIFILENAME"
+The path/URL to use for the (signed) file''',
+    '1file': '''.IP "-F \\fIFILENAME\\fR, --file \\fIFILENAME"
+The path/URL to use for the (signed) file''',
+    'fingerprint': '''.IP "-f \\fIFINGERPRINT\\fR, --fingerprint \\fIFINGERPRINT"
+The fingerprint(s) of the the key(s) or subkey(s)''',
+    'gpgsearch': '''.IP "-g, --gpgsearch"
+Do a gpg search operation, rather than a gkey search''',
+    'homedir': '''.IP "-H \\fIHOMEDIR\\fR, --file \\fIHOMEDIR"
+The destination for the generated key''',
+    'keyid': '''.IP "-i \\fIKEYID\\fR, --keyid \\fIKEYID"
+The long keyid of the gpg key to search for''',
+    'keyring': '''.IP "-k \\fIKEYRING\\fR, --keyring \\fIKEYRING"
+The name of the keyring to use for verification, etc.''',
+    'keys': '''.IP "-K \\fIKEYS\\fR, --keys \\fIKEYS"
+The fingerprint(s) of the primary keys in the keyring.''',
+    'mail': '''.IP "-m \\fIEMAIL\\fR, --mail \\fIEMAIL"
+The email address to search for or use.''',
+    'nick': '''.IP "-n \\fINICK\\fR, --nick \\fINICK"
+The nick of the user whose gkey seed is being added''',
+    'name': '''.IP "-N \\fINAME\\fR, --name \\fINAME"
+The name of the user whose gkey seed is being added''',
+    'keydir': '''.IP "-r \\fIKEYDIR\\fR, --keydir \\fIKEYDIR"
+The key directory the key is to be installed to''',
+    'signature': '''.IP "-s \\fISIGNATURE\\fR, --signature \\fISIGNATURE"
+The path/URL to use for the signature.''',
+    'spec': '''.IP "-S \\fISPEC\\fR, --psec \\fISPEC"
+The spec file to use from the gkeys-gen.conf file.''',
+    'timestamp': '''.IP "-t, --timestamp"
+Turn on timestamp use.''',
+    'uid': '''.IP "-u \\fIUID\\fR, --uid \\fIUID"
+The user id(s) (and email) of the key(s) being added (optional)''',
+})
+
+SHORT_OPTS = OrderedDict({
+    'help': '[\\fB\\-h\\fR]',
+    'status': '[\\fB\\-A\\fR]',
+    'all': '[\\fB\\-a\\fR]',
+    'category': '[\\fB\\-C\\fR \\fICATEGORY\\fR]',
+    'cleankey': '[\\fB\\-\\-cleankey\\fR]',
+    'cleanseed': '[\\fB\\-\\-cleanseed\\fR]',
+    'dest': '[\\fB\\-d\\fR \\fIDESTINATION\\fR]',
+    'exact': '[\\fB\\-e\\fR]',
+    'file': '[\\fB\\-F\\fR \\fIFILENAME\\fR]',
+    '1file': '[\\fB\\-F\\fR \\fIFILENAME\\fR]',
+    'fingerprint': '[\\fB\\-f\\fR \\fIFINGERPRINT\\fR [\\fIFINGERPRINT\\fR ...]]',
+    'gpgsearch': '[\\fB\\-g\\fR]',
+    'homedir': '[\\fB\\-H\\fR \\fIHOMEDIR\\fR]',
+    'keyid': '[\\fB\\-i\\fR \\fIKEYID\\fR [\\fIKEYID\\fR ...]]',
+    'keyring': '[\\fB\\-k\\fR \\fIKEYRING\\fR]',
+    'keys': '[\\fB\\-K\\fR [\\fIKEYS\\fR [\\fIKEYS\\fR ...]]]',
+    'mail': '[\\fB\\-m\\fR \\fIEMAIL\\fR]',
+    'nick': '[\\fB\\-n\\fR \\fINICK\\fR]',
+    'name': '[\\fB\\-N\\fR [\\fINAME\\fR [\\fINAME\\fR ...]]]',
+    '1name': '[\\fB\\-N\\fR \\fINAME\\fR]',
+    'keydir': '[\\fB\\-r\\fR \\fIKEYDIR\\fR]',
+    'signature': '[\\fB\\-s\\fR \\fISIGNATURE\\fR]',
+    'spec': '[\\fB\\-S\\fR \\fISPEC\\fR]',
+    'timestamp': '[\\fB\\-t\\fR]',
+    'uid': '[\\fB\\-u\\fR [\\fIUID\\fR [\\fIUID\\fR ...]]]',
+})


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2015-01-05 23:12 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2015-01-05 23:12 UTC (permalink / raw
  To: gentoo-commits

commit:     1edc0ff77d24bd468ffc7d446aa8b2c9ed162f0d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  3 18:14:25 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan  5 22:14:35 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=1edc0ff7

py2man: Initial man templates

---
 py2man/command.template     | 34 ++++++++++++++++++++++++++++++++++
 py2man/sub-command.template | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)

diff --git a/py2man/command.template b/py2man/command.template
new file mode 100644
index 0000000..71ee35e
--- /dev/null
+++ b/py2man/command.template
@@ -0,0 +1,34 @@
+.TH "%(prog)s" "1" "version %(version)s, %(date)s" "GKEYS" ""
+.SH NAME
+%(prog)s \- %(desc)s
+.SH SYNOPSIS
+.B %(prog)s
+[\fB\-h\fR] [\fB\-c\fR \fICONFIG\fR] [\fB\-D\fR \fI{WARNING,INFO,FATAL,NOTSET,WARN,DEBUG,ERROR,CRITICAL}\fR] [\fBSUBCOMMAND] [\fBSUBCOMMAND-OPTION] ...
+.SH DESCRIPTION
+.PP
+
+.SH OPTIONAL ARGUMENTS
+%(options)s
+
+.SH SUBCOMMANDS
+%(sub-cmds)s
+
+.SH REPORTING BUGS
+Submit bug reports to http://bugs.gentoo.org.
+.br
+Please assign bug to <gkeys@gentoo.org> email alias.
+
+.SH COPYRIGHTS
+Gentoo Keys project is under GPL-2 License.
+
+.SH AUTHORS
+.br
+Brian Dolbec <dolsen@gentoo.org>
+.br
+Pavlos Ratis <dastergon@gentoo.org>
+
+.SH "SEE ALSO"
+.BR gkeys.conf (1),
+%(actions)s
+
+(This man page was auto-generated from source)

diff --git a/py2man/sub-command.template b/py2man/sub-command.template
new file mode 100644
index 0000000..41de926
--- /dev/null
+++ b/py2man/sub-command.template
@@ -0,0 +1,38 @@
+.TH "%(prog)s-%(action)s" "1" "version %(version)s, %(date)s" "GKEYS" ""
+.SH NAME
+%(prog)s %(action)s \- %(desc)s
+.SH SYNOPSIS
+.B %(prog)s
+[\\fBGLOBAL-OPTIONS\\fR] \\fB%(action)s \\f[-h] %(opts)s
+
+.SH DESCRIPTION
+.PP
+%(long_desc)s
+.SH OPTIONAL ARGUMENTS
+.IP "-h, --help"
+show this help message and exit
+%(options)s
+
+%(exampleheader)s
+%(example)s
+
+.SH REPORTING BUGS
+Submit bug reports to http://bugs.gentoo.org.
+.br
+Please assign bug to <gkeys@gentoo.org> email alias.
+
+.SH COPYRIGHTS
+Gentoo Keys project is under GPL-2 License.
+
+.SH AUTHORS
+.br
+Brian Dolbec <dolsen@gentoo.org>
+.br
+Pavlos Ratis <dastergon@gentoo.org>
+
+.SH "SEE ALSO"
+.BR gkeys (1),
+.BR gkeys.conf (1),
+%(actions)s
+
+(This man page was auto-generated from source)


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2015-01-05 23:12 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2015-01-05 23:12 UTC (permalink / raw
  To: gentoo-commits

commit:     9a5dde8665ffd69785819a36c4d0f50d036dc0cf
Author:     Pavlos Ratis <dastergon <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  5 19:51:35 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan  5 22:21:54 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=9a5dde86

py2man: missed long_desc from command.template

---
 py2man/command.template | 1 +
 1 file changed, 1 insertion(+)

diff --git a/py2man/command.template b/py2man/command.template
index 36c1711..cd69ff2 100644
--- a/py2man/command.template
+++ b/py2man/command.template
@@ -8,6 +8,7 @@
 
 .SH DESCRIPTION
 .PP
+%(long_desc)s
 
 .SH OPTIONAL ARGUMENTS
 %(options)s


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2015-01-05 23:12 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2015-01-05 23:12 UTC (permalink / raw
  To: gentoo-commits

commit:     a051bd81ac741839c74c94060e4d509e3d4b06b0
Author:     Pavlos Ratis <dastergon <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  5 15:56:40 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan  5 22:21:53 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=a051bd81

py2man: tiny updates

---
 py2man/command.template     |  3 ++-
 py2man/manpages.py          | 16 +++++++---------
 py2man/sub-command.template |  3 ++-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/py2man/command.template b/py2man/command.template
index 5879a05..e2111e3 100644
--- a/py2man/command.template
+++ b/py2man/command.template
@@ -28,4 +28,5 @@ Gentoo Keys project is under GPL-2 License.
 .BR gkeys.conf (1),
 %(actions)s
 
-(This man page was auto-generated from source)
+.SH NOTE
+This is an auto-generated man page from source

diff --git a/py2man/manpages.py b/py2man/manpages.py
index 0fd82ed..d5828f8 100644
--- a/py2man/manpages.py
+++ b/py2man/manpages.py
@@ -5,12 +5,12 @@
 import os
 from datetime import datetime
 
-from .options import LONG_OPTIONS, SHORT_OPTS
+from options import LONG_OPTIONS, SHORT_OPTS
 
 
 ActionStr = '.BR gkeys-%s (1),'
 
-ExampleHeader = '''.SH Example'''
+EXAMPLEHEADER = '''.SH Example'''
 
 BreakStr = '''.br
 %s'''
@@ -45,12 +45,12 @@ class ManPage(object):
         wrapl = 72 + escapes
         output = []
         line = firstline.rstrip('%(opts)s') % data
-        ll = len(line)
+        line_len = len(line)
         l1 = True
         for opt in opts:
-            if (ll + len(SHORT_OPTS[opt])) < wrapl:
+            if (line_len + len(SHORT_OPTS[opt])) < wrapl:
                 line = line + '%s ' % SHORT_OPTS[opt]
-                ll = len(line)
+                line_len = len(line)
             else:
                 if l1:
                     output.append(line)
@@ -58,7 +58,7 @@ class ManPage(object):
                 else:
                     output.append(BreakStr % line)
                 line = indent + '%s ' % SHORT_OPTS[opt]
-                ll = len(line)
+                line_len = len(line)
         return '\n'.join(output)
 
 
@@ -101,10 +101,8 @@ class ManPage(object):
 
     @staticmethod
     def gen_subcmd(cmds):
-        #print(cmds.values())
         output = []
         for cmd in list(cmds):
-            print(cmd)
             if cmd.startswith('--'):
                 output.append(SubCmdHdr % cmd.strip('-').upper())
             else:
@@ -130,7 +128,7 @@ class ManPage(object):
         data['long_desc'] = Action_Map[action]['long_desc']
         if Action_Map[action]['example']:
             data['example'] = self.gen_example(Action_Map[action]['example'])
-            data['exampleheader'] = ExampleHeader
+            data['exampleheader'] = EXAMPLEHEADER
         else:
             data['example'] = ''
             data['exampleheader'] = ''

diff --git a/py2man/sub-command.template b/py2man/sub-command.template
index 89d1b1b..f15fa0e 100644
--- a/py2man/sub-command.template
+++ b/py2man/sub-command.template
@@ -32,4 +32,5 @@ Gentoo Keys project is under GPL-2 License.
 .BR gkeys.conf (1),
 %(actions)s
 
-(This man page was auto-generated from source)
+.SH NOTE
+This is an auto-generated man page from source


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2015-01-05 23:12 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2015-01-05 23:12 UTC (permalink / raw
  To: gentoo-commits

commit:     5a9953b6cab24723a677a8007855d0f8f0f81fc7
Author:     Pavlos Ratis <dastergon <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  5 18:35:37 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan  5 22:21:53 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=5a9953b6

py2man: updates for sake of consistency

---
 py2man/command.template     | 4 +++-
 py2man/manpages.py          | 4 ++--
 py2man/options.py           | 2 +-
 py2man/sub-command.template | 4 +++-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/py2man/command.template b/py2man/command.template
index e2111e3..36c1711 100644
--- a/py2man/command.template
+++ b/py2man/command.template
@@ -1,9 +1,11 @@
 .TH "%(prog)s" "1" "version %(version)s, %(date)s" "GKEYS" ""
 .SH NAME
 %(prog)s \- %(desc)s
+
 .SH SYNOPSIS
 .B %(prog)s
 [\fB\-h\fR] [\fB\-c\fR \fICONFIG\fR] [\fB\-D\fR \fI{WARNING,INFO,FATAL,NOTSET,WARN,DEBUG,ERROR,CRITICAL}\fR] [\fBSUBCOMMAND] [\fBSUBCOMMAND-OPTION] ...
+
 .SH DESCRIPTION
 .PP
 
@@ -14,7 +16,7 @@
 %(sub-cmds)s
 
 .SH REPORTING BUGS
-Submit bug reports to http://bugs.gentoo.org.
+Submit bug reports to https://bugs.gentoo.org.
 .br
 Please assign bug to <gkeys@gentoo.org> email alias.
 

diff --git a/py2man/manpages.py b/py2man/manpages.py
index d5828f8..cddd68f 100644
--- a/py2man/manpages.py
+++ b/py2man/manpages.py
@@ -5,7 +5,7 @@
 import os
 from datetime import datetime
 
-from options import LONG_OPTIONS, SHORT_OPTS
+from options import LONG_OPTS, SHORT_OPTS
 
 
 ActionStr = '.BR gkeys-%s (1),'
@@ -83,7 +83,7 @@ class ManPage(object):
     def gen_options(options):
         _opts = []
         for opt in options:
-            _opts.append(LONG_OPTIONS[opt])
+            _opts.append(LONG_OPTS[opt])
         return '\n'.join(_opts)
 
 

diff --git a/py2man/options.py b/py2man/options.py
index 1beb132..68134b0 100644
--- a/py2man/options.py
+++ b/py2man/options.py
@@ -4,7 +4,7 @@
 from collections import OrderedDict
 
 
-LONG_OPTIONS = OrderedDict({
+LONG_OPTS = OrderedDict({
     'help': '''.IP "-h, --help"
 show this help message and exit''',
     'status': '''.IP "-A, --status"

diff --git a/py2man/sub-command.template b/py2man/sub-command.template
index f15fa0e..0a6c1a8 100644
--- a/py2man/sub-command.template
+++ b/py2man/sub-command.template
@@ -1,6 +1,7 @@
 .TH "%(prog)s-%(action)s" "1" "version %(version)s, %(date)s" "GKEYS" ""
 .SH NAME
 %(prog)s %(action)s \- %(desc)s
+
 .SH SYNOPSIS
 .B %(prog)s
 [\\fBGLOBAL-OPTIONS\\fR] \\fB%(action)s \\f[-h] %(opts)s
@@ -8,6 +9,7 @@
 .SH DESCRIPTION
 .PP
 %(long_desc)s
+
 .SH OPTIONAL ARGUMENTS
 .IP "-h, --help"
 show this help message and exit
@@ -17,7 +19,7 @@ show this help message and exit
 %(example)s
 
 .SH REPORTING BUGS
-Submit bug reports to http://bugs.gentoo.org.
+Submit bug reports to https://bugs.gentoo.org.
 .br
 Please assign bug to <gkeys@gentoo.org> email alias.
 


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2015-01-06 21:45 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2015-01-06 21:45 UTC (permalink / raw
  To: gentoo-commits

commit:     bc947e9170f14f6bb4f1b3780dad3661bd5d0131
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  6 18:24:36 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jan  6 21:19:31 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=bc947e91

py2man/manpages.py: set date once, debug fixes

---
 py2man/manpages.py | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/py2man/manpages.py b/py2man/manpages.py
index cddd68f..8b87afa 100644
--- a/py2man/manpages.py
+++ b/py2man/manpages.py
@@ -2,6 +2,7 @@
 #-*- coding:utf-8 -*-
 
 
+import codecs
 import os
 from datetime import datetime
 
@@ -28,6 +29,7 @@ class ManPage(object):
         self.template = template
         self.path = docpath
         self.authors = authors
+        self.date = datetime.strftime(datetime.today(),'%B %d, %Y')
 
 
     @staticmethod
@@ -110,16 +112,15 @@ class ManPage(object):
         return '\n'.join(output)
 
 
-    def make_subpage(self, action, Action_Map, actions):
+    def make_subpage(self, action, Action_Map, _actions):
         '''Create and saves one sub-command man page using the
         classes template definition setting'''
+        actions = _actions[:]
         actions.remove(action)
-        # remove the help group separators
-        actions = [x for x in actions if not x.startswith("---")]
         data = {}
         data['prog'] = self.prog
         data['version'] = self.version
-        data['date'] = datetime.strftime(datetime.today(),'%B %d, %Y')
+        data['date'] = self.date
         data['authors'] = self.gen_brlist(self.authors)
         data['action'] = action
         data['actions'] = self.gen_actions(actions)
@@ -140,7 +141,7 @@ class ManPage(object):
             else:
                 doc.append(line % data)
         filepath = os.path.join(self.path, "%s-%s.1" % (self.prog, action))
-        with open(filepath, 'w', encoding='utf-8') as man:
+        with codecs.open(filepath, 'w', 'utf-8') as man:
             man.write('\n'.join(doc))
 
 
@@ -153,15 +154,16 @@ class ManPage(object):
         @param actions: list of keys in Action_Map to generate pages for
         @param location: string, path to save the newly created man pages
         '''
-        for action in actions:
-            self.make_subpage(action, Action_Map, actions)
+        _actions = [x for x in actions if not x.startswith('--')]
+        for action in _actions[:]:
+            self.make_subpage(action, Action_Map, _actions)
 
 
     def make_prog(self, prog_map):
         data = {}
         data['prog'] = self.prog
         data['version'] = self.version
-        data['date'] = datetime.strftime(datetime.today(),'%B %d, %Y')
+        data['date'] = self.date
         data['authors'] = self.gen_brlist(self.authors)
         data['actions'] = self.gen_actions(list(prog_map['sub-cmds']))
         data['options'] = self.gen_options(prog_map['options'])
@@ -170,12 +172,15 @@ class ManPage(object):
         data['sub-cmds'] = self.gen_subcmd(prog_map['sub-cmds'])
         doc = []
         for line in self.template.split('\n'):
+            try:
                 doc.append(line % data)
+            except:
+                print(line, data)
         filepath = os.path.join(self.path, "%s.1" % (self.prog))
-        with open(filepath, 'w', encoding='utf-8') as man:
+        with codecs.open(filepath, 'w', 'utf-8') as man:
             man.write('\n'.join(doc))
 
     def read_template(self, path, filename):
         filepath = os.path.join(path, filename)
-        with open(filepath, 'r', encoding='utf-8') as template:
+        with codecs.open(filepath, 'r', 'utf-8') as template:
             self.template = template.read()


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2015-01-06 21:45 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2015-01-06 21:45 UTC (permalink / raw
  To: gentoo-commits

commit:     513395f66ae7bfb83736f6166b919f6713e4b5f6
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  6 18:22:41 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jan  6 18:22:41 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=513395f6

py2man/*.template: Fix missed 's' in %(actions)s

---
 py2man/command.template     | 2 +-
 py2man/sub-command.template | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/py2man/command.template b/py2man/command.template
index cd69ff2..975a4bf 100644
--- a/py2man/command.template
+++ b/py2man/command.template
@@ -25,7 +25,7 @@ Please assign bug to <gkeys@gentoo.org> email alias.
 Gentoo Keys project is under GPL-2 License.
 
 .SH AUTHORS
-%(authors)
+%(authors)s
 
 .SH "SEE ALSO"
 .BR gkeys.conf (1),

diff --git a/py2man/sub-command.template b/py2man/sub-command.template
index 0a6c1a8..20010cb 100644
--- a/py2man/sub-command.template
+++ b/py2man/sub-command.template
@@ -27,7 +27,7 @@ Please assign bug to <gkeys@gentoo.org> email alias.
 Gentoo Keys project is under GPL-2 License.
 
 .SH AUTHORS
-%(authors)
+%(authors)s
 
 .SH "SEE ALSO"
 .BR gkeys (1),


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2015-01-06 21:45 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2015-01-06 21:45 UTC (permalink / raw
  To: gentoo-commits

commit:     b623e3b05f43513dea9919a7f2644c52a17f5fb0
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  6 18:26:03 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jan  6 21:19:39 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=b623e3b0

py2man/options.py: Add missed '1name' option

---
 py2man/options.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/py2man/options.py b/py2man/options.py
index 68134b0..87d19bf 100644
--- a/py2man/options.py
+++ b/py2man/options.py
@@ -52,6 +52,8 @@ The email address to search for or use.''',
 The nick of the user whose gkey seed is being added''',
     'name': '''.IP "-N \\fINAME\\fR, --name \\fINAME"
 The name of the user whose gkey seed is being added''',
+    '1name': '''.IP "-N \\fINAME\\fR, --name \\fINAME"
+The name of the user whose gkey seed is being added''',
     'keydir': '''.IP "-r \\fIKEYDIR\\fR, --keydir \\fIKEYDIR"
 The key directory the key is to be installed to''',
     'signature': '''.IP "-s \\fISIGNATURE\\fR, --signature \\fISIGNATURE"


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2015-01-07 23:39 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2015-01-07 23:39 UTC (permalink / raw
  To: gentoo-commits

commit:     fa65004a0aa58ae5d6762d7e278b0d130f10b749
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  7 23:35:38 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan  7 23:35:38 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=fa65004a

py2man/manpages.py: Use ensure_dirs from gkeys fileops

For sdist created tarballs, it was not including an empty doc dir.

---
 py2man/manpages.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/py2man/manpages.py b/py2man/manpages.py
index 9e75d2e..f060e50 100644
--- a/py2man/manpages.py
+++ b/py2man/manpages.py
@@ -6,6 +6,8 @@ import codecs
 import os
 from datetime import datetime
 
+from gkeys.fileops import ensure_dirs
+
 from py2man.options import LONG_OPTS, SHORT_OPTS
 
 
@@ -30,6 +32,11 @@ class ManPage(object):
         self.path = docpath
         self.authors = authors
         self.date = datetime.strftime(datetime.today(),'%B %d, %Y')
+        self.ensure_docdir()
+
+
+    def ensure_docdir(self):
+        ensure_dirs(self.path)
 
 
     @staticmethod


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: py2man/
@ 2018-07-07  5:23 Brian Dolbec
  0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2018-07-07  5:23 UTC (permalink / raw
  To: gentoo-commits

commit:     46f9dd411d23d4d50f2ad40d58b937cb5ffaec35
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  5 19:55:43 2018 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jul  7 05:22:14 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=46f9dd41

gkeys py2man: Add email option

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 py2man/options.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/py2man/options.py b/py2man/options.py
index 61a6230..e0ccd81 100644
--- a/py2man/options.py
+++ b/py2man/options.py
@@ -28,6 +28,8 @@ The path to an alternate config file''',
 The logging level to set for the logfile''',
     'dest': '''.IP "-d \\fIDESTINATION\\fR, --dest \\fIDESTINATION"
 The category name of the seed file being added to.''',
+    'email': '''.IP "-E \\fIEMAIL\\fR, --email \\fIEMAIL"
+Email parameter for sending email reminders.''',
     'exact': '''.IP "-e, --exact"
 Use CASE matching in searches''',
     'file': '''.IP "-F \\fIFILENAME\\fR, --file \\fIFILENAME"
@@ -77,6 +79,7 @@ SHORT_OPTS = OrderedDict({
     'cleanseed': '[\\fB\\-\\-cleanseed\\fR]',
     'dest': '[\\fB\\-d\\fR \\fIDESTINATION\\fR]',
     'exact': '[\\fB\\-e\\fR]',
+    'email': '[\\fB\\-E\\fR]',
     'file': '[\\fB\\-F\\fR \\fIFILENAME\\fR]',
     '1file': '[\\fB\\-F\\fR \\fIFILENAME\\fR]',
     'fingerprint': '[\\fB\\-f\\fR \\fIFINGERPRINT\\fR [\\fIFINGERPRINT\\fR ...]]',


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-07-07  5:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-05 23:12 [gentoo-commits] proj/gentoo-keys:master commit in: py2man/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2018-07-07  5:23 Brian Dolbec
2015-01-07 23:39 Brian Dolbec
2015-01-06 21:45 Brian Dolbec
2015-01-06 21:45 Brian Dolbec
2015-01-06 21:45 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox