]> khamidou — GitHub mirrors - pycco.git/commitdiff
Making pocco.py standalone, don't need the bin script
authorNick Fitzgerald <fitzgen@gmail.com>
Wed, 30 Jun 2010 04:02:51 +0000 (21:02 -0700)
committerNick Fitzgerald <fitzgen@gmail.com>
Wed, 30 Jun 2010 04:02:51 +0000 (21:02 -0700)
bin/pocco [deleted file]
pocco.py [changed mode: 0644->0755]

diff --git a/bin/pocco b/bin/pocco
deleted file mode 100755 (executable)
index 884d538..0000000
--- a/bin/pocco
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import sys
-
-lib = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
-cmd = "python %s %s" % (os.path.join(lib, 'pocco.py'),
-                        " ".join(sys.argv[1:]))
-
-print os.popen(cmd).read(),
old mode 100644 (file)
new mode 100755 (executable)
index 40e4691..667238e
--- a/pocco.py
+++ b/pocco.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 # **Pocco** is a Python port of [Docco](http://jashkenas.github.com/docco/ ):
 # the original quick-and-dirty, hundred-line-long, literate-programming-style
 # documentation generator. It produces HTML that displays your comments
@@ -43,6 +45,8 @@ def generate_documentation(source):
 #
 def parse(source, code):
     lines = code.split("\n")
+    if lines[0].startswith("#!"):
+        lines.pop(0)
     sections = []
     language = get_language(source)
     has_code = docs_text = code_text = ""
@@ -168,10 +172,12 @@ def template(source):
     return lambda context: pystache.render(source, context)
 
 # Create the template that we will use to generate the Pocco HTML page.
-pocco_template = template(open(path.dirname(__file__) + "/resources/pocco.html").read())
+pocco_template = template(open(path.join(path.dirname(__file__),
+                                         "resources/pocco.html")).read())
 
 # The CSS styles we"d like to apply to the documentation.
-pocco_styles = open(path.dirname(__file__) + "/resources/pocco.css").read()
+pocco_styles = open(path.join(path.dirname(__file__),
+                              "resources/pocco.css")).read()
 
 # The start of each Pygments highlight block.
 highlight_start = "<div class=\"highlight\"><pre>"