diff options
author | Jacek Konieczny <jajcus@jajcus.net> | 2005-12-26 18:28:56 +0300 |
---|---|---|
committer | Jacek Konieczny <jajcus@jajcus.net> | 2005-12-26 18:28:56 +0300 |
commit | ad73a73d90b3ac1730d7c7f670ff84f57f5a734c (patch) | |
tree | 3481b3efbe9513f09aef4c773b9d3d9682aebadc /auxtools | |
parent | 19a8ca80ae53f45ee57dd15957410f1e1ec51da1 (diff) |
- cosmetics
Diffstat (limited to 'auxtools')
-rwxr-xr-x | auxtools/code2xmi.py | 29 | ||||
-rwxr-xr-x | auxtools/htmlmerge.py | 3 | ||||
-rwxr-xr-x | auxtools/svn2log.py | 23 | ||||
-rwxr-xr-x | auxtools/xmimerge.py | 7 |
4 files changed, 33 insertions, 29 deletions
diff --git a/auxtools/code2xmi.py b/auxtools/code2xmi.py index 9d60ddb..9eccee0 100755 --- a/auxtools/code2xmi.py +++ b/auxtools/code2xmi.py @@ -11,7 +11,7 @@ def main(module_list): 'docformat':None, 'top':None, 'inheritance': None, 'ignore_param_mismatch': 0, 'alphabetical': 1} - + modules=_import(options['modules'],1) # Record the order of the modules in options. @@ -32,7 +32,7 @@ def main(module_list): def escape(s): return str(s).replace('&','&').replace('<','<').replace('>','>').replace('"','"').replace("'",''') - + class _Progress: """ @@ -70,7 +70,7 @@ class _Progress: @param argument: The object that is about to be processed. """ if self._verbosity <= 0: return - + if self._verbosity==1: if self._item_num == 1 and self._total_items <= 70: sys.stderr.write(' [') @@ -96,10 +96,10 @@ class _Progress: argument = os.path.join(d, file) else: fname = argument - + print >>sys.stderr, TRACE_FORMAT % (self._item_num, argument) self._item_num += 1 - + def _import(module_names, verbosity): """ @@ -129,7 +129,7 @@ def _import(module_names, verbosity): print >>sys.stderr, 'Importing %s modules.' % len(module_names) modules = [] progress = _Progress('Importing', verbosity, len(module_names)) - + for name in module_names: progress.report(name) # Import the module, and add it to the list. @@ -171,7 +171,7 @@ def _make_docmap(modules, options): print >>sys.stderr, ('Building API documentation for %d modules.' % len(modules)) progress = _Progress('Building docs for', verbosity, len(modules)) - + for module in modules: progress.report(module.__name__) # Add the module. Catch any exceptions that get generated. @@ -179,7 +179,7 @@ def _make_docmap(modules, options): except Exception, e: if options['debug']: raise else: _internal_error(e) - except: + except: if options['debug']: raise else: _internal_error() @@ -211,7 +211,7 @@ FOOTER=""" class Formatter: def __init__(self,docmap): self.docmap=docmap - + def format(self,modules=None): self.generalizations=[] ret=HEADER @@ -234,7 +234,7 @@ class Formatter: ret+="\n".join(self.generalizations)+"\n" ret+=FOOTER return ret - + def format_module(self,uid,recursive): if recursive: name=uid.shortname() @@ -257,7 +257,7 @@ class Formatter: uid=link.target() doc=self.docmap[uid] descr=doc.descr() - ret=(" <UML:Class xmi.id='%s' name='%s' comment='%s'>\n" + ret=(" <UML:Class xmi.id='%s' name='%s' comment='%s'>\n" % (escape(uid),escape(name),escape(descr.to_plaintext(None)))) for meth in doc.allmethods(): ret+=self.format_method(meth,doc) @@ -267,7 +267,7 @@ class Formatter: for base in doc.bases(): buid=base.target() g=(" <UML:Generalization xmi.id='%s(%s)'" - " child='%s' parent='%s' visibility='public'/>" + " child='%s' parent='%s' visibility='public'/>" % (escape(uid),escape(buid),escape(uid),escape(buid))) self.generalizations.append(g) return ret @@ -288,7 +288,7 @@ class Formatter: vis=" visibility='public'" else: vis=" visibility='private'" - return (" <UML:Attribute xmi.id='%s' name='%s' %s%s />\n" % + return (" <UML:Attribute xmi.id='%s' name='%s' %s%s />\n" % (escape(uid),escape(name),vis,descr)) def format_method(self,link,container): @@ -319,7 +319,8 @@ class Formatter: st=" stereotype='/Stereotype:staticmethod'" else: st="" - return (" <UML:Operation xmi.id='%s' name='%s' %s%s%s />\n" % + return (" <UML:Operation xmi.id='%s' name='%s' %s%s%s />\n" % (escape(uid),escape(name),vis,descr,st)) main(sys.argv[1:]) +# vi: sts=4 et sw=4 diff --git a/auxtools/htmlmerge.py b/auxtools/htmlmerge.py index 9027393..350e1d0 100755 --- a/auxtools/htmlmerge.py +++ b/auxtools/htmlmerge.py @@ -16,7 +16,8 @@ class Merger: nn=slot.addChild(node.copyNode(True)) output_doc.getRootElement().reconciliateNs(output_doc) return output_doc - + m=Merger(sys.argv[1],sys.argv[2]) out=m.merge() print out.serialize(format=True) +# vi: sts=4 et sw=4 diff --git a/auxtools/svn2log.py b/auxtools/svn2log.py index b04b148..fdbddfa 100755 --- a/auxtools/svn2log.py +++ b/auxtools/svn2log.py @@ -14,7 +14,7 @@ # 3. The name of the University may not be used to endorse or promote # products derived from this software without specific prior # written permission. -# +# # THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN @@ -63,7 +63,7 @@ def child(e, n): for c in e.children: if c.name == n: return c die("<%s> doesn't have <%s> child" % (e.name, n)) - + def convert_path(n): for src in reloc.keys(): n = string.replace(n, src, reloc[src]) @@ -143,7 +143,7 @@ class Entry: (time.strftime("%Y-%m-%d %H:%M +0000", time.localtime(self.beg_tm)), \ self.rev, convert_user(self.author))) out.write(self.msg) - + def can_join(self, other): return self.author == other.author and abs(self.tm - other.tm) < max_join_delta @@ -170,7 +170,7 @@ def process_entry(e): paths.append(nam + " (added)") else: paths.append(nam) - + if paths != []: return Entry(tm, rev, author, "\t* %s\n" % wrap_text(", ".join(paths) + ": " + msg, "\t ", 65)) @@ -181,9 +181,9 @@ def process(fin, fout): root = parser.parse(fin) if root.name != "log": die("root is not <log>") - + cur = None - + for logentry in root.children: if logentry.name != "logentry": die("non <logentry> <log> child") e = process_entry(logentry) @@ -195,7 +195,7 @@ def process(fin, fout): cur.dump(fout) cur = e else: cur = e - + if cur != None: cur.dump(fout) def usage(): @@ -205,7 +205,7 @@ Convert specified subversion xml logfile to GNU-style ChangeLog. Options: -p, --prefix=REGEXP set root directory of project (it will be striped off - from ChangeLog entries, paths outside it will be + from ChangeLog entries, paths outside it will be ignored) -x, --exclude=DIR exclude DIR from ChangeLog (relative to prefix) -o, --output set output file (defaults to 'ChangeLog') @@ -230,7 +230,7 @@ mark Marcus Blah <mb@example.org> Typical usage of this script is something like this: svn log -v --xml | %s -p '/foo/(branches/[^/]+|trunk)' -u aux/users - + Please send bug reports and comments to author: Michal Moskal <malekith@pld-linux.org> @@ -241,7 +241,7 @@ def utf_open(name, mode): def process_opts(): try: - opts, args = getopt.gnu_getopt(sys.argv[1:], "o:u:p:x:d:r:d:D:Fh", + opts, args = getopt.gnu_getopt(sys.argv[1:], "o:u:p:x:d:r:d:D:Fh", ["users=", "prefix=", "domain=", "delta=", "exclude=", "help", "output=", "relocate=", "list-format"]) @@ -267,7 +267,7 @@ def process_opts(): f = utf_open(a, "r") for line in f.xreadlines(): w = line.split() - if len(line) < 1 or line[0] == '#' or len(w) < 2: + if len(line) < 1 or line[0] == '#' or len(w) < 2: continue users[w[0]] = " ".join(w[1:]) elif o in ("--relocate", "-r"): @@ -296,3 +296,4 @@ if __name__ == "__main__": except AttributeError: pass process_opts() +# vi: sts=4 et sw=4 diff --git a/auxtools/xmimerge.py b/auxtools/xmimerge.py index de97d22..9364ad0 100755 --- a/auxtools/xmimerge.py +++ b/auxtools/xmimerge.py @@ -32,7 +32,7 @@ class Merger: new_root.addChild(n.docCopyNode(self.output_doc,True)) n=n.next return self.output_doc - + def merge_xmi_content(self,target,old_content): self.old_elements={} n=old_content.children @@ -67,7 +67,7 @@ class Merger: if n.type!="element": n=n.next continue - + new_node=target.addChild(n.docCopyNode(self.output_doc,False)) p=n.get_properties() while p: @@ -82,7 +82,7 @@ class Merger: val=old_val new_node.setProp(p.name,val) p=p.next - + npath="%s/%s:%s" % (path,n.name,n.prop("name")) auto_xmi_id=n.prop("xmi.id") xmi_id=self.xmi_id_map.get(npath) @@ -120,3 +120,4 @@ class Merger: m=Merger(sys.argv[1],sys.argv[2]) out=m.merge() print out.serialize(format=True) +# vi: sts=4 et sw=4 |