Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 77b76b6

Browse files
committed
Substantially revise to handle the fact that Python CVS is no longer in a
file-system accessible repository. Add a little bit of smarts to convert the cvsroot to an anonymous cvsroot the real one requires an authenticated login to SourceForge; this avoids the SSH startup delay when doing the checkout or export to get a fresh copy of the tree.
1 parent 3ece713 commit 77b76b6

1 file changed

Lines changed: 35 additions & 16 deletions

File tree

Doc/tools/mksourcepkg

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ __version__ = "$Revision$"
2121
import getopt
2222
import glob
2323
import os
24+
import re
2425
import shutil
2526
import sys
2627
import tempfile
2728

29+
import cvsinfo
30+
2831

2932
quiet = 0
33+
rx = re.compile(r":ext:(?:[a-zA-Z0-9]+)@cvs\.([a-zA-Z0-9]+).sourceforge.net:"
34+
r"/cvsroot/\1")
3035

3136

3237
def main():
@@ -70,33 +75,47 @@ def main():
7075
cvstag = args[1]
7176
tempdir = tempfile.mktemp()
7277
os.mkdir(tempdir)
73-
os.mkdir(os.path.join(tempdir, "Python-%s" % release))
74-
docdir = os.path.join(tempdir, "Python-%s" % release, "Doc")
75-
os.mkdir(docdir)
76-
mydir = os.getcwd()
78+
pkgdir = os.path.join(tempdir, "Python-" + release)
79+
os.mkdir(pkgdir)
80+
pwd = os.getcwd()
81+
mydir = os.path.abspath(os.path.dirname(sys.argv[0]))
82+
info = cvsinfo.RepositoryInfo(mydir)
83+
cvsroot = info.get_cvsroot()
84+
m = rx.match(cvsroot)
85+
if m:
86+
# If this is an authenticated SourceForge repository, convert to
87+
# anonymous usage for the export/checkout, since that avoids the
88+
# SSH overhead.
89+
group = m.group(1)
90+
cvsroot = ":pserver:anonymous@cvs.%s.sourceforge.net:/cvsroot/%s" \
91+
% (group, group)
92+
# For some reason, SourceForge/CVS doesn't seem to care that we
93+
# might not have done a "cvs login" to the anonymous server.
94+
# That avoids a lot of painful gunk here.
95+
os.chdir(pkgdir)
96+
if not quiet:
97+
print "--- current directory is:", pkgdir
7798
if cvstag:
78-
run("cvs export -r %s -d %s/Python-%s/Doc python/dist/src/Doc"
79-
% (cvstag, tempdir, release))
99+
run("cvs -d%s export -r %s -d Doc python/dist/src/Doc"
100+
% (cvsroot, cvstag))
80101
else:
81-
run("cvs checkout -d %s/Python-%s/Doc python/dist/src/Doc"
82-
% (tempdir, release))
102+
run("cvs -Q -d%s checkout -d Doc python/dist/src/Doc" % cvsroot)
83103
# remove CVS directories
84-
os.chdir("%s/Python-%s" % (tempdir, release))
85104
for p in ('*/CVS', '*/*/CVS', '*/*/*/CVS'):
86105
map(shutil.rmtree, glob.glob(p))
87-
os.chdir(mydir)
88106
if tools:
89-
archive = "tools-" + release
107+
archive = "doctools-" + release
90108
# we don't want the actual documents in this case:
91-
for d in ("api", "doc", "ext", "lib", "mac", "ref", "tut"):
92-
shutil.rmtree(os.path.join(docdir, d))
109+
for d in ("api", "dist", "doc", "ext", "inst",
110+
"lib", "mac", "ref", "tut"):
111+
shutil.rmtree(os.path.join(os.path.join(pkgdir, "Doc"), d))
93112
else:
94113
archive = "latex-" + release
95114

96115
# XXX should also remove the .cvsignore files at this point
97116

98117
os.chdir(tempdir)
99-
archive = os.path.join(mydir, archive)
118+
archive = os.path.join(pwd, archive)
100119
for format in formats:
101120
if format == "bzip2":
102121
run("tar cf - Python-%s | bzip2 -9 >%s.tar.bz2"
@@ -111,15 +130,15 @@ def main():
111130
% (archive, release))
112131

113132
# clean up the work area:
114-
os.chdir(mydir)
133+
os.chdir(pwd)
115134
shutil.rmtree(tempdir)
116135

117136

118137
def run(cmd):
119138
if quiet < 2:
120139
print "+++", cmd
121140
if quiet:
122-
cmd = "(%s) >/dev/null" % cmd
141+
cmd = "%s >/dev/null" % cmd
123142
rc = os.system(cmd)
124143
if rc:
125144
sys.exit(rc)

0 commit comments

Comments
 (0)