Here's an idea: use ``#! /usr/bin/env {path-to-bin/py}`` instead of ``#! {path-to-bin/py}``. Make that modification after Mailman's ``make`` and before ``make install`` (because Mailman's ``make install`` tries to run ``bin/update``). It seemed to work as a technique when I experimented yesterday on the ec2 instance. I don't see a downside yet (other than the small amount of code to do the hack). It should work. I'll push and give it a try on ec2.
The incremental diff below also switches bin/py back to a shell script. This seemed to make the Mailman pofile creation happier on hardy than the zc.buildout Python version that I had switched to for this branch. It also meant that I could go back to using -t normally in the Makefile. (I had switched from the shell version primarily because I didn't know I would have to get a shell version working; now that we have the site.py hack, it works fine.)
=== modified file 'Makefile'
--- Makefile 2009-10-13 18:50:35 +0000
+++ Makefile 2009-10-17 17:46:38 +0000
@@ -82,7 +82,7 @@
check: clean build
# Run all tests. test_on_merge.py takes care of setting up the
# database.
- ${PYTHON} -t ${PY} ./test_on_merge.py $(VERBOSITY)
+ ${PY} -t ./test_on_merge.py $(VERBOSITY)
jscheck: build
# Run all JavaScript integration tests. The test runner takes care of
@@ -103,7 +103,7 @@
check_mailman: build
# Run all tests, including the Mailman integration
# tests. test_on_merge.py takes care of setting up the database.
- ${PYTHON} -t ${PY} ./test_on_merge.py $(VERBOSITY) --layer=MailmanLayer
+ ${PY} -t ./test_on_merge.py $(VERBOSITY) --layer=MailmanLayer
# Build and install the Mailman software. Note that we don't care about
# --with-cgi-gid because we're not going to use that Mailman subsystem.
+ executable = os.path.abspath('bin/py')
configure_args = ( './configure', '--prefix', mailman_path, '--with-var-prefix=' + var_dir,
- '--with-python=' + os.path.abspath('bin/py'),
+ '--with-python=' + executable, '--with-username=' + user, '--with-groupname=' + group, '--with-mail-gid=' + group, '--with-mailhost=' + build_host_name, '--with-urlhost=' + build_host_name,
)
+ # Configure.
retcode = subprocess.call(configure_args, cwd=mailman_source)
if retcode:
print >> sys.stderr, 'Could not configure Mailman:' sys.exit(retcode)
+ # Make.
retcode = subprocess.call(('make',), cwd=mailman_source)
if retcode:
print >> sys.stderr, 'Could not make Mailman.' sys.exit(retcode)
+ # We have a brief interlude before we install. Hardy will not
+ # accept a script as the executable for the shebang line--it will
+ # treat the file as a shell script instead. The ``bin/by``
+ # executable that we specified in '--with-python' above is a script
+ # so this behavior causes problems for us. Our work around is to
+ # prefix the ``bin/py`` script with ``/usr/bin/env``, which makes
+ # Hardy happy. We need to do this before we install because the
+ # installation will call Mailman's ``bin/update``, which is a script
+ # that needs this fix.
+ build_dir = os.path.join(mailman_source, 'build')
+ original = '#! %s\n' % (executable,)
+ modified = '#! /usr/bin/env %s\n' % (executable,)
+ for (dirpath, dirnames, filenames) in os.walk(build_dir):
+ for filename in filenames:
+ filename = os.path.join(dirpath, filename)
+ f = open(filename, 'r')
+ if f.readline() == original:
+ rest = f.read()
+ f.close()
+ f = open(filename, 'w')
+ f.write(modified)
+ f.write(rest)
+ f.close()
+ # Now we actually install.
retcode = subprocess.call(('make', 'install'), cwd=mailman_source)
if retcode:
print >> sys.stderr, 'Could not install Mailman.'
Here's an idea: use ``#! /usr/bin/env {path-to-bin/py}`` instead of ``#! {path-to-bin/py}``. Make that modification after Mailman's ``make`` and before ``make install`` (because Mailman's ``make install`` tries to run ``bin/update``). It seemed to work as a technique when I experimented yesterday on the ec2 instance. I don't see a downside yet (other than the small amount of code to do the hack). It should work. I'll push and give it a try on ec2.
The incremental diff below also switches bin/py back to a shell script. This seemed to make the Mailman pofile creation happier on hardy than the zc.buildout Python version that I had switched to for this branch. It also meant that I could go back to using -t normally in the Makefile. (I had switched from the shell version primarily because I didn't know I would have to get a shell version working; now that we have the site.py hack, it works fine.)
=== modified file 'Makefile'
--- Makefile 2009-10-13 18:50:35 +0000
+++ Makefile 2009-10-17 17:46:38 +0000
@@ -82,7 +82,7 @@
check: clean build
# Run all tests. test_on_merge.py takes care of setting up the
# database.
- ${PYTHON} -t ${PY} ./test_on_merge.py $(VERBOSITY)
+ ${PY} -t ./test_on_merge.py $(VERBOSITY)
jscheck: build MailmanLayer MailmanLayer
# Run all JavaScript integration tests. The test runner takes care of
@@ -103,7 +103,7 @@
check_mailman: build
# Run all tests, including the Mailman integration
# tests. test_on_merge.py takes care of setting up the database.
- ${PYTHON} -t ${PY} ./test_on_merge.py $(VERBOSITY) --layer=
+ ${PY} -t ./test_on_merge.py $(VERBOSITY) --layer=
lint: ${PY}
@bash ./bin/lint.sh
@@ -112,7 +112,7 @@
@bash ./bin/lint.sh -v
xxxreport: $(PY) xxxreport. py -f csv -o xxx-report.csv ./ xxxreport. py -f csv -o xxx-report.csv ./
- ${PYTHON} -t ${PY} ./utilities/
+ ${PY} -t ./utilities/
check-configs: $(PY) check-configs. py VERSION= ${PYTHON_ VERSION} LPCONFIG= ${LPCONFIG} ${LPCONFIG} ${PYTHON} -t ${PY} buildmailman.py ${LPCONFIG} ${PY} -t buildmailman.py lazr-js/ tools/build. py \ launchpad/ javascript \ launchpad/ icing/build $(EXTRA_JS_FILES)
${PY} utilities/
@@ -149,7 +149,7 @@
compile: $(PY)
${SHHH} $(MAKE) -C sourcecode build PYTHON=${PYTHON} \
PYTHON_
- ${SHHH} LPCONFIG=
+ ${SHHH} LPCONFIG=
${SHHH} $(PY) sourcecode/
-n launchpad -s lib/canonical/
-b lib/canonical/
=== modified file 'buildmailman.py'
--- buildmailman.py 2009-10-15 04:19:54 +0000
+++ buildmailman.py 2009-10-18 00:59:56 +0000
@@ -84,25 +84,52 @@
# Build and install the Mailman software. Note that we don't care about abspath( 'bin/py' )
'./configure' ,
'--prefix' , mailman_path,
'--with- var-prefix= ' + var_dir, abspath( 'bin/py' ),
'--with- username= ' + user,
'--with- groupname= ' + group,
'--with- mail-gid= ' + group,
'--with- mailhost= ' + build_host_name,
'--with- urlhost= ' + build_host_name, call(configure_ args, cwd=mailman_source)
sys.exit( retcode) call((' make',) , cwd=mailman_source)
sys.exit( retcode) join(mailman_ source, 'build') join(dirpath, filename) call((' make', 'install'), cwd=mailman_source)
# --with-cgi-gid because we're not going to use that Mailman subsystem.
+ executable = os.path.
configure_args = (
- '--with-python=' + os.path.
+ '--with-python=' + executable,
)
+ # Configure.
retcode = subprocess.
if retcode:
print >> sys.stderr, 'Could not configure Mailman:'
+ # Make.
retcode = subprocess.
if retcode:
print >> sys.stderr, 'Could not make Mailman.'
+ # We have a brief interlude before we install. Hardy will not
+ # accept a script as the executable for the shebang line--it will
+ # treat the file as a shell script instead. The ``bin/by``
+ # executable that we specified in '--with-python' above is a script
+ # so this behavior causes problems for us. Our work around is to
+ # prefix the ``bin/py`` script with ``/usr/bin/env``, which makes
+ # Hardy happy. We need to do this before we install because the
+ # installation will call Mailman's ``bin/update``, which is a script
+ # that needs this fix.
+ build_dir = os.path.
+ original = '#! %s\n' % (executable,)
+ modified = '#! /usr/bin/env %s\n' % (executable,)
+ for (dirpath, dirnames, filenames) in os.walk(build_dir):
+ for filename in filenames:
+ filename = os.path.
+ f = open(filename, 'r')
+ if f.readline() == original:
+ rest = f.read()
+ f.close()
+ f = open(filename, 'w')
+ f.write(modified)
+ f.write(rest)
+ f.close()
+ # Now we actually install.
retcode = subprocess.
if retcode:
print >> sys.stderr, 'Could not install Mailman.'
=== renamed file 'buildout- templates/ bin/pythonpath- py.in' => 'buildout- templates/ bin/py. in'
=== modified file 'buildout.cfg'
--- buildout.cfg 2009-10-13 18:50:35 +0000
+++ buildout.cfg 2009-10-17 17:44:14 +0000
@@ -46,7 +46,6 @@
[scripts]
recipe = zc.recipe.egg
-interpreter = py
eggs = lp
windmill
funkload