automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Installing a python script in $PREFIX/bin


From: Neal H. Walfield
Subject: Installing a python script in $PREFIX/bin
Date: Mon, 29 Aug 2011 13:01:37 +0200
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

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

[Prev in Thread] Current Thread [Next in Thread]