summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2010-07-21 20:30:22 -0400
committerGuillaume Seguin <guillaume@segu.in>2010-07-21 20:30:22 -0400
commitc9cb793e2341ac15c0228f0c84c09490323a53c7 (patch)
tree8191a95f0132709da1b60fd98f22ad5042140db6
parentaf0ff9578048ce1655e9a49fe4844506987ade1e (diff)
downloadblogit-c9cb793e2341ac15c0228f0c84c09490323a53c7.tar.gz
blogit-c9cb793e2341ac15c0228f0c84c09490323a53c7.tar.bz2
Reindent
-rw-r--r--raw_post68
-rw-r--r--raw_produce28
2 files changed, 48 insertions, 48 deletions
diff --git a/raw_post b/raw_post
index b5cee70..afd753c 100644
--- a/raw_post
+++ b/raw_post
@@ -10,7 +10,7 @@ repo = os.path.dirname (os.path.abspath (__file__))
os.chdir (repo)
if not os.path.exists (os.path.join (repo, ".git")):
- subprocess.call (["git", "init"])
+ subprocess.call (["git", "init"])
produce_path = os.path.join (repo, "produce")
produce_script = bz2.decompress (base64.b64decode ("""
@@ -18,46 +18,46 @@ PRODUCE_SCRIPT
""".strip ().replace ("\n", "")))
if not os.path.exists (produce_path):
- open (produce_path, "w").write (produce_script)
- os.chmod (produce_path, 0755)
+ open (produce_path, "w").write (produce_script)
+ os.chmod (produce_path, 0755)
for hook in ("post-receive", "post-commit"):
- hook_path = os.path.join (repo, ".git", "hooks", hook)
- if not os.path.exists (hook_path) \
- or os.path.realpath (hook_path) != produce_path:
- if os.path.lexists (hook_path): os.remove (hook_path)
- os.symlink (produce_path, hook_path)
+ hook_path = os.path.join (repo, ".git", "hooks", hook)
+ if not os.path.exists (hook_path) \
+ or os.path.realpath (hook_path) != produce_path:
+ if os.path.lexists (hook_path): os.remove (hook_path)
+ os.symlink (produce_path, hook_path)
if "--unpack" in sys.argv:
- print "Unpack only"
- raise SystemExit
+ print "Unpack only"
+ raise SystemExit
if "--raw" in sys.argv:
- p = subprocess.Popen (["git", "commit", "--allow-empty"])
- p.communicate ()
+ p = subprocess.Popen (["git", "commit", "--allow-empty"])
+ p.communicate ()
else:
- title = raw_input ("Post title ? ")
- editor = "vi"
- if "VISUAL" in os.environ:
- editor = os.environ["VISUAL"]
- elif "EDITOR" in os.environ:
- editor = os.environ["EDITOR"]
-
- contents_path = os.path.join (repo, CONTENTS_FILE)
-
- ret = subprocess.call ([editor, contents_path])
- if ret == 0:
- contents = open (contents_path).read ()
- os.remove (contents_path)
- else:
- print "A problem occured while editing the contents file"
- raise SystemExit
-
- p = subprocess.Popen (["git", "commit", "--allow-empty", "-F", "-"],
- stdin = subprocess.PIPE)
- p.communicate ("%s\n\n%s" % (title, contents))
+ title = raw_input ("Post title ? ")
+ editor = "vi"
+ if "VISUAL" in os.environ:
+ editor = os.environ["VISUAL"]
+ elif "EDITOR" in os.environ:
+ editor = os.environ["EDITOR"]
+
+ contents_path = os.path.join (repo, CONTENTS_FILE)
+
+ ret = subprocess.call ([editor, contents_path])
+ if ret == 0:
+ contents = open (contents_path).read ()
+ os.remove (contents_path)
+ else:
+ print "A problem occured while editing the contents file"
+ raise SystemExit
+
+ p = subprocess.Popen (["git", "commit", "--allow-empty", "-F", "-"],
+ stdin = subprocess.PIPE)
+ p.communicate ("%s\n\n%s" % (title, contents))
if p.returncode == 0: print "New post successfully added"
else:
- print "Couldn't add new post"
- sys.exit (1)
+ print "Couldn't add new post"
+ sys.exit (1)
diff --git a/raw_produce b/raw_produce
index cb71304..16a210f 100644
--- a/raw_produce
+++ b/raw_produce
@@ -5,9 +5,9 @@ import os
import sys
if "GIT_DIR" in os.environ:
- repo = os.path.abspath (os.path.join (os.environ["GIT_DIR"], ".."))
+ repo = os.path.abspath (os.path.join (os.environ["GIT_DIR"], ".."))
else:
- repo = os.path.dirname (os.path.abspath (__file__))
+ repo = os.path.dirname (os.path.abspath (__file__))
out_path = os.path.join (repo, "index.html")
description = open (os.path.join (repo, ".git", "description")).read ()
@@ -62,18 +62,18 @@ format = "%n".join ([bits[bit] for bit in bits_list])
posts = []
for k in range (10):
- p = subprocess.Popen (["git", "log", "--no-merges", "--date-order",
- "--pretty=format:" + format,
- "--skip=%d" % k, "--max-count=1"],
- stdout = subprocess.PIPE,
- stderr = subprocess.PIPE)
- out, _ = p.communicate ()
- if p.returncode != 0 or not out.strip ():
- break
- out = out.split ("\n", len (bits_list))
- bits = dict ([(bits_list[i], out[i]) for i in range (len (bits_list))])
- bits["body"] = bits["body"].replace ("\n", "<br />")
- posts.append (post_template % bits)
+ p = subprocess.Popen (["git", "log", "--no-merges", "--date-order",
+ "--pretty=format:" + format,
+ "--skip=%d" % k, "--max-count=1"],
+ stdout = subprocess.PIPE,
+ stderr = subprocess.PIPE)
+ out, _ = p.communicate ()
+ if p.returncode != 0 or not out.strip ():
+ break
+ out = out.split ("\n", len (bits_list))
+ bits = dict ([(bits_list[i], out[i]) for i in range (len (bits_list))])
+ bits["body"] = bits["body"].replace ("\n", "<br />")
+ posts.append (post_template % bits)
html = global_template % {"title": description,
"content": "\n".join (posts)}