use variables in appropriate places in python and emacs
File modified: bin/bgn.sh bin/blog-archive.py bin/hg2rss.py
Change353 at Sun Aug 22 22:55:57 2010 +0200 by Ivan Kanis <ivan@tao>
diff -r 11de1fd28eba -r 02c447b58941 bin/hg2rss.py --- a/bin/hg2rss.py Sun Aug 22 22:54:01 2010 +0200 +++ b/bin/hg2rss.py Sun Aug 22 22:55:57 2010 +0200 @@ -4,9 +4,9 @@ import os, re, cgi -home = os.getenv("HOME") -web_dir = home + "/hg/web/" +web_dir = os.getenv("WEB_DIR") + "/" single_page_dir = web_dir + "hgrss/" +version_control_dir = os.getenv("VERSION_CONTROL_DIR") matches = {'changeset' : re.compile("changeset: (.*):"), 'user' : re.compile("user: (.*)"), @@ -106,7 +106,7 @@ f.write(string) else: out_html.write(string) - + def output_entry(out_xml, out_html, value): if "description" in value: descriptions = value["description"].split("\n") @@ -175,8 +175,8 @@ return values def main(last_revision): - cache_xml = "hg-xml.cache" - cache_html = "hg-html.cache" + cache_xml = web_dir + "hg-xml.cache" + cache_html = web_dir + "hg-html.cache" cache = False if os.path.exists(cache_xml) and os.path.exists(cache_html): f = open(cache_xml, "r") @@ -208,6 +208,7 @@ if __name__ == "__main__": + os.chdir(version_control_dir) f = os.popen("hg log -l 1") r = re.compile("changeset: (.*):") m = r.match(f.read()) @@ -217,7 +218,7 @@ print "Impossible to find last revision." exit (1) f.close() - stamp = "hg2rss.stamp" + stamp = web_dir + "hg2rss.stamp" last_revision = "" if os.path.exists(stamp): f = open(stamp, "r") @@ -232,7 +233,6 @@ f = open(stamp, "w") f.write(revision) f.close() - # Local Variables: # compile-command: "python hg2rss.py" @@ -240,7 +240,6 @@ # Copyright (C) 2009 Ivan Kanis # Author: Ivan Kanis -# # # This program is free software ; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by