diff options
| author | bwarsaw | 1998-05-26 16:34:58 +0000 |
|---|---|---|
| committer | bwarsaw | 1998-05-26 16:34:58 +0000 |
| commit | 1371846dc85b23f3cccd9f06a11fc722534b1c01 (patch) | |
| tree | 4d75ab2d6f1019ed2e02294cae5e50ce66c463e0 | |
| parent | ffaf4cf4a405bfa12fcc88c90443aa885124c16d (diff) | |
| download | mailman-1371846dc85b23f3cccd9f06a11fc722534b1c01.tar.gz mailman-1371846dc85b23f3cccd9f06a11fc722534b1c01.tar.zst mailman-1371846dc85b23f3cccd9f06a11fc722534b1c01.zip | |
1. Use the standard Python invocation #! line to get the interpreter
from $PATH
2. Remove RCS crud
Also, re-implemented in Python instead of Bourne shell. This makes it
easier to do path munging via import of paths module for better
integration with autoconf.
| -rwxr-xr-x | bin/rmlist | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/bin/rmlist b/bin/rmlist index 00d4d12ff..38bd1a149 100755 --- a/bin/rmlist +++ b/bin/rmlist @@ -1,4 +1,5 @@ -#!/bin/sh +#! /usr/bin/env python +# # Copyright (C) 1998 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or @@ -17,39 +18,42 @@ # Remove the components of a maillist with impunity - beware! -__version__="$Revision: 549 $" -# $Source$ +import os +import sys +import paths + +def usage(): + print 'Usage: rmlist [-a] list-name' + sys.exit(1) + +try: + if sys.argv[1] == '-a': + removeArchives = 1 + listname = sys.argv[2] + else: + removeArchives = 0 + listname = sys.argv[1] + print 'Not removing archives. Reinvoke with -a to remove them.' +except IndexError: + usage() + -MAILMAN_DIR='/home/mailman/mailman' -HTML_DIR='/home/mailman/public_html' +def remove_it(dir, msg): + if os.path.exists(dir): + print 'Removing', msg + os.system('rm -rf ' + dir) + else: + print listname, msg, 'not found as', dir -removeArchives="" -if [ "$1" = "-a" ]; then - shift - removeArchives=1 -fi +REMOVABLES = [('lists/%s', 'list info'), + ('templates/%s', 'web pages') + ] -if [ -z "$1" ]; then - echo "Usage: rmlist [ -a ] list-name" - exit 1 -else - listname="$1" -fi +if removeArchives: + REMOVABLES.append(('archives/%s', 'archives')) -rmit () { - if [ -d "$2" ]; then - echo Removing "$1" - rm -rf "$2" - else - echo "$listname $1 not found as $2" - fi -} +REMOVABLES.append(('locks/%s.lock', 'lock file')) -rmit "list info" "${MAILMAN_DIR}/lists/$listname" -rmit "web pages" "${MAILMAN_DIR}/templates/$listname" -if [ -n "$removeArchives" ]; then - rmit "archives" "${HTML_DIR}/archives/$listname" -else - echo "Not removing archives - reinvoke with '-a' option to remove them." -fi -rmit "lock file" "${MAILMAN_DIR}/locks/$listname.lock" +for dirtmpl, msg in REMOVABLES: + dir = os.path.join(paths.prefix, dirtmpl % listname) + remove_it(dir, msg) |
