Mercurial > p > roundup > code
comparison roundup/templatebuilder.py @ 602:c242455d9b46 config-0-4-0-branch
Brought the config branch up to date with HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 06 Feb 2002 04:05:55 +0000 |
| parents | bdc2ea127ae9 |
| children |
comparison
equal
deleted
inserted
replaced
| 601:912029653c1c | 602:c242455d9b46 |
|---|---|
| 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: templatebuilder.py,v 1.13 2001-11-22 15:46:42 jhermann Exp $ | 18 # $Id: templatebuilder.py,v 1.13.2.1 2002-02-06 04:05:54 richard Exp $ |
| 19 import errno, re | 19 import errno, re |
| 20 | 20 |
| 21 __doc__ = """ | 21 __doc__ = """ |
| 22 Collect template parts and create instance template files. | 22 Collect template parts and create instance template files. |
| 23 """ | 23 """ |
| 24 | 24 |
| 25 preamble = """ | 25 preamble = """ |
| 26 # Do Not Edit (Unless You Want To) | 26 # Do Not Edit (Unless You Want To) |
| 27 # This file automagically generated by roundup.htmldata.makeHtmlBase | 27 # This file automagically generated by roundup.templatebuilder.makeHtmlBase |
| 28 # | 28 # |
| 29 """ | 29 """ |
| 30 | 30 |
| 31 def makeHtmlBase(templateDir): | 31 def makeHtmlBase(templateDir): |
| 32 """ make a htmlbase.py file in the given templateDir, from the | 32 """ make a htmlbase.py file in the given templateDir, from the |
| 39 fd = open(os.path.join(templateDir, 'htmlbase.py'), 'w') | 39 fd = open(os.path.join(templateDir, 'htmlbase.py'), 'w') |
| 40 fd.write(preamble) | 40 fd.write(preamble) |
| 41 for file in filelist: | 41 for file in filelist: |
| 42 # skip the backup files created by richard's vim | 42 # skip the backup files created by richard's vim |
| 43 if file[-1] == '~': continue | 43 if file[-1] == '~': continue |
| 44 mangled_name = os.path.basename(re.sub(r'\.', 'DOT', file)) | 44 mangled_name = os.path.basename(file).replace('.','DOT') |
| 45 fd.write('%s = """'%mangled_name) | 45 fd.write('%s = """'%mangled_name) |
| 46 fd.write(re.sub(r'\$((Id|File|Log).*?)\$', r'dollar\1dollar', | 46 fd.write(re.sub(r'\$((Id|File|Log).*?)\$', r'dollar\1dollar', |
| 47 open(file).read(), re.I)) | 47 open(file).read(), re.I)) |
| 48 fd.write('"""\n\n') | 48 fd.write('"""\n\n') |
| 49 fd.close() | 49 fd.close() |
| 87 else: | 87 else: |
| 88 print "Usage: %s <template directory>"%sys.argv[0] | 88 print "Usage: %s <template directory>"%sys.argv[0] |
| 89 | 89 |
| 90 # | 90 # |
| 91 # $Log: not supported by cvs2svn $ | 91 # $Log: not supported by cvs2svn $ |
| 92 # Revision 1.14 2002/02/05 09:59:05 grubert | |
| 93 # . makeHtmlBase: re.sub under python 2.2 did not replace '.', string.replace does it. | |
| 94 # | |
| 95 # Revision 1.13 2001/11/22 15:46:42 jhermann | |
| 96 # Added module docstrings to all modules. | |
| 97 # | |
| 92 # Revision 1.12 2001/11/14 21:35:21 richard | 98 # Revision 1.12 2001/11/14 21:35:21 richard |
| 93 # . users may attach files to issues (and support in ext) through the web now | 99 # . users may attach files to issues (and support in ext) through the web now |
| 94 # | 100 # |
| 95 # Revision 1.11 2001/08/07 00:24:42 richard | 101 # Revision 1.11 2001/08/07 00:24:42 richard |
| 96 # stupid typo | 102 # stupid typo |
