[Distutils] setup.py script using python interpreter from previous run

2010-11-09 Thread Geoff Bache
Hi all,

I have the following setup.py script:

#!/usr/bin/env python
from distutils.core import setup

scripts=[hello.py]

setup(scripts=scripts)

I have two different python installations (using virtualenv) where I
wish to install this program. So I do

~/tmp/test_setup/python1/bin/python setup.py install

which creates a file at
/users/geoff/tmp/test_setup/python1/bin/hello.py, that looks like
this:

#!/users/geoff/tmp/test_setup/python1/bin/python

print Hello

So far so good. But then I also install it somewhere else:

~/tmp/test_setup/python2/bin/python setup.py install

which creates a file at
/users/geoff/tmp/test_setup/python2/bin/hello.py which refers to
python1, i..e it has the same contents as the first one. Which is
clearly not what I want.

Is this a bug? Or have I missed something in my setup.py? It works of
course if I remove the generated build directory by hand, but it's
not so nice to have to remember to do that.

(I'm using Python2.6 on Linux)

Regards,
Geoff Bache
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] setup.py script using python interpreter from previous run

2010-11-09 Thread Fred Drake
On Tue, Nov 9, 2010 at 5:58 AM, Geoff Bache geoff.ba...@gmail.com wrote:
 Is this a bug?

I think so.

 Or have I missed something in my setup.py? It works of
 course if I remove the generated build directory by hand, but it's
 not so nice to have to remember to do that.

You should be able to remove the build/ directory that was created
where the package is unpacked, and then run the install command with
your python2/bin/python.  The problem is that build and install
are traditionally two distinct steps.  While setup.py takes care of
both for you, it does detect that you switched Python's, so doesn't
re-build for the second.


  -Fred

--
Fred L. Drake, Jr.    fdrake at acm.org
A storm broke loose in my mind.  --Albert Einstein
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] setup.py script using python interpreter from previous run

2010-11-09 Thread Geoff Bache
Hi Tarek,

 Can you add an issue in bugs.python.org please (using the Distutils2
 component and feature request)

I've added a bug, but felt I had to describe it as I saw it (i.e. a
behaviour issue
with Distutils). It took me quite some time to track down what was going on,
and I didn't think I was doing anything complicated or unusual. It can't be
that hard to fix it in distutils can it (as you've just been discussing)?

Regards,
Geoff
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] setup.py script using python interpreter from previous run

2010-11-09 Thread Fred Drake
On Tue, Nov 9, 2010 at 6:31 AM, Tarek Ziadé ziade.ta...@gmail.com wrote:
 Or... keep in that configure file the path to the interpreter and just
 rebuild all scripts in case the interpreter has changed.

+1 to the simple approach.

Given the need to do this, I guess I don't really see the value of
storing scripts in the build tree.  But I suppose someone actually
uses them from there somehow.  (I'd expect getting the imports to work
would be a painful exercise, but I've seen enough tortured processes
that I wouldn't put it past folks.)


  -Fred

--
Fred L. Drake, Jr.    fdrake at acm.org
A storm broke loose in my mind.  --Albert Einstein
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig