summaryrefslogtreecommitdiffstats
path: root/Doc/tools
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2006-01-02 07:22:12 (GMT)
committerFred Drake <fdrake@acm.org>2006-01-02 07:22:12 (GMT)
commitaaa28df3ce9b25366e2d7b3aeb708a6bb26e0170 (patch)
tree532613104fd6ad1f368e0848e9f8b54180029ab5 /Doc/tools
parent50bf51a3a987121b92cb7b2e2c3097075ea6b2be (diff)
downloadcpython-aaa28df3ce9b25366e2d7b3aeb708a6bb26e0170.zip
cpython-aaa28df3ce9b25366e2d7b3aeb708a6bb26e0170.tar.gz
cpython-aaa28df3ce9b25366e2d7b3aeb708a6bb26e0170.tar.bz2
update to reflect move to Subversion
Diffstat (limited to 'Doc/tools')
-rw-r--r--Doc/tools/cvsinfo.py81
-rwxr-xr-xDoc/tools/findacks161
-rwxr-xr-xDoc/tools/mksourcepkg38
3 files changed, 8 insertions, 272 deletions
diff --git a/Doc/tools/cvsinfo.py b/Doc/tools/cvsinfo.py
deleted file mode 100644
index cc90fe5..0000000
--- a/Doc/tools/cvsinfo.py
+++ /dev/null
@@ -1,81 +0,0 @@
-"""Utility class and function to get information about the CVS repository
-based on checked-out files.
-"""
-
-import os
-
-
-def get_repository_list(paths):
- d = {}
- for name in paths:
- if os.path.isfile(name):
- dir = os.path.dirname(name)
- else:
- dir = name
- rootfile = os.path.join(name, "CVS", "Root")
- root = open(rootfile).readline().strip()
- if not d.has_key(root):
- d[root] = RepositoryInfo(dir), [name]
- else:
- d[root][1].append(name)
- return d.values()
-
-
-class RepositoryInfo:
- """Record holding information about the repository we want to talk to."""
- cvsroot_path = None
- branch = None
-
- # type is '', ':ext', or ':pserver:'
- type = ""
-
- def __init__(self, dir=None):
- if dir is None:
- dir = os.getcwd()
- dir = os.path.join(dir, "CVS")
- root = open(os.path.join(dir, "Root")).readline().strip()
- if root.startswith(":pserver:"):
- self.type = ":pserver:"
- root = root[len(":pserver:"):]
- elif ":" in root:
- if root.startswith(":ext:"):
- root = root[len(":ext:"):]
- self.type = ":ext:"
- self.repository = root
- if ":" in root:
- host, path = root.split(":", 1)
- self.cvsroot_path = path
- else:
- self.cvsroot_path = root
- fn = os.path.join(dir, "Tag")
- if os.path.isfile(fn):
- self.branch = open(fn).readline().strip()[1:]
-
- def get_cvsroot(self):
- return self.type + self.repository
-
- _repository_dir_cache = {}
-
- def get_repository_file(self, path):
- filename = os.path.abspath(path)
- if os.path.isdir(path):
- dir = path
- join = 0
- else:
- dir = os.path.dirname(path)
- join = 1
- try:
- repodir = self._repository_dir_cache[dir]
- except KeyError:
- repofn = os.path.join(dir, "CVS", "Repository")
- repodir = open(repofn).readline().strip()
- repodir = os.path.join(self.cvsroot_path, repodir)
- self._repository_dir_cache[dir] = repodir
- if join:
- fn = os.path.join(repodir, os.path.basename(path))
- else:
- fn = repodir
- return fn[len(self.cvsroot_path)+1:]
-
- def __repr__(self):
- return "<RepositoryInfo for %r>" % self.get_cvsroot()
diff --git a/Doc/tools/findacks b/Doc/tools/findacks
deleted file mode 100755
index b54ea60..0000000
--- a/Doc/tools/findacks
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/usr/bin/env python
-"""Script to locate email addresses in the CVS logs."""
-__version__ = '$Revision$'
-
-import os
-import re
-import sys
-import UserDict
-
-import cvsinfo
-
-
-class Acknowledgements(UserDict.UserDict):
- def add(self, email, name, path):
- d = self.data
- d.setdefault(email, {})[path] = name
-
-
-def open_cvs_log(info, paths=None):
- cvsroot = info.get_cvsroot()
- cmd = "cvs -q -d%s log " % cvsroot
- if paths:
- cmd += " ".join(paths)
- return os.popen(cmd, "r")
-
-
-email_rx = re.compile("<([a-z][-a-z0-9._]*@[-a-z0-9.]+)>", re.IGNORECASE)
-
-def find_acks(f, acks):
- prev = ''
- filename = None
- MAGIC_WORDS = ('van', 'von')
- while 1:
- line = f.readline()
- if not line:
- break
- if line.startswith("Working file: "):
- filename = line.split(None, 2)[2].strip()
- prev = line
- continue
- m = email_rx.search(line)
- if m:
- words = prev.split() + line[:m.start()].split()
- L = []
- while words \
- and (words[-1][0].isupper() or words[-1] in MAGIC_WORDS):
- L.insert(0, words.pop())
- name = " ".join(L)
- email = m.group(1).lower()
- acks.add(email, name, filename)
- prev = line
-
-
-def load_cvs_log_acks(acks, args):
- repolist = cvsinfo.get_repository_list(args or [""])
- for info, paths in repolist:
- print >>sys.stderr, "Repository:", info.get_cvsroot()
- f = open_cvs_log(info, paths)
- find_acks(f, acks)
- f.close()
-
-
-def load_tex_source_acks(acks, args):
- for path in args:
- path = path or os.curdir
- if os.path.isfile(path):
- read_acks_from_tex_file(acks, path)
- else:
- read_acks_from_tex_dir(acks, path)
-
-
-def read_acks_from_tex_file(acks, path):
- f = open(path)
- while 1:
- line = f.readline()
- if not line:
- break
- if line.startswith(r"\sectionauthor{"):
- line = line[len(r"\sectionauthor"):]
- name, line = extract_tex_group(line)
- email, line = extract_tex_group(line)
- acks.add(email, name, path)
-
-
-def read_acks_from_tex_dir(acks, path):
- stack = [path]
- while stack:
- p = stack.pop()
- for n in os.listdir(p):
- n = os.path.join(p, n)
- if os.path.isdir(n):
- stack.insert(0, n)
- elif os.path.normpath(n).endswith(".tex"):
- read_acks_from_tex_file(acks, n)
-
-
-def extract_tex_group(s):
- c = 0
- for i in range(len(s)):
- if s[i] == '{':
- c += 1
- elif s[i] == '}':
- c -= 1
- if c == 0:
- return s[1:i], s[i+1:]
-
-
-def print_acks(acks):
- first = 1
- for email, D in acks.items():
- if first:
- first = 0
- else:
- print
- L = D.items()
- L.sort()
- prefname = L[0][1]
- for file, name in L[1:]:
- if name != prefname:
- prefname = ""
- break
- if prefname:
- print prefname, "<%s>:" % email
- else:
- print email + ":"
- for file, name in L:
- if name == prefname:
- print " " + file
- else:
- print " %s (as %s)" % (file, name)
-
-
-def print_ack_names(acks):
- names = []
- for email, D in acks.items():
- L = D.items()
- L.sort()
- prefname = L[0][1]
- for file, name in L[1:]:
- prefname = prefname or name
- names.append(prefname or email)
- def f(s1, s2):
- s1 = s1.lower()
- s2 = s2.lower()
- return cmp((s1.split()[-1], s1),
- (s2.split()[-1], s2))
- names.sort(f)
- for name in names:
- print name
-
-
-def main():
- args = sys.argv[1:]
- acks = Acknowledgements()
- load_cvs_log_acks(acks, args)
- load_tex_source_acks(acks, args)
- print_ack_names(acks)
-
-
-if __name__ == "__main__":
- main()
diff --git a/Doc/tools/mksourcepkg b/Doc/tools/mksourcepkg
index cad2b44..4b21f77 100755
--- a/Doc/tools/mksourcepkg
+++ b/Doc/tools/mksourcepkg
@@ -24,8 +24,6 @@ import shutil
import sys
import tempfile
-import cvsinfo
-
try:
__file__
except NameError:
@@ -79,42 +77,22 @@ def main():
else:
formats = ["gzip"]
release = args[0]
- cvstag = None
+ svntag = None
if len(args) > 1:
- cvstag = args[1]
+ svntag = args[1]
tempdir = tempfile.mktemp()
os.mkdir(tempdir)
pkgdir = os.path.join(tempdir, "Python-Docs-" + release)
- os.mkdir(pkgdir)
pwd = os.getcwd()
mydir = os.path.abspath(os.path.dirname(sys.argv[0]))
- info = cvsinfo.RepositoryInfo(mydir)
- cvsroot = info.get_cvsroot()
- m = rx.match(cvsroot)
- if m and anonymous:
- # If this is an authenticated SourceForge repository, convert to
- # anonymous usage for the export/checkout, since that avoids the
- # SSH overhead.
- group = m.group(1)
- cvsroot = ":pserver:anonymous@cvs.%s.sourceforge.net:/cvsroot/%s" \
- % (group, group)
- # For some reason, SourceForge/CVS doesn't seem to care that we
- # might not have done a "cvs login" to the anonymous server.
- # That avoids a lot of painful gunk here.
os.chdir(tempdir)
if not quiet:
- print "--- current directory is:", pkgdir
- if cvstag:
- run("cvs -d%s export -r %s -d Python-Docs-%s python/dist/src/Doc"
- % (cvsroot, cvstag, release))
- else:
- run("cvs -Q -d%s checkout -d Python-Docs-%s python/dist/src/Doc"
- % (cvsroot, release))
- # remove CVS directories
- for p in ('*/CVS', '*/*/CVS', '*/*/*/CVS'):
- map(shutil.rmtree, glob.glob(p))
- for f in ('.cvsignore', '*/.cvsignore'):
- map(os.unlink, glob.glob(f))
+ print "--- current directory is:", tempdir
+ if not svntag:
+ svntag = "trunk"
+ svnbase = "http://svn.python.org/projects/python"
+ run("svn export %s/%s/Doc Python-Docs-%s"
+ % (svnbase, svntag, release))
# Copy in the version informtation, if we're not just going to
# rip it back out: