[Mailman-Developers] [PATCH] Modifying #! env python line to match --with-python

Ben Gertzfield che@debian.org
Tue, 28 Aug 2001 15:45:49 +0900


Many, many utility programs and other scripts that are in Mailman CVS
have #! /usr/bin/env python hard-coded in them, and do not use the
@PYTHON@ symbol exported from autoconf.

This means that the --with-python flag cannot be ever used if python
is not named "python"; for Debian Linux, this is a Big Problem,
because the python 1.6 and python 2.0 binaries have different
names. (/usr/bin/python vs /usr/bin/python2).

So, I created a patch that makes building possible when python is
called *anything*; I've tested it on Debian GNU/Linux unstable, where
python is called python2, and it works.

The patch (it's 500K, because it renames a lot of files) is available
at:

http://nausicaa.interq.or.jp/mailman/with-python.patch

It does the following:

1) Defines a shell variable SCRIPTS in configure.in.  This variable
   contains a list of scripts that are to be created from script.in
   templates; the only thing that we care about expanding is changing
   the first line, from:

   #! /usr/bin/env python

   to:

   #! /usr/bin/env @PYTHON@

   This variable is passed in to AC_SUBST and AC_OUTPUT both, so that
   the top-level Makefile can do a 'rm -f ${SCRIPTS}' in its make
   distclean target.

2) Renames all the scripts that used the hard-coded name for python from
   (for example) bin/qrunner to bin/qrunner.in

3) Chmods 0755 all the generated scripts from the top-level Makefile,
   by adding a 'script-perms' target to the 'all' target.

4) Removes misc/mailman on a make distclean (this was auto-generated before
   but never removed on a make distclean, probably messed up some people's
   patches..) by editing misc/Makefile.in.  This is totally unrelated to
   the other fixes but it's pretty obviously a minor bug.

It would be trivial to move the SCRIPTS variable definition to a file
outside of configure.in, if that's a cleaner way to maintain it in
the future.

There are some files in the Mailman CVS tree that have #! /usr/bin/env
python lines, but are never really executed.  I didn't munge these
files, because forcing folks to guess that SOME files in the Mailman
source tree are .in and others aren't is icky  These files are:

[ben@nausicaa:~/src/mailman/mailman]% find . -type f -print0 | xargs -0 grep -H '#!.*env.*python'
./Mailman/Post.py:#! /usr/bin/env python
./Mailman/Archiver/pipermail.py:#! /usr/bin/env python
./misc/Cookie.py:#!/usr/bin/env python

If I'm wrong, and these should be included in the SCRIPTS variable,
feel free to change the patch.  But I excluded them for now.  

Here's the list of files I did include in the SCRIPTS variable.  These
are the ones that are renamed to (for example)
contrib/rotatelogs.py.in by the patch and changed to use
#! /usr/bin/env @PYTHON@ .

contrib/rotatelogs.py
contrib/qmail-to-mailman.py
contrib/securelinux_fix.py
filters/bowa-strip
Mailman/pythonlib/mailbox.py
cron/senddigests
cron/bumpdigests
cron/nightly_gzip
cron/mailpasswds
cron/gate_news
cron/checkdbs
admin/bin/Release.py
admin/bin/mm2do
admin/bin/faq2ht.py
bin/update
bin/newlist
bin/check_perms
bin/find_member
bin/withlist
bin/mailmanctl
bin/change_pw
bin/list_admins
bin/check_db
bin/list_lists
bin/pygettext.py
bin/qrunner
bin/clone_member
bin/genaliases
bin/digest_arch
bin/arch
bin/rmlist
bin/mmsitepass
bin/version
bin/remove_members
bin/config_list
bin/list_members
bin/sync_members
bin/add_members
bin/dumpdb
scripts/mailowner
scripts/mailcmd
scripts/post
scripts/leave
scripts/join
scripts/auto
src/setup.py

Please let me know if there are any comments/suggestions.  Now that
I've got mailman building on Debian unstable, I can start testing the
patch I made for avoiding duplicate mails. *grin*

Ben

-- 
Brought to you by the letters P and C and the number 1.
"Ohhhh, Mentos Boy!"
Debian GNU/Linux maintainer of Gimp and GTK+ -- http://www.debian.org/