]> khamidou — GitHub mirrors - pycco.git/commitdiff
Moving the resources in to their own module to ensure that setup.py installs
authorNick Fitzgerald <fitzgen@gmail.com>
Fri, 9 Jul 2010 18:49:17 +0000 (11:49 -0700)
committerNick Fitzgerald <fitzgen@gmail.com>
Fri, 9 Jul 2010 18:49:17 +0000 (11:49 -0700)
them correctly.

pycco
pycco_resources/__init__.py [moved from pycco_resources/pycco.css with 86% similarity]
pycco_resources/pycco.html [deleted file]
setup.py

diff --git a/pycco b/pycco
index bc1ce3f8aa533dfc59890b7577cd57263568d085..e9a4866896df122e7af8096c2f70f86f317c9b0a 100755 (executable)
--- a/pycco
+++ b/pycco
@@ -110,6 +110,9 @@ def generate_html(source, sections):
 
 #### Helpers & Setup
 
+# This module contains all of our static resources.
+import pycco_resources
+
 # Import our external dependencies.
 import pygments
 import pystache
@@ -188,12 +191,10 @@ def template(source):
     return lambda context: pystache.render(source, context)
 
 # Create the template that we will use to generate the Pycco HTML page.
-pycco_template = template(open(path.join(path.dirname(__file__),
-                                         "resources/pycco.html")).read())
+pycco_template = template(pycco_resources.html)
 
 # The CSS styles we"d like to apply to the documentation.
-pycco_styles = open(path.join(path.dirname(__file__),
-                              "resources/pycco.css")).read()
+pycco_styles = pycco_resources.css
 
 # The start of each Pygments highlight block.
 highlight_start = "<div class=\"highlight\"><pre>"
similarity index 86%
rename from pycco_resources/pycco.css
rename to pycco_resources/__init__.py
index 921633b441bde11af6b89c0747a920e2104c7798..a7b8cd944ae47dfe60e3ac9ed000714f7a5035cd 100644 (file)
@@ -1,3 +1,4 @@
+css = """\
 /*--------------------- Layout and Typography ----------------------------*/
 body {
   font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
@@ -182,4 +183,54 @@ body .bp { color: #954121 }                     /* Name.Builtin.Pseudo */
 body .vc { color: #19469D }                     /* Name.Variable.Class */
 body .vg { color: #19469D }                     /* Name.Variable.Global */
 body .vi { color: #19469D }                     /* Name.Variable.Instance */
-body .il { color: #666666 }                     /* Literal.Number.Integer.Long */
\ No newline at end of file
+body .il { color: #666666 }                     /* Literal.Number.Integer.Long */
+"""
+
+html = """\
+<!DOCTYPE html>
+<html>
+<head>
+  <meta http-equiv="content-type" content="text/html;charset=utf-8">
+  <title>{{ title }}</title>
+  <link rel="stylesheet" href="pycco.css">
+</head>
+<body>
+<div id='container'>
+  <div id="background"></div>
+  {{#sources?}}
+  <div id="jump_to">
+    Jump To &hellip;
+    <div id="jump_wrapper">
+      <div id="jump_page">
+        {{#sources}}
+          <a class="source" href="{{ url }}">{{ basename }}</a>
+        {{/sources}}
+      </div>
+    </div>
+  </div>
+  {{/sources?}}
+  <table cellspacing=0 cellpadding=0>
+  <thead>
+    <tr>
+      <th class=docs><h1>{{ title }}</h1></th>
+      <th class=code></th>
+    </tr>
+  </thead>
+  <tbody>
+    {{#sections}}
+    <tr id='section-{{ num }}'>
+      <td class=docs>
+        <div class="octowrap">
+          <a class="octothorpe" href="#section-{{ num }}">#</a>
+        </div>
+        {{{ docs_html }}}
+      </td>
+      <td class=code>
+        <div class='highlight'><pre>{{{ code_html }}}</pre></div>
+      </td>
+    </tr>
+    {{/sections}}
+  </table>
+</div>
+</body>
+"""
diff --git a/pycco_resources/pycco.html b/pycco_resources/pycco.html
deleted file mode 100644 (file)
index 67ba4e0..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta http-equiv="content-type" content="text/html;charset=utf-8">
-  <title>{{ title }}</title>
-  <link rel="stylesheet" href="pycco.css">
-</head>
-<body>
-<div id='container'>
-  <div id="background"></div>
-  {{#sources?}}
-  <div id="jump_to">
-    Jump To &hellip;
-    <div id="jump_wrapper">
-      <div id="jump_page">
-        {{#sources}}
-          <a class="source" href="{{ url }}">{{ basename }}</a>
-        {{/sources}}
-      </div>
-    </div>
-  </div>
-  {{/sources?}}
-  <table cellspacing=0 cellpadding=0>
-  <thead>
-    <tr>
-      <th class=docs><h1>{{ title }}</h1></th>
-      <th class=code></th>
-    </tr>
-  </thead>
-  <tbody>
-    {{#sections}}
-    <tr id='section-{{ num }}'>
-      <td class=docs>
-        <div class="octowrap">
-          <a class="octothorpe" href="#section-{{ num }}">#</a>
-        </div>
-        {{{ docs_html }}}
-      </td>
-      <td class=code>
-        <div class='highlight'><pre>{{{ code_html }}}</pre></div>
-      </td>
-    </tr>
-    {{/sections}}
-  </table>
-</div>
-</body>
index 135657f88ef516930e3b1031101fda3d4c2e7e10..c7c0b5afe88dc42d9d73e7f88bafaa402111251d 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -7,4 +7,5 @@ setup(name="Pycco",
       author="Nick Fitzgerald",
       author_email="fitzgen@gmail.com",
       url="http://fitzgen.github.com/pocco",
+      packages=["pycco_resources"],
       scripts=["pycco"])