Mercurial > cpython-lru_cache-weakref
annotate Doc/tools/mksourcepkg @ 27998:e27f58a50737 legacy-trunk
SF bug #690377: Dud footnote reference in distutils docs
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Fri, 21 Feb 2003 02:47:09 +0000 |
| parents | 510e73ae3e9e |
| children | 0471c67f61bd 98a6b6015229 |
| rev | line source |
|---|---|
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
1 #! /usr/bin/env python |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
2 # -*- Python -*- |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
3 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
4 """%(program)s - script to create the latex source distribution |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
5 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
6 usage: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
7 %(program)s [-t|--tools] release [tag] |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
8 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
9 with -t|--tools: doesn't include the documents, only the framework |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
10 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
11 without [tag]: generate from the current version that's checked in |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
12 (*NOT* what's in the current directory!) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
13 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
14 with [tag]: generate from the named tag |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
15 """ |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
16 #* should be modified to get the Python version number automatically |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
17 # from the Makefile or someplace. |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
18 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
19 import getopt |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
20 import glob |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
21 import os |
|
15144
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
22 import re |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
23 import shutil |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
24 import sys |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
25 import tempfile |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
26 |
|
15144
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
27 import cvsinfo |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
28 |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
29 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
30 quiet = 0 |
|
15144
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
31 rx = re.compile(r":ext:(?:[a-zA-Z0-9]+)@cvs\.([a-zA-Z0-9]+).sourceforge.net:" |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
32 r"/cvsroot/\1") |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
33 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
34 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
35 def main(): |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
36 global quiet |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
37 try: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
38 opts, args = getopt.getopt(sys.argv[1:], "abgtzq", |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
39 ["all", "bzip2", "gzip", "tools", "zip", |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
40 "quiet"]) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
41 except getopt.error, e: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
42 usage(warning=str(e)) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
43 sys.exit(2) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
44 if len(args) not in (1, 2): |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
45 usage(warning="wrong number of parameters") |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
46 sys.exit(2) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
47 tools = 0 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
48 formats = {} |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
49 for opt, arg in opts: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
50 if opt in ("-t", "--tools"): |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
51 tools = 1 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
52 elif opt in ("-q", "--quiet"): |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
53 quiet = quiet + 1 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
54 elif opt in ("-b", "--bzip2"): |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
55 formats["bzip2"] = 1 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
56 elif opt in ("-g", "--gzip"): |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
57 formats["gzip"] = 1 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
58 elif opt in ("-z", "--zip"): |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
59 formats["zip"] = 1 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
60 elif opt in ("-a", "--all"): |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
61 formats["bzip2"] = 1 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
62 formats["gzip"] = 1 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
63 formats["zip"] = 1 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
64 if formats: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
65 # make order human-predictable |
|
16131
aa03c20e89b7
When generating the source package, copy in the LICENSE file from the main
Fred Drake <fdrake@acm.org>
parents:
15144
diff
changeset
|
66 formats = formats.keys() |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
67 formats.sort() |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
68 else: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
69 formats = ["gzip"] |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
70 release = args[0] |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
71 cvstag = None |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
72 if len(args) > 1: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
73 cvstag = args[1] |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
74 tempdir = tempfile.mktemp() |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
75 os.mkdir(tempdir) |
|
24722
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
76 pkgdir = os.path.join(tempdir, "Python-Docs-" + release) |
|
15144
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
77 os.mkdir(pkgdir) |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
78 pwd = os.getcwd() |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
79 mydir = os.path.abspath(os.path.dirname(sys.argv[0])) |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
80 info = cvsinfo.RepositoryInfo(mydir) |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
81 cvsroot = info.get_cvsroot() |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
82 m = rx.match(cvsroot) |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
83 if m: |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
84 # If this is an authenticated SourceForge repository, convert to |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
85 # anonymous usage for the export/checkout, since that avoids the |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
86 # SSH overhead. |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
87 group = m.group(1) |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
88 cvsroot = ":pserver:anonymous@cvs.%s.sourceforge.net:/cvsroot/%s" \ |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
89 % (group, group) |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
90 # For some reason, SourceForge/CVS doesn't seem to care that we |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
91 # might not have done a "cvs login" to the anonymous server. |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
92 # That avoids a lot of painful gunk here. |
|
24722
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
93 os.chdir(tempdir) |
|
15144
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
94 if not quiet: |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
95 print "--- current directory is:", pkgdir |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
96 if cvstag: |
|
24722
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
97 run("cvs -d%s export -r %s -d Python-Docs-%s python/dist/src/Doc" |
|
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
98 % (cvsroot, cvstag, release)) |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
99 else: |
|
24722
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
100 run("cvs -Q -d%s checkout -d Python-Docs-%s python/dist/src/Doc" |
|
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
101 % (cvsroot, release)) |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
102 # remove CVS directories |
|
16418
1ac7e6186b6e
Do not pass names of individual files to shutil.rmtree(); use os.unlink()
Fred Drake <fdrake@acm.org>
parents:
16131
diff
changeset
|
103 for p in ('*/CVS', '*/*/CVS', '*/*/*/CVS'): |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
104 map(shutil.rmtree, glob.glob(p)) |
|
16418
1ac7e6186b6e
Do not pass names of individual files to shutil.rmtree(); use os.unlink()
Fred Drake <fdrake@acm.org>
parents:
16131
diff
changeset
|
105 for f in ('.cvsignore', '*/.cvsignore'): |
|
1ac7e6186b6e
Do not pass names of individual files to shutil.rmtree(); use os.unlink()
Fred Drake <fdrake@acm.org>
parents:
16131
diff
changeset
|
106 map(os.unlink, glob.glob(f)) |
|
16131
aa03c20e89b7
When generating the source package, copy in the LICENSE file from the main
Fred Drake <fdrake@acm.org>
parents:
15144
diff
changeset
|
107 LICENSE = os.path.normpath( |
|
aa03c20e89b7
When generating the source package, copy in the LICENSE file from the main
Fred Drake <fdrake@acm.org>
parents:
15144
diff
changeset
|
108 os.path.join(mydir, os.pardir, os.pardir, "LICENSE")) |
|
24722
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
109 shutil.copyfile(LICENSE, "LICENSE") |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
110 if tools: |
|
15144
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
111 archive = "doctools-" + release |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
112 # we don't want the actual documents in this case: |
|
15144
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
113 for d in ("api", "dist", "doc", "ext", "inst", |
|
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
114 "lib", "mac", "ref", "tut"): |
|
24722
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
115 shutil.rmtree(os.path.join(pkgdir, d)) |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
116 else: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
117 archive = "latex-" + release |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
118 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
119 # XXX should also remove the .cvsignore files at this point |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
120 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
121 os.chdir(tempdir) |
|
15144
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
122 archive = os.path.join(pwd, archive) |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
123 for format in formats: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
124 if format == "bzip2": |
|
24722
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
125 run("tar cf - Python-Docs-%s | bzip2 -9 >%s.tar.bz2" |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
126 % (release, archive)) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
127 elif format == "gzip": |
|
24722
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
128 run("tar cf - Python-Docs-%s | gzip -9 >%s.tgz" |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
129 % (release, archive)) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
130 elif format == "zip": |
|
12215
774817285b8c
Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents:
11165
diff
changeset
|
131 if os.path.exists(archive + ".zip"): |
|
774817285b8c
Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents:
11165
diff
changeset
|
132 os.unlink(archive + ".zip") |
|
24722
510e73ae3e9e
Lots of changes to the packaging of the documentation, all to keep
Fred Drake <fdrake@acm.org>
parents:
16418
diff
changeset
|
133 run("zip -q -r9 %s.zip Python-Docs-%s" |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
134 % (archive, release)) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
135 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
136 # clean up the work area: |
|
15144
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
137 os.chdir(pwd) |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
138 shutil.rmtree(tempdir) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
139 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
140 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
141 def run(cmd): |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
142 if quiet < 2: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
143 print "+++", cmd |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
144 if quiet: |
|
15144
6b01fc22ef6e
Substantially revise to handle the fact that Python CVS is no longer in a
Fred Drake <fdrake@acm.org>
parents:
12215
diff
changeset
|
145 cmd = "%s >/dev/null" % cmd |
|
11165
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
146 rc = os.system(cmd) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
147 if rc: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
148 sys.exit(rc) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
149 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
150 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
151 def usage(warning=None): |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
152 stdout = sys.stdout |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
153 sys.stdout = sys.stderr |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
154 program = os.path.basename(sys.argv[0]) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
155 try: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
156 if warning: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
157 print "%s: %s\n" % (program, warning) |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
158 print __doc__ % {"program": program} |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
159 finally: |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
160 sys.stdout = stdout |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
161 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
162 |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
163 if __name__ == "__main__": |
|
a4aba205038e
Re-implementation of mktarball.sh as a more portable Python script;
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
164 main() |
