diff options
-rw-r--r-- | build_manpage.py | 40 | ||||
-rw-r--r-- | doc/Changelog | 2 | ||||
-rw-r--r-- | portato/__init__.py | 10 | ||||
-rw-r--r-- | setup.cfg | 1 | ||||
-rw-r--r-- | setup.py | 6 |
5 files changed, 44 insertions, 15 deletions
diff --git a/build_manpage.py b/build_manpage.py index 8bdbf2f..ab609bf 100644 --- a/build_manpage.py +++ b/build_manpage.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- # -# This file is copied from http://andialbrecht.wordpress.com/2009/03/17/creating-a-man-page-with-distutils-and-optparse/ +# This file is originally from http://andialbrecht.wordpress.com/2009/03/17/creating-a-man-page-with-distutils-and-optparse/ +# +# Modified by René Neumann # """build_manpage command -- Generate man page from setup()""" @@ -19,17 +21,22 @@ class build_manpage(Command): user_options = [ ('output=', 'O', 'output file'), ('parser=', None, 'module path to optparser (e.g. mymod:func)'), + ('seealso=', None, 'list of manpages to put into the SEE ALSO section (e.g. bash:1)') ] def initialize_options(self): self.output = None self.parser = None + self.seealso = None def finalize_options(self): if self.output is None: raise DistutilsOptionError('\'output\' option is required') if self.parser is None: raise DistutilsOptionError('\'parser\' option is required') + + self.ensure_string_list('seealso') + mod_name, func_name = self.parser.split(':') fromlist = mod_name.split('.') try: @@ -46,10 +53,11 @@ class build_manpage(Command): return txt.replace('-', '\\-') def _write_header(self): + version = self.distribution.get_version() appname = self.distribution.get_name() ret = [] - ret.append('.TH %s 1 %s\n' % (self._markup(appname), - self._today.strftime('%Y\\-%m\\-%d'))) + ret.append('.TH %s 1 %s "%s v.%s"\n' % (self._markup(appname), + self._today.strftime('%Y\\-%m\\-%d'), appname, version)) description = self.distribution.get_description() if description: name = self._markup('%s - %s' % (self._markup(appname), @@ -72,6 +80,21 @@ class build_manpage(Command): ret.append(self._parser.format_option_help()) return ''.join(ret) + def _write_seealso (self): + ret = [] + if self.seealso is not None: + ret.append('.SH "SEE ALSO"\n') + + for i in self.seealso: + name, sect = i.split(":") + + if len(ret) > 1: + ret.append(',\n') + + ret.append('.BR %s (%s)' % (name, sect)) + + return ''.join(ret) + def _write_footer(self): ret = [] appname = self.distribution.get_name() @@ -79,11 +102,11 @@ class build_manpage(Command): self.distribution.get_author_email()) ret.append(('.SH AUTHORS\n.B %s\nwas written by %s.\n' % (self._markup(appname), self._markup(author)))) - homepage = self.distribution.get_url() - ret.append(('.SH DISTRIBUTION\nThe latest version of %s may ' - 'be downloaded from\n' - '.UR %s\n.UE\n' - % (self._markup(appname), self._markup(homepage),))) + # homepage = self.distribution.get_url() + # ret.append(('.SH DISTRIBUTION\nThe latest version of %s may ' + # 'be downloaded from\n' + # '.UR %s\n.UE .\n' + # % (self._markup(appname), self._markup(homepage),))) return ''.join(ret) def run(self): @@ -91,6 +114,7 @@ class build_manpage(Command): manpage.append(self._write_header()) manpage.append(self._write_options()) manpage.append(self._write_footer()) + manpage.append(self._write_seealso()) stream = open(self.output, 'w') stream.write(''.join(manpage)) stream.close() diff --git a/doc/Changelog b/doc/Changelog index dd0a3d6..944a962 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,8 @@ next: - allow lines w/o keyword in package.keywords - added support for ktsuss as su-frontend +- add man-page +- remove the deprecated -L cmdline option: use -F instead 0.12.1: - bugfixes diff --git a/portato/__init__.py b/portato/__init__.py index e54354a..653329c 100644 --- a/portato/__init__.py +++ b/portato/__init__.py @@ -40,17 +40,17 @@ def get_parser (use_ = False): if not use_: _ = lambda s : s - desc = "Portato - A Portage GUI." - usage = "%prog [options] [frontend]" + desc = "%prog - A Portage GUI." + usage = "%prog [options]" vers = "%%prog v. %s" % VERSION - parser = OptionParser(version = vers, prog = "Portato", description = desc, usage = usage) + parser = OptionParser(version = vers, prog = "portato", description = desc, usage = usage) parser.add_option("--shm", action = "store", nargs = 3, type="long", dest = "shm", help = SUPPRESS_HELP) - parser.add_option("-F", "--no-fork", "-L", action = "store_true", dest = "nofork", default = False, - help = _("do not fork off as root") + (" (%s)" % _("-L is deprecated"))) + parser.add_option("-F", "--no-fork", action = "store_true", dest = "nofork", default = False, + help = _("do not fork off as root")) return parser @@ -1,3 +1,4 @@ [build_manpage] output=portato.1 parser=portato:get_parser +seealso=portage:5, emerge:1 @@ -13,7 +13,7 @@ import sys, os, os.path from distutils.core import setup -from portato.constants import VERSION, DATA_DIR, ICON_DIR, PLUGIN_DIR, TEMPLATE_DIR +from portato.constants import VERSION, DATA_DIR, ICON_DIR, PLUGIN_DIR, TEMPLATE_DIR, APP from build_manpage import build_manpage @@ -28,9 +28,11 @@ data_files = [ (PLUGIN_DIR, plugin_list("gpytage", "notify", "etc_proposals", "reload_portage"))] # do the distutils setup -setup(name="Portato", +setup(name=APP, version = VERSION, description = "GTK-Frontend to Portage", + long_description = + """%s is a frontend to the package manager of Gentoo and related distributions: Portage. It is meant to be used for browsing the tree and installing packages and their dependencies. It knows how to deal with useflags and masked packages, so it can make handling packages a lot easier.""" % APP, license = "GPLv2", url = "http://portato.origo.ethz.ch/", author = "René 'Necoro' Neumann", |