[virt-tools-list] [virt-bootstrap] [PATCH v6 26/26] Add man page for virt-bootstrap

Radostin Stoyanov rstoyanov1 at gmail.com
Thu Aug 17 09:40:04 UTC 2017


---
 MANIFEST.in            |  1 +
 man/virt-bootstrap.pod | 42 ++++++++++++++++++++++++++++++++++++++++++
 setup.py               | 27 +++++++++++++++++++++++++++
 3 files changed, 70 insertions(+)
 create mode 100644 man/virt-bootstrap.pod

diff --git a/MANIFEST.in b/MANIFEST.in
index bd0eb08..61bb7fb 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,3 @@
 include README.md LICENSE
 recursive-include src *.py
+recursive-include man *
diff --git a/man/virt-bootstrap.pod b/man/virt-bootstrap.pod
new file mode 100644
index 0000000..eac88cb
--- /dev/null
+++ b/man/virt-bootstrap.pod
@@ -0,0 +1,42 @@
+
+=head1 NAME
+
+virt-bootstrap - Setup root file system for libvirt-based containers
+
+=head1 SYNOPSIS
+
+B<virt-bootstrap> [OPTIONS] URI DEST
+
+=head1 DESCRIPTION
+
+B<virt-bootstrap> is a tool providing an easy way to setup the root
+file system for libvirt-based containers. It allows to use either a
+tarball containing the file system, an image on a docker registry
+or virt-builder template and unpacks it either as a folder or in a
+qcow2 image with backing chains to mimic the docker layers.
+
+=head1 OPTIONS
+
+The following options are accepted when running C<virt-bootstrap>:
+
+=over 4
+
+=item B<-q>, B<--quiet>
+
+Suppresses messages notifying about current state or actions of virt-bootstrap
+
+=item B<-d>, B<--debug>
+
+Show debugging output messages
+
+=item B<-h>, B<--help>
+
+Display command line help summary
+
+=item B<--version>
+
+Show virt-bootstrap's version number and exit
+
+=back
+
+=cut
diff --git a/setup.py b/setup.py
index 0f617e4..bca9955 100755
--- a/setup.py
+++ b/setup.py
@@ -11,6 +11,7 @@ import os
 import sys
 import subprocess
 import setuptools
+from setuptools.command.install import install
 
 # pylint: disable=import-error, wrong-import-position
 sys.path.insert(0, 'src')  # noqa: E402
@@ -26,6 +27,27 @@ def read(fname):
         return fobj.read()
 
 
+class PostInstallCommand(install):
+    """
+    Post-installation commands.
+    """
+    def run(self):
+        """
+        Post install script
+        """
+        cmd = [
+            'pod2man',
+            '--center=Container bootstrapping tool',
+            '--name=VIRT-BOOTSTRAP',
+            '--release=%s' % virtBootstrap.__version__,
+            'man/virt-bootstrap.pod',
+            'man/virt-bootstrap.1'
+        ]
+        if subprocess.call(cmd) != 0:
+            raise RuntimeError("Building man pages has failed")
+        install.run(self)
+
+
 class CheckPylint(setuptools.Command):
     """
     Check python source files with pylint and pycodestyle.
@@ -114,9 +136,14 @@ setuptools.setup(
 
     ],
     cmdclass={
+        'install': PostInstallCommand,
         'pylint': CheckPylint
     },
 
+    data_files=[
+        ("share/man/man1", ['man/virt-bootstrap.1'])
+    ],
+
     tests_require=['mock>=2.0'],
 
     extras_require={
-- 
2.13.5




More information about the virt-tools-list mailing list