[Checkins] SVN: Sandbox/pcardune/z3c.recipe.sphinxdoc/src/ Get sphinx recipe working with the latest version of sphinx, and a

Paul Carduner paulcarduner at gmail.com
Mon Apr 28 01:30:18 EDT 2008


Log message for revision 85796:
  
  Get sphinx recipe working with the latest version of sphinx, and a
  patch which I have to submit.
  

Changed:
  _U  Sandbox/pcardune/z3c.recipe.sphinxdoc/src/
  U   Sandbox/pcardune/z3c.recipe.sphinxdoc/src/z3c/recipe/sphinxdoc/__init__.py
  U   Sandbox/pcardune/z3c.recipe.sphinxdoc/src/z3c/recipe/sphinxdoc/layout.html

-=-

Property changes on: Sandbox/pcardune/z3c.recipe.sphinxdoc/src
___________________________________________________________________
Name: svn:ignore
   + z3c.recipe.sphinxdoc.egg-info


Modified: Sandbox/pcardune/z3c.recipe.sphinxdoc/src/z3c/recipe/sphinxdoc/__init__.py
===================================================================
--- Sandbox/pcardune/z3c.recipe.sphinxdoc/src/z3c/recipe/sphinxdoc/__init__.py	2008-04-28 02:47:37 UTC (rev 85795)
+++ Sandbox/pcardune/z3c.recipe.sphinxdoc/src/z3c/recipe/sphinxdoc/__init__.py	2008-04-28 05:30:16 UTC (rev 85796)
@@ -24,9 +24,9 @@
 import pkg_resources
 
 confPyTemplate = """
-templates_path = ['.templates']
+templates_path = ['%(templatesDir)s']
 source_suffix = '.txt'
-master_doc = 'index'
+master_doc = '%(indexDoc)s'
 project = '%(project)s'
 copyright = '%(copyright)s'
 version = '%(version)s'
@@ -34,10 +34,16 @@
 today_fmt = '%%B %%d, %%Y'
 pygments_style = 'sphinx'
 html_style = 'default.css'
-html_static_path = ['.static']
+html_static_path = ['%(staticDir)s']
 html_last_updated_fmt = '%%b %%d, %%Y'
 """
 
+arg_template = """[
+  '-c', '%(CONFPATH)s',
+  '%(SRCPATH)s',
+  '%(BUILDPATH)s',
+  ]"""
+
 class ZopeOrgSetup(object):
 
     def __init__(self, buildout, name, options):
@@ -60,22 +66,15 @@
 
         #for each egg listed as a buildout option, create a configuration space.
         for doc in docs:
-            projectDir = join(installDir, doc.project_name)
-            if not os.path.isdir(projectDir):
-                os.mkdir(projectDir)
-            installed.append(projectDir)
-            confPyPath = join(projectDir, 'conf.py')
-            confPy = open(confPyPath, 'w')
-            confPy.write(confPyTemplate % {'project':doc.project_name,
-                                           'copyright':'some copyright',
-                                           'version': doc._version,
-                                           'release': doc._version})
-            confPy.close()
-            installed.append(confPyPath)
+            partDir = join(installDir, doc.project_name)
+            if not os.path.isdir(partDir):
+                os.mkdir(partDir)
+            installed.append(partDir)
 
             recipeDir = dirname(__file__)
 
-            staticDir = join(projectDir, '.static')
+            #create static directory
+            staticDir = join(partDir, '.static')
             if not os.path.isdir(staticDir):
                 os.mkdir(staticDir)
             installed.append(staticDir)
@@ -83,7 +82,8 @@
                         join(staticDir, 'default.css'))
             installed.append(join(staticDir, 'default.css'))
 
-            templatesDir = join(projectDir, '.templates')
+            #create tempaltes directory
+            templatesDir = join(partDir, '.templates')
             if not os.path.isdir(templatesDir):
                 os.mkdir(templatesDir)
             installed.append(templatesDir)
@@ -91,11 +91,33 @@
                         join(templatesDir, 'layout.html'))
             installed.append(join(templatesDir, 'layout.html'))
 
+
+            #create conf.py
+            confPyPath = join(partDir, 'conf.py')
+            confPy = open(confPyPath, 'w')
+            confPy.write(confPyTemplate % dict(project=doc.project_name,
+                                               copyright='some copyright',
+                                               version=doc._version,
+                                               release=doc._version,
+                                               staticDir=staticDir,
+                                               templatesDir=templatesDir,
+                                               indexDoc=self.options.get('indexDoc','index')
+                                               ))
+            confPy.close()
+            installed.append(confPyPath)
+
             buildDir = self.options.get('build-dir',
-                                        os.path.join(projectDir, 'build'))
+                                        os.path.join(partDir, 'build'))
             if not os.path.isdir(buildDir):
                 os.mkdir(buildDir)
 
+            defaults = self.options.get('defaults', '').strip()
+            if defaults:
+                defaults = '(%s) + ' % defaults
+
+            args = arg_template % dict(CONFPATH=partDir,
+                                       SRCPATH=".",
+                                       BUILDPATH=buildDir)
             installed.extend(zc.buildout.easy_install.scripts(
                 [(self.options['script'],
                   'sphinx',
@@ -104,15 +126,13 @@
                 self.options['executable'],
                 self.buildout['buildout']['bin-directory'],
                 extra_paths=self.egg.extra_paths,
-                #                arguments = defaults,
-                initialization = "print 'foo'",
+                ## arguments = defaults + args,
+                initialization = "import sys; sys.argv.extend(%s)" % args,
                 ))
 
         return installed
 
     update = install
-    ## def update(self):
-    ##     logging.getLogger(self.name).info('Updating???')
 
 
 def runSphinx():

Modified: Sandbox/pcardune/z3c.recipe.sphinxdoc/src/z3c/recipe/sphinxdoc/layout.html
===================================================================
--- Sandbox/pcardune/z3c.recipe.sphinxdoc/src/z3c/recipe/sphinxdoc/layout.html	2008-04-28 02:47:37 UTC (rev 85795)
+++ Sandbox/pcardune/z3c.recipe.sphinxdoc/src/z3c/recipe/sphinxdoc/layout.html	2008-04-28 05:30:16 UTC (rev 85796)
@@ -1,8 +1,9 @@
-{%- include "macros.html" %}
 {%- block doctype -%}
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
 {%- endblock %}
+{%- set reldelim1 = reldelim1 is not defined and ' &raquo;' or reldelim1 %}
+{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %}
 {%- macro relbar %}
 {# this macro needs to stay in layout.html due to it containing blocks #}
     <div class="related">
@@ -32,6 +33,64 @@
       </ul>
     </div>
 {%- endmacro %}
+{%- macro sidebar %}
+      {%- if builder != 'htmlhelp' %}
+      <div class="sidebar">
+        <div class="sidebarwrapper">
+          {%- block sidebarlogo %}
+          {%- if logo %}
+            <p><img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/></p>
+          {%- endif %}
+          {%- endblock %}
+          {%- block sidebartoc %}
+          {%- if display_toc %}
+            <h3>Table Of Contents</h3>
+            {{ toc }}
+          {%- endif %}
+          {%- endblock %}
+          {%- block sidebarrel %}
+          {%- if prev %}
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="{{ prev.link|e }}" title="previous chapter">{{ prev.title }}</a></p>
+          {%- endif %}
+          {%- if next %}
+            <h4>Next topic</h4>
+            <p class="topless"><a href="{{ next.link|e }}" title="next chapter">{{ next.title }}</a></p>
+          {%- endif %}
+          {%- endblock %}
+          {%- if sourcename %}
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+            {%- if builder == 'web' %}
+              <li><a href="#comments">Comments ({{ comments|length }} so far)</a></li>
+              <li><a href="{{ pathto('@edit/' + sourcename)|e }}">Suggest Change</a></li>
+              <li><a href="{{ pathto('@source/' + sourcename)|e }}">Show Source</a></li>
+            {%- elif builder == 'html' %}
+              <li><a href="{{ pathto('_sources/' + sourcename, true)|e }}">Show Source</a></li>
+            {%- endif %}
+            </ul>
+          {%- endif %}
+          {%- if customsidebar %}
+          {{ rendertemplate(customsidebar) }}
+          {%- endif %}
+          {%- block sidebarsearch %}
+          {%- if current_page_name != "search" %}
+            <h3>{{ builder == 'web' and 'Keyword' or 'Quick' }} search</h3>
+            <form class="search" action="{{ pathto('search') }}" method="get">
+              <input type="text" name="q" size="18"> <input type="submit" value="Go" />
+              <input type="hidden" name="check_keywords" value="yes" />
+              <input type="hidden" name="area" value="default" />
+            </form>
+            {%- if builder == 'web' %}
+            <p style="font-size: 90%">Enter a module, class or function name.</p>
+            {%- endif %}
+          {%- endif %}
+          {%- endblock %}
+        </div>
+      </div>
+      {%- endif %}
+{%- endmacro -%}
+
 <html>
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -117,16 +176,11 @@
 	<p>Here you can easily browse and search through the documentation.<br />&nbsp;</p>
       </div>
     </div>
-{%- block beforerelbar %}{% endblock %}
 {%- block relbar1 %}{{ relbar() }}{% endblock %}
-{%- block afterrelbar %}{% endblock %}
 
-{%- block beforesidebar1 %}{% endblock %}
 {%- block sidebar1 %}{# possible location for sidebar #}{% endblock %}
-{%- block aftersidebar1 %}{% endblock %}
 
-{%- block beforedocument %}
-{% endblock %}
+{%- block document %}
     <div class="document">
       <div class="documentwrapper">
       {%- if builder != 'htmlhelp' %}
@@ -139,17 +193,14 @@
         </div>
       {%- endif %}
       </div>
-{%- block afterdocument %}{% endblock %}
+{% endblock %}
 
-{%- block beforesidebar2 %}{% endblock %}
 {%- block sidebar2 %}{{ sidebar() }}{% endblock %}
-{%- block aftersidebar2 %}{% endblock %}
       <div class="clearer"></div>
     </div>
 
 {%- block relbar2 %}{{ relbar() }}{% endblock %}
 
-{%- block beforefooter %}{% endblock %}
 {%- block footer %}
     <div class="footer">
     {%- if hasdoc('copyright') %}
@@ -162,6 +213,5 @@
     {%- endif %}
     </div>
 {%- endblock %}
-{%- block afterfooter %}{% endblock %}
   </body>
 </html>



More information about the Checkins mailing list