Commits

Kirill Simonov committed 12cd275

Generate and include the `htsql-ctl.1` man page to the source distribution.

  • Participants
  • Parent commits b2d22e6

Comments (0)

Files changed (4)

File tool/dist.py

 #
 
 
-from job import job, rm, rmtree, run, pipe, log
-import os, os.path, glob
+from job import job, ls, rm, rmtree, run, pipe, log
+import os, os.path
 
 
 def pipe_python(command, cd=None):
             if filename.endswith(".pyc") or filename.endswith(".pyo"):
                 filename = os.path.join(dirpath, filename)
                 rm(filename)
-    for filename in glob.glob("./HTSQL-*"):
+    for filename in ls("./HTSQL-*"):
         if os.path.isdir(filename):
             rmtree(filename)
 
 #
 
 
-import sys, os, re, shutil, subprocess
+import sys, os, re, shutil, glob, subprocess
 
 
 class settings(object):
     return value
 
 
+def ls(pattern):
+    # Return list of files matching the pattern.
+    return sorted(glob.glob(pattern))
+
+
 def cp(src_filename, dst_filename):
     # Copy a file.
     debug("copying: %s => %s" % (src_filename, dst_filename))
 #
 
 
-from job import job, log, debug, fatal, warn, run, cp, rmtree, mktree, pipe
+from job import job, log, debug, fatal, warn, run, ls, cp, rmtree, mktree, pipe
 from vm import LinuxBenchVM, WindowsBenchVM, DATA_ROOT, CTL_DIR
 from dist import pipe_python, setup_py
-import os, glob, re, StringIO, pprint
+import os, re, StringIO, pprint
 import setuptools
 import yaml
 
             move.variables['htsql-addons'] = addons
             mktree("./build/tmp")
             run("hg archive ./build/tmp/htsql")
-            for dirname in sorted(glob.glob("./build/tmp/htsql/src/*")):
+            for dirname in ls("./build/tmp/htsql/src/*"):
                 if os.path.basename(dirname) not in packages:
                     rmtree(dirname)
             packages = setuptools.find_packages("./build/tmp/htsql/src")
             if with_doc:
                 src_vm.run("cd htsql &&"
                            " PYTHONPATH=src sphinx-build -d doc doc doc/html")
+                for filename in ls("./build/tmp/htsql/doc/man/*.?.rst"):
+                    basename = os.path.basename(filename)
+                    target = basename[:-4]
+                    src_vm.run("rst2man htsql/doc/man/%s htsql/doc/man/%s"
+                               % (basename, target))
             src_vm.run("cd htsql && python setup.py sdist --formats=zip,gztar")
             if not os.path.exists("./build/pkg/src"):
                 mktree("./build/pkg/src")
         src_vm.stop()
     log()
     log("The generated source packages are placed in:")
-    for filename in sorted(glob.glob("./build/pkg/src/*")):
+    for filename in ls("./build/pkg/src/*"):
         log("  `%s`" % filename)
     log()
 
         self.vm = vm
         if self.vm.missing():
              raise fatal("VM is not built: %s" % self.vm.name)
-        source_paths = glob.glob("./build/pkg/src/HTSQL-*.tar.gz")
+        source_paths = ls("./build/pkg/src/HTSQL-*.tar.gz")
         if not source_paths:
             raise fatal("cannot find a source package; run `job pkg-src` first")
         if len(source_paths) > 1:
     to PyPI.  The distributions must be already built with
     `job pkg-src`.
     """
-    if not (glob.glob("./build/pkg/src/HTSQL-*.tar.gz") and
-            glob.glob("./build/pkg/src/HTSQL-*.zip")):
+    if not (ls("./build/pkg/src/HTSQL-*.tar.gz") and
+            ls("./build/pkg/src/HTSQL-*.zip")):
         raise fatal("cannot find source packages; run `job pkg-src` first")
     if os.path.exists("./build/tmp"):
         rmtree("./build/tmp")
     mktree("./build/tmp")
     archives = []
-    for tgzname in sorted(glob.glob("./build/pkg/src/*.tar.gz")):
+    for tgzname in ls("./build/pkg/src/*.tar.gz"):
         dirname = tgzname[:-7]
         zipname = dirname+".zip"
         dirname = os.path.basename(dirname)
 
 
 from job import (job, settings, run, pipe, exe, log, debug, warn, fatal, prompt,
-                 cp, rm, mktree, rmtree)
-import os, os.path, glob, urllib2, socket, datetime, time, re, tempfile
+                 ls, cp, rm, mktree, rmtree)
+import os, os.path, urllib2, socket, datetime, time, re, tempfile
 
 
 VM_ROOT = "./vm-build"
         if not self.running():
             return []
         ports = []
-        for filename in glob.glob(CTL_DIR+"/port.*"):
+        for filename in ls(CTL_DIR+"/port.*"):
             name = open(filename).read().strip()
             if name == self.name:
                 port = int(filename.rsplit(".", 1)[-1])
         if self.running():
             raise fatal("VM is already running: %s" % self.name)
         log("starting VM: %s" % self.name)
-        for filename in glob.glob(CTL_DIR+"/port.*"):
+        for filename in ls(CTL_DIR+"/port.*"):
             name = open(filename).read().strip()
             if name == self.name:
                 rm(filename)