Mercurial > p > roundup > code
comparison roundup/install_util.py @ 388:2d92f93072f9
Code using copyDigestedFile() that passes unit tests
| author | Jürgen Hermann <jhermann@users.sourceforge.net> |
|---|---|
| date | Mon, 12 Nov 2001 23:17:38 +0000 |
| parents | c066d3c91728 |
| children | bdc2ea127ae9 |
comparison
equal
deleted
inserted
replaced
| 387:c066d3c91728 | 388:2d92f93072f9 |
|---|---|
| 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.4 2001-11-12 23:14:40 jhermann Exp $ | 18 # $Id: install_util.py,v 1.5 2001-11-12 23:17:38 jhermann Exp $ |
| 19 | 19 |
| 20 import os, sha, shutil | 20 import os, sha, shutil |
| 21 | 21 |
| 22 sgml_file_types = [".xml", ".ent", ".html", ".filter", ".index", ".item"] | 22 sgml_file_types = [".xml", ".ent", ".html", ".filter", ".index", ".item"] |
| 23 hash_file_types = [".py", ".sh", ".conf", ".cgi", ''] | 23 hash_file_types = [".py", ".sh", ".conf", ".cgi", ''] |
| 97 dst = os.path.join(dst, os.path.basename(src)) | 97 dst = os.path.join(dst, os.path.basename(src)) |
| 98 | 98 |
| 99 dummy, ext = os.path.splitext(src) | 99 dummy, ext = os.path.splitext(src) |
| 100 if ext not in digested_file_types: | 100 if ext not in digested_file_types: |
| 101 if copystat: | 101 if copystat: |
| 102 return shutil.copy2(srcname, dstname) | 102 return shutil.copy2(src, dst) |
| 103 else: | 103 else: |
| 104 return shutil.copyfile(srcname, dstname) | 104 return shutil.copyfile(src, dst) |
| 105 | 105 |
| 106 fsrc = None | 106 fsrc = None |
| 107 fdst = None | 107 fdst = None |
| 108 try: | 108 try: |
| 109 fsrc = open(src, 'r') | 109 fsrc = open(src, 'r') |
| 143 if __name__ == '__main__': | 143 if __name__ == '__main__': |
| 144 test() | 144 test() |
| 145 | 145 |
| 146 # | 146 # |
| 147 # $Log: not supported by cvs2svn $ | 147 # $Log: not supported by cvs2svn $ |
| 148 # Revision 1.4 2001/11/12 23:14:40 jhermann | |
| 149 # Copy function, and proper handling of unknown file types | |
| 150 # | |
| 148 # Revision 1.3 2001/11/12 22:38:48 richard | 151 # Revision 1.3 2001/11/12 22:38:48 richard |
| 149 # bleah typo | 152 # bleah typo |
| 150 # | 153 # |
| 151 # Revision 1.2 2001/11/12 22:37:13 richard | 154 # Revision 1.2 2001/11/12 22:37:13 richard |
| 152 # Handle all the various file formats in roundup | 155 # Handle all the various file formats in roundup |
