Skip to content

Commit a4f62fd

Browse files
author
Richard Jones
committed
Handle all the various file formats in roundup
1 parent 78dbbdb commit a4f62fd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

roundup/install_util.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: install_util.py,v 1.1 2001-11-12 22:26:32 jhermann Exp $
18+
# $Id: install_util.py,v 1.2 2001-11-12 22:37:13 richard Exp $
1919

2020
import os, sha
2121

@@ -32,10 +32,14 @@ def checkDigest(filename):
3232
# handle .py/.sh comment
3333
fingerprint = lines[-1][6:].strip()
3434
elif lines[-1][:10] == "<!-- SHA: ":
35-
# handle xml files
35+
# handle xml/html files
3636
fingerprint = lines[-1][10:]
3737
fingerprint = fingerprint.replace('-->', '')
3838
fingerprint = fingerprint.strip()
39+
elif lines[-1][:8] == "/* SHA: ":
40+
fingerprint = lines[-1][8:]
41+
fingerprint = fingerprint.replace('*/', '')
42+
fingerprint = fingerprint.strip()
3943
else:
4044
return 0
4145
del lines[-1]
@@ -66,10 +70,13 @@ def write(self, data):
6670
def close(self):
6771
file, ext = os.path.splitext(self.filename)
6872

69-
if ext in [".xml", ".ent"]:
73+
# ".filter", ".index", ".item" are roundup-specific
74+
if ext in [".xml", ".ent", ".html", ".filter", ".index", ".item"]:
7075
self.file.write("<!-- SHA: %s -->\n" % (self.digest.hexdigest(),))
71-
elif ext in [".py", ".sh", ".conf", '']:
76+
elif ext in [".py", ".sh", ".conf", ".cgi", '']:
7277
self.file.write("#SHA: %s\n" % (self.digest.hexdigest(),))
78+
elif ext in [".css"]:
79+
self.file.write("/* SHA: %s %/\n" % (self.digest.hexdigest(),))
7380

7481
self.file.close()
7582

@@ -101,4 +108,7 @@ def test():
101108

102109
#
103110
# $Log: not supported by cvs2svn $
111+
# Revision 1.1 2001/11/12 22:26:32 jhermann
112+
# Added install utils (digest calculation)
113+
#
104114

0 commit comments

Comments
 (0)