Commits

anatoly techtonik  committed 53f47a6

patch to generate make.py command script alternative to Makefile

  • Participants
  • Parent commits 262c873

Comments (0)

Files changed (3)

File 322.improve-search-responsiveness.diff

 # HG changeset patch
 # Parent 3cc7871001e50efa79671fb816b5044f2d6cc938
 # User anatoly techtonik <techtonik@gmail.com>
+improve HTML search responsiveness
 
 diff -r 3cc7871001e5 sphinx/themes/basic/search.html
 --- a/sphinx/themes/basic/search.html	Sun Jun 20 14:23:59 2010 +0200

File 456.add-make.py.diff

+# HG changeset patch
+# Parent 3cc7871001e50efa79671fb816b5044f2d6cc938
+# User anatoly techtonik <techtonik@gmail.com>
+make.py - pythonic counterpart to make.bat
+
+diff -r 3cc7871001e5 sphinx/quickstart.py
+--- a/sphinx/quickstart.py	Sun Jun 20 14:23:59 2010 +0200
++++ b/sphinx/quickstart.py	Mon Jun 21 02:01:31 2010 +0300
+@@ -459,6 +459,60 @@
+ :end
+ '''
+ 
++MAKEPYFILE = '''\
++"""
++Helper user-friendly script to configure and run Sphinx
++"""
++
++# --- configuration ---
++
++SRCDIR = "%(rsrcdir)s"
++BUILDDIR = "%(rbuilddir)s"
++
++ALLSPHINXOPTS = ['-d', '%%s/doctrees' %% BUILDDIR, SRCDIR]
++
++# --- /configuration ---
++
++
++import sphinx
++import sys
++
++
++helpmsg = """\
++Please use `%%s <target>` where <target> is one of
++  html      to make standalone HTML files
++  dirhtml   to make HTML files named index.html in directories
++  pickle    to make pickle files
++  json      to make JSON files
++  htmlhelp  to make HTML files and a HTML help project
++  qthelp    to make HTML files and a qthelp project
++  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter
++  changes   to make an overview over all changed/added/deprecated items
++  linkcheck to check all external links for integrity
++  doctest   to run all doctests embedded in the documentation if enabled\
++""" %% sys.argv[0]
++commands = ["html", "dirhtml", "pickle", "json", "htmlhelp", "qthelp",
++           "latex", "changes", "linkcheck", "doctest"]
++
++if len(sys.argv) == 1:
++    print helpmsg
++    sys.exit(1)
++
++if sys.argv[1] not in commands:
++    print "Unknown target: %%s" %% sys.argv[1]
++    sys.exit(1)
++
++TARGET = sys.argv[1]
++
++
++newargv = [sys.argv[0], '-b', TARGET]
++newargv.extend(ALLSPHINXOPTS)
++newargv.append('%%s/%%s' %% (BUILDDIR, TARGET))
++
++
++sys.exit(sphinx.main(argv=newargv))
++'''
++
+ 
+ def mkdir_p(dir):
+     if path.isdir(dir):
+@@ -633,6 +687,8 @@
+     do_prompt(d, 'makefile', 'Create Makefile? (Y/n)', 'y', boolean)
+     do_prompt(d, 'batchfile', 'Create Windows command file? (Y/n)',
+               'y', boolean)
++    do_prompt(d, 'makepyfile', 'Create make.py command script? (Y/n)',
++              'y', boolean)
+ 
+     d['project_fn'] = make_filename(d['project'])
+     d['now'] = time.asctime()
+@@ -684,20 +740,25 @@
+     f.write((MASTER_FILE % d).encode('utf-8'))
+     f.close()
+ 
+-    if d['makefile']:
++    if d['makefile'] or d['batchfile'] or d['batchfile']:
+         d['rsrcdir'] = d['sep'] and 'source' or '.'
+         d['rbuilddir'] = d['sep'] and 'build' or d['dot'] + 'build'
+-        # use binary mode, to avoid writing \r\n on Windows
+-        f = open(path.join(d['path'], 'Makefile'), 'wb')
+-        f.write((MAKEFILE % d).encode('utf-8'))
+-        f.close()
+ 
+-    if d['batchfile']:
+-        d['rsrcdir'] = d['sep'] and 'source' or '.'
+-        d['rbuilddir'] = d['sep'] and 'build' or d['dot'] + 'build'
+-        f = open(path.join(d['path'], 'make.bat'), 'w')
+-        f.write((BATCHFILE % d).encode('utf-8'))
+-        f.close()
++        if d['makefile']:
++            # use binary mode, to avoid writing \r\n on Windows
++            f = open(path.join(d['path'], 'Makefile'), 'wb')
++            f.write((MAKEFILE % d).encode('utf-8'))
++            f.close()
++
++        if d['batchfile']:
++            f = open(path.join(d['path'], 'make.bat'), 'w')
++            f.write((BATCHFILE % d).encode('utf-8'))
++            f.close()
++
++        if d['makepyfile']:
++            f = open(path.join(d['path'], 'make.py'), 'w')
++            f.write((MAKEPYFILE % d).encode('utf-8'))
++            f.close()
+ 
+     print
+     print bold('Finished: An initial directory structure has been created.')
+456.add-make.py.diff
 322.improve-search-responsiveness.diff