Mercurial > p > roundup > code
comparison roundup/install_util.py @ 409:fc461bf67c99
Added .newitem extension
| author | Jürgen Hermann <jhermann@users.sourceforge.net> |
|---|---|
| date | Sat, 24 Nov 2001 01:00:13 +0000 |
| parents | bdc2ea127ae9 |
| children | 9b910e8d987d |
comparison
equal
deleted
inserted
replaced
| 408:424bfccd4118 | 409:fc461bf67c99 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: install_util.py,v 1.6 2001-11-22 15:46:42 jhermann Exp $ | 18 # $Id: install_util.py,v 1.7 2001-11-24 01:00:13 jhermann Exp $ |
| 19 | 19 |
| 20 __doc__ = """ | 20 __doc__ = """ |
| 21 Support module to generate and check fingerprints of installed files. | 21 Support module to generate and check fingerprints of installed files. |
| 22 """ | 22 """ |
| 23 | 23 |
| 24 import os, sha, shutil | 24 import os, sha, shutil |
| 25 | 25 |
| 26 sgml_file_types = [".xml", ".ent", ".html", ".filter", ".index", ".item"] | 26 # ".filter", ".index", ".item", ".newitem" are roundup-specific |
| 27 sgml_file_types = [".xml", ".ent", ".html", ".filter", ".index", ".item", ".newitem"] | |
| 27 hash_file_types = [".py", ".sh", ".conf", ".cgi", ''] | 28 hash_file_types = [".py", ".sh", ".conf", ".cgi", ''] |
| 28 slast_file_types = [".css"] | 29 slast_file_types = [".css"] |
| 29 | 30 |
| 30 digested_file_types = sgml_file_types + hash_file_types + slast_file_types | 31 digested_file_types = sgml_file_types + hash_file_types + slast_file_types |
| 31 | 32 |
| 79 self.digest.update(data) | 80 self.digest.update(data) |
| 80 | 81 |
| 81 def close(self): | 82 def close(self): |
| 82 file, ext = os.path.splitext(self.filename) | 83 file, ext = os.path.splitext(self.filename) |
| 83 | 84 |
| 84 # ".filter", ".index", ".item" are roundup-specific | |
| 85 if ext in sgml_file_types: | 85 if ext in sgml_file_types: |
| 86 self.file.write("<!-- SHA: %s -->\n" % (self.digest.hexdigest(),)) | 86 self.file.write("<!-- SHA: %s -->\n" % (self.digest.hexdigest(),)) |
| 87 elif ext in hash_file_types: | 87 elif ext in hash_file_types: |
| 88 self.file.write("#SHA: %s\n" % (self.digest.hexdigest(),)) | 88 self.file.write("#SHA: %s\n" % (self.digest.hexdigest(),)) |
| 89 elif ext in slast_file_types: | 89 elif ext in slast_file_types: |
| 147 if __name__ == '__main__': | 147 if __name__ == '__main__': |
| 148 test() | 148 test() |
| 149 | 149 |
| 150 # | 150 # |
| 151 # $Log: not supported by cvs2svn $ | 151 # $Log: not supported by cvs2svn $ |
| 152 # Revision 1.6 2001/11/22 15:46:42 jhermann | |
| 153 # Added module docstrings to all modules. | |
| 154 # | |
| 152 # Revision 1.5 2001/11/12 23:17:38 jhermann | 155 # Revision 1.5 2001/11/12 23:17:38 jhermann |
| 153 # Code using copyDigestedFile() that passes unit tests | 156 # Code using copyDigestedFile() that passes unit tests |
| 154 # | 157 # |
| 155 # Revision 1.4 2001/11/12 23:14:40 jhermann | 158 # Revision 1.4 2001/11/12 23:14:40 jhermann |
| 156 # Copy function, and proper handling of unknown file types | 159 # Copy function, and proper handling of unknown file types |
