summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-10-14 15:04:33 (GMT)
committerFred Drake <fdrake@acm.org>2002-10-14 15:04:33 (GMT)
commitf834ecbba5102b62469d0c421b1c4d9a2a9ad3de (patch)
tree23ca0dab1ee21407f3335c2adc375cb12e9f2555 /Doc
parent19697bc355f2bff90c08a5ff6c1fe493786f48d7 (diff)
downloadcpython-f834ecbba5102b62469d0c421b1c4d9a2a9ad3de.zip
cpython-f834ecbba5102b62469d0c421b1c4d9a2a9ad3de.tar.gz
cpython-f834ecbba5102b62469d0c421b1c4d9a2a9ad3de.tar.bz2
Minor refactoring to avoid code duplication.
Diffstat (limited to 'Doc')
-rwxr-xr-xDoc/tools/mkpkglist27
1 files changed, 10 insertions, 17 deletions
diff --git a/Doc/tools/mkpkglist b/Doc/tools/mkpkglist
index 86965bb..e5c346d 100755
--- a/Doc/tools/mkpkglist
+++ b/Doc/tools/mkpkglist
@@ -59,6 +59,13 @@ def get_size(prefix, ext):
fn = "%s-%s%s" % (prefix, release, ext)
return int(round(os.path.getsize(fn) / 1024.0))
+def get_file_cell(prefix, ext, have):
+ if have:
+ kb = get_size(prefix, ext)
+ return FILE_TEMPLATE % (release, prefix, release, ext, kb)
+ else:
+ return NO_FILE_TEMPLATE
+
for name, prefix in PKG_TYPES:
zip_fn = "%s-%s.zip" % (prefix, release)
tgz_fn = "%s-%s.tgz" % (prefix, release)
@@ -71,23 +78,9 @@ for name, prefix in PKG_TYPES:
if have_zip or have_tgz or have_bz2:
print " <tr><td>%s</td>" % name
- if have_zip:
- kb = get_size(prefix, ".zip")
- print FILE_TEMPLATE % (release, prefix, release, ".zip", kb)
- else:
- print NO_FILE_TEMPLATE
-
- if have_tgz:
- kb = get_size(prefix, ".tgz")
- print FILE_TEMPLATE % (release, prefix, release, ".tgz", kb)
- else:
- print NO_FILE_TEMPLATE
-
- if have_bz2:
- kb = get_size(prefix, ".tar.bz2")
- print FILE_TEMPLATE % (release, prefix, release, ".tar.bz2", kb)
- else:
- print NO_FILE_TEMPLATE
+ print get_file_cell(prefix, ".zip", have_zip)
+ print get_file_cell(prefix, ".tgz", have_tgz)
+ print get_file_cell(prefix, ".tar.bz2", have_bz2)
print " </tr>"