I'm a bit confused about how to build/install a Python script.  I
build and install Python modules by placing the following in my
my configure.ac file:

  AM_PATH_PYTHON([2.4])

and the following in a Makefile.am file:

  python_PYTHON = module1.py module2.py

This correctly detects python and installs the source and compiled
modules (.pyo and .pyc) in the right place (i.e.,
$PREFIX/lib/python-VERSION/site-packages/).

I also have a script that uses these modules, script.py.  I want this
to be installed in /usr/bin as 'script'.  I'd preferably like a
compiled version of the script to be installed there.  I'd also like
to install the sources.  What should I do?

I see three options:

- Build 'script' from script.py, i.e., copy script.py and mark it as
  executable.  Add 'script' to dist_bin_SCRIPTS.  This has the
  disadvantage that the executable is not compiled (and thus has a
  slightly longer start up time).

- Create a symbolic link from $PREFIX/bin/script to
  $PREFIX/lib/python-VERSION/site-packages/script.pyo and make the
  compiled version executable using automake's install-exec target.

- Create a simple shell script that does something along the lines of
  'exec @PYTHON@ $PREFIX/lib/python-VERSION/site-packages/script.pyo
  "$@"'.  Like the first option, this has some overhead.

Suggestions?

Thanks,

Neal

Reply via email to