Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Jajcus/pyxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Konieczny <jajcus@jajcus.net>2004-12-03 21:08:56 +0300
committerJacek Konieczny <jajcus@jajcus.net>2004-12-03 21:08:56 +0300
commit462b56ee68e642b1c8715eea5460d503a7bdcd61 (patch)
treea38f524220c8eac26c6a021c6454ab7635d59d30 /auxtools
parent5325cacaaa8228f4041b9e3ee3e3af825e6690ed (diff)
- aux/ renamed to auxtools/ because of problems on Windows platform
Diffstat (limited to 'auxtools')
-rwxr-xr-xauxtools/cosmetics.sh5
-rw-r--r--auxtools/cosmetics.vim12
-rwxr-xr-xauxtools/pylint.sh42
-rw-r--r--auxtools/pylintrc216
-rwxr-xr-xauxtools/svn2log.py298
-rw-r--r--auxtools/users1
6 files changed, 574 insertions, 0 deletions
diff --git a/auxtools/cosmetics.sh b/auxtools/cosmetics.sh
new file mode 100755
index 0000000..3723c00
--- /dev/null
+++ b/auxtools/cosmetics.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+dir=`dirname $0`
+find . -name "*.py" | xargs -n1 vim -u NONE -s $dir/cosmetics.vim --cmd ":set ts=8"
+stty sane
diff --git a/auxtools/cosmetics.vim b/auxtools/cosmetics.vim
new file mode 100644
index 0000000..7ab9e2b
--- /dev/null
+++ b/auxtools/cosmetics.vim
@@ -0,0 +1,12 @@
+:set nocompatible
+:%s/\s\+$//
+:g/^# \(vi\): /d
+:set et
+:retab!
+:$
+:append
+# vi: sts=4 et sw=4
+.
+:update
+:q
+:q!
diff --git a/auxtools/pylint.sh b/auxtools/pylint.sh
new file mode 100755
index 0000000..8e42b53
--- /dev/null
+++ b/auxtools/pylint.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+auxdir=`dirname $0`
+if [ -z $topdir ]; then
+ topdir="."
+fi
+cd $auxdir
+auxdir=`pwd`
+cd ..
+make >&2
+topdir=`pwd`
+cd build/lib.*
+
+DISABLE_MSG="W0324,W0322,W0323,W0704,W0121,W0702"
+IGNORE="^"
+IGNORE="${IGNORE}\\(W0232\\|E0201\\):[^:]*:JID"
+IGNORE="${IGNORE}\\|W0403:.*'stringprep'"
+IGNORE="${IGNORE}\\|W0613:[^:]*:\\(StreamHandler.*'doc'\\|RR_.*\\('length'\\|'cls'\\)\\)"
+IGNORE="${IGNORE}\\|W0613:[^:]*:\\(ClientStream.*'realm'\\|Client.*'iq'\\)"
+IGNORE="${IGNORE}\\|W0613:[^:]*:\\(StreamBase.*'doc'\\)"
+IGNORE="${IGNORE}\\|W0613:[^:]*:PlainClientAuthenticator.*\\('challenge'\\|'data'\\)"
+IGNORE="${IGNORE}\\|W0613:[^:]*:PasswordManager.*\\('username'\\|'realm'\\|'acceptable_formats'\\)"
+IGNORE="${IGNORE}\\|W0613:[^:]*:ClientAuthenticator.*\\('username'\\|'authzid'\\|'challenge'\\|'data'\\)"
+IGNORE="${IGNORE}\\|W0613:[^:]*:ServerAuthenticator.*\\('initial_response'\\|'response'\\)"
+IGNORE="${IGNORE}\\|W0613:[^:]*:DigestMD5ServerAuthenticator.start.*'response'"
+IGNORE="${IGNORE}\\|W0613:[^:]*:MucRoomState.set_stream.*'stream'"
+IGNORE="${IGNORE}\\|W0613:[^:]*:LegacyClientStream.*'\\(stanza\\|resource\\)'"
+IGNORE="${IGNORE}\\|W0613:[^:]*:JabberClient\\.connect.*'register'"
+IGNORE="${IGNORE}\\|W0612:[^:]*:\\(StreamBase._connect.*'canonname'\\|StreamBase._loop_iter.*'ofd'\\)"
+IGNORE="${IGNORE}\\|W0612:[^:]*:\\(parse_message:.*'i'\\|do_query:.*'canonname'\\)"
+IGNORE="${IGNORE}\\|W0201:[^:]*:\\([^.]*\\._reset\\|ClientStream.*'me'\\)"
+IGNORE="${IGNORE}\\|W0201:[^:]*:StreamSASLMixIn.*'\\(me\\|authenticated\\|peer_authenticated\\|peer\\|auth_method_used\\)'"
+IGNORE="${IGNORE}\\|W0201:[^:]*:StreamTLSMixIn.*'\\(socket\\|features\\)'"
+IGNORE="${IGNORE}\\|W0201:[^:]*:ComponentStream._process_node"
+IGNORE="${IGNORE}\\|W0221:[^:]*:\\(Client\\|Component\\)Stream._\\?\\(connect\\|accept\\)"
+
+export PYLINTRC=$auxdir/pylintrc
+if [ -n "$1" ] ; then
+ pylint --disable-msg $DISABLE_MSG $1 | sed -e"s#$IGNORE#ignore that: &#"
+else
+ pylint --disable-msg $DISABLE_MSG pyxmpp | sed -e"s#$IGNORE#ignore that: &#"
+fi
diff --git a/auxtools/pylintrc b/auxtools/pylintrc
new file mode 100644
index 0000000..91321a0
--- /dev/null
+++ b/auxtools/pylintrc
@@ -0,0 +1,216 @@
+# lint Python modules using external checkers.
+#
+[MASTER]
+# Add <file> (may be a directory) to the black list. It should be a base name,
+# not a path. You may set this option multiple times.
+ignore=CVS
+
+# Pickle collected data for later comparisons.
+persistent=yes
+
+# Tells wether to display a full report or only the messages
+reports=yes
+
+# Put messages in a separate file for each module / package specified on the
+# command line instead of printing them on stdout. Reports (if any) will be
+# written in a file name "pylint_global.[txt|html]".
+files-output=no
+
+# Python expression which should return a note less than 10 (10 is the highest
+# note).You have access to the variables errors, warnings, statements which
+# respectivly contain the number of errors / warnings messages and the total
+# number of statements analyzed. This is used by the global evaluation report
+# (R0004).
+evaluation='10.0 - ((float(5 * errors + warnings) / statements) * 10)'
+
+# Add a comment according to your evaluation note. This is used by the global
+# evaluation report (R0004).
+comment=yes
+
+# Include message's id in output
+include-ids=yes
+
+# checks for :
+# * doc strings
+# * modules / classes / functions / methods / arguments / variables name
+# * number of arguments, local variables, branchs, returns and statements in
+# functions, methods
+# * required module attributes
+# * dangerous default values as arguments
+# * redefinition of function / method / class
+# * uses of the global statement
+#
+[BASIC]
+# Enable / disable this checker
+enable-basic=yes
+
+# Maximum number of arguments for function / method
+#max-args=5
+max-args=15
+
+# Maximum number of locals for function / method body
+max-locals=25
+
+# Maximum number of return / yield for function / method body
+# J: limiting number of exit points sometimes complicates the code and makes it
+# less readable IMHO
+max-returns=100
+
+# Maximum number of branch for function / method body
+max-branchs=15
+
+# Maximum number of statements in function / method body
+max-statements=50
+
+# Required attributes for module, separated by a comma
+required-attributes=__revision__,__docformat__
+
+# Regular expression which should only match functions or classes name which do
+# not require a docstring
+no-docstring-rgx=__.*__
+
+# Minimal length for module / class / function / method / argument / variable
+# names
+min-name-length=1
+
+# Regular expression which should only match correct module names
+module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
+
+# Regular expression which should only match correct class names
+class-rgx=[A-Z][a-z_A-Z0-9]+$
+
+# Regular expression which should only match correct function names
+function-rgx=[a-z_][a-z0-9_]*$
+
+# Regular expression which should only match correct method names
+method-rgx=[a-z_][a-z0-9_]*$
+
+# Regular expression which should only match correct argument names
+argument-rgx=[a-z_][a-z0-9_]*$
+
+# Regular expression which should only match correct variable names
+variable-rgx=[a-z_][a-z0-9_]*$
+
+# Good variable names which should always be accepted, separated by a comma
+good-names=i,j,k,ex,Run
+
+# Bad variable names which should always be refused, separated by a comma
+bad-names=foo,bar,baz,toto,tutu,tata
+
+# List of builtins function names that should not be used, separated by a comma
+bad-functions=map,filter,apply,input
+
+
+
+# checks for
+# * external modules dependancies
+# * relative / wildcard imports
+# * cyclic imports
+# * uses of deprecated modules
+#
+[IMPORTS]
+# Enable / disable this checker
+enable-imports=yes
+
+# Deprecated modules which should not be used, separated by a comma
+deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
+
+
+
+# checks for
+# * unused variables / imports
+# * undefined variables
+# * redefinition of variable from builtins or from an outer scope
+# * use of variable before assigment
+#
+[VARIABLES]
+# Enable / disable this checker
+enable-variables=yes
+
+# Tells wether we should check for unused import in __init__ files.
+init-import=no
+
+
+
+# checks for :
+# * methods without self as first argument
+# * overriden methods signature
+# * access only to existant members via self
+# * attributes not defined in the __init__ method
+# * supported interfaces implementation
+# * unreachable code
+#
+[CLASSES]
+# Enable / disable this checker
+enable-classes=yes
+
+# List of interface methods to ignore, separated by a comma. This is used for
+# instance to not check methods defines in Zope's Interface base class.
+ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
+
+# Tells wether missing members accessed in mixin class should be ignored. A
+# mixin class is detected if its name ends with "mixin" (case insensitive).
+ignore-mixin-members=yes
+
+
+
+# checks for
+# * excepts without exception filter
+# * string exceptions
+#
+[EXCEPTIONS]
+# Enable / disable this checker
+enable-exceptions=yes
+
+
+
+# checks for :
+# * unauthorized constructions
+# * strict indentation
+# * line length
+# * use of <>
+#
+[FORMAT]
+# Enable / disable this checker
+enable-format=yes
+
+# Maximum number of characters on a single line.
+max-line-length=100
+
+# Maximum number of lines in a module
+max-module-lines=1000
+
+# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
+# tab).
+indent-string=' '
+
+
+
+# checks for:
+# * source code with non ascii characters but no encoding declaration (PEP
+# 263)
+# * warning notes in the code like FIXME, XXX
+#
+[MISCELLANEOUS]
+# Enable / disable this checker
+enable-miscellaneous=yes
+
+# List of note tags to take in consideration, separated by a comma. Default to
+# FIXME, XXX, TODO
+notes=FIXME,XXX,TODO
+
+
+
+# does not check anything but gives some raw metrics :
+# * total number of lines
+# * total number of code lines
+# * total number of docstring lines
+# * total number of comments lines
+# * total number of empty lines
+#
+[METRICS]
+# Enable / disable this checker
+enable-metrics=yes
+
+
+
diff --git a/auxtools/svn2log.py b/auxtools/svn2log.py
new file mode 100755
index 0000000..b04b148
--- /dev/null
+++ b/auxtools/svn2log.py
@@ -0,0 +1,298 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2003 The University of Wroclaw.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 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
+# NO EVENT SHALL THE UNIVERSITY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+import sys
+import os
+import time
+import re
+import getopt
+import string
+import codecs
+
+from xml.utils import qp_xml
+
+kill_prefix_rx = None
+default_domain = "localhost"
+exclude = []
+users = { }
+reloc = { }
+max_join_delta = 3 * 60
+list_format = False
+
+date_rx = re.compile(r"^(\d+-\d+-\d+T\d+:\d+:\d+)")
+
+def die(msg):
+ sys.stderr.write(msg + "\n")
+ sys.exit(1)
+
+def attr(e, n):
+ return e.attrs[("", n)]
+
+def has_child(e, n):
+ for c in e.children:
+ if c.name == n: return 1
+ return 0
+
+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])
+ if kill_prefix_rx != None:
+ if kill_prefix_rx.search(n):
+ n = kill_prefix_rx.sub("", n)
+ else:
+ return None
+ if n.startswith("/"): n = n[1:]
+ if n == "": n = "/"
+ for pref in exclude:
+ if n.startswith(pref):
+ return None
+ return n
+
+def convert_user(u):
+ if users.has_key(u):
+ return users[u]
+ else:
+ return "%s <%s@%s>" % (u, u, default_domain)
+
+def wrap_text_line(str, pref, width):
+ ret = u""
+ line = u""
+ first_line = True
+ for word in str.split():
+ if line == u"":
+ line = word
+ else:
+ if len(line + u" " + word) > width:
+ if first_line:
+ ret += line + u"\n"
+ first_line = False
+ line = word
+ else:
+ ret += pref + line + u"\n"
+ line = word
+ else:
+ line += u" " + word
+ if first_line:
+ ret += line + u"\n"
+ else:
+ ret += pref + line + u"\n"
+ return ret
+
+def wrap_text(str, pref, width):
+ if not list_format:
+ return wrap_text_line(str,pref,width)
+ else:
+ items = re.split(r"\-\s+",str)
+ ret = wrap_text_line(items[0],pref,width)
+ for item in items[1:]:
+ ret += pref + u"- " + wrap_text_line(item,pref+" ",width)
+ return ret
+
+class Entry:
+ def __init__(self, tm, rev, author, msg):
+ self.tm = tm
+ self.rev = rev
+ self.author = author
+ self.msg = msg
+ self.beg_tm = tm
+ self.beg_rev = rev
+
+ def join(self, other):
+ self.tm = other.tm
+ self.rev = other.rev
+ self.msg += other.msg
+
+ def dump(self, out):
+ if self.rev != self.beg_rev:
+ out.write("%s [r%s-%s] %s\n\n" % \
+ (time.strftime("%Y-%m-%d %H:%M +0000", time.localtime(self.beg_tm)), \
+ self.rev, self.beg_rev, convert_user(self.author)))
+ else:
+ out.write("%s [r%s] %s\n\n" % \
+ (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
+
+def process_entry(e):
+ rev = attr(e, "revision")
+ if has_child(e, "author"):
+ author = child(e, "author").textof()
+ else:
+ author = "anonymous"
+ m = date_rx.search(child(e, "date").textof())
+ msg = child(e, "msg").textof()
+ if m:
+ tm = time.mktime(time.strptime(m.group(1), "%Y-%m-%dT%H:%M:%S"))
+ else:
+ die("evil date: %s" % child(e, "date").textof())
+ paths = []
+ for path in child(e, "paths").children:
+ if path.name != "path": die("<paths> has non-<path> child")
+ nam = convert_path(path.textof())
+ if nam != None:
+ if attr(path, "action") == "D":
+ paths.append(nam + " (removed)")
+ elif attr(path, "action") == "A":
+ 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))
+
+ return None
+
+def process(fin, fout):
+ parser = qp_xml.Parser()
+ 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)
+ if e != None:
+ if cur != None:
+ if cur.can_join(e):
+ cur.join(e)
+ else:
+ cur.dump(fout)
+ cur = e
+ else: cur = e
+
+ if cur != None: cur.dump(fout)
+
+def usage():
+ sys.stderr.write(\
+"""Usage: %s [OPTIONS] [FILE]
+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
+ ignored)
+ -x, --exclude=DIR exclude DIR from ChangeLog (relative to prefix)
+ -o, --output set output file (defaults to 'ChangeLog')
+ -d, --domain=DOMAIN set default domain for logins not listed in users file
+ -u, --users=FILE read logins from specified file
+ -F, --list-format format commit logs with enumerated change list (items
+ prefixed by '- ')
+ -r, --relocate=X=Y before doing any other operations on paths, replace
+ X with Y (useful for directory moves)
+ -D, --delta=SECS when log entries differ by less then SECS seconds and
+ have the same author -- they are merged, it defaults
+ to 180 seconds
+ -h, --help print this information
+
+Users file is used to map svn logins to real names to appear in ChangeLog.
+If login is not found in users file "login <login@domain>" is used.
+
+Example users file:
+john John X. Foo <jfoo@example.org>
+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>
+
+""" % (sys.argv[0], sys.argv[0]))
+
+def utf_open(name, mode):
+ return codecs.open(name, mode, encoding="utf-8", errors="replace")
+
+def process_opts():
+ try:
+ 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"])
+ except getopt.GetoptError:
+ usage()
+ sys.exit(2)
+ fin = sys.stdin
+ fout = None
+ global kill_prefix_rx, exclude, users, default_domain, reloc, max_join_delta, list_format
+ for o, a in opts:
+ if o in ("--prefix", "-p"):
+ kill_prefix_rx = re.compile("^" + a)
+ elif o in ("--exclude", "-x"):
+ exclude.append(a)
+ elif o in ("--help", "-h"):
+ usage()
+ sys.exit(0)
+ elif o in ("--output", "-o"):
+ fout = open(a, "w")
+ elif o in ("--domain", "-d"):
+ default_domain = a
+ elif o in ("--users", "-u"):
+ f = utf_open(a, "r")
+ for line in f.xreadlines():
+ w = line.split()
+ if len(line) < 1 or line[0] == '#' or len(w) < 2:
+ continue
+ users[w[0]] = " ".join(w[1:])
+ elif o in ("--relocate", "-r"):
+ (src, target) = a.split("=")
+ reloc[src] = target
+ elif o in ("--delta", "-D"):
+ max_join_delta = int(a)
+ elif o in ("--list-format", "-F"):
+ list_format = True
+ else:
+ usage()
+ sys.exit(2)
+ if len(args) > 1:
+ usage()
+ sys.exit(2)
+ if len(args) == 1:
+ fin = open(args[0], "r")
+ if fout == None:
+ fout = utf_open("ChangeLog", "w")
+ process(fin, fout)
+
+if __name__ == "__main__":
+ os.environ['TZ'] = 'UTC'
+ try:
+ time.tzset()
+ except AttributeError:
+ pass
+ process_opts()
diff --git a/auxtools/users b/auxtools/users
new file mode 100644
index 0000000..4576b87
--- /dev/null
+++ b/auxtools/users
@@ -0,0 +1 @@
+jajcus Jacek Konieczny <jajcus@bnet.pl>