Re: #! to two different pythons?

2009-06-07 Thread Duncan Booth
m...@pixar.com wrote:

 Benjamin Peterson benja...@python.org wrote:
 #!/usr/bin/env python
 
 But how can I handle this with two differently named pythons?
 
 #!/usr/anim/menv/bin/pypix
 #!/Users/mh/py/bin/python
 
 Thanks!
 Mark
 

If you install using with a setup.py that uses distutils then one of the  
features is that any script whose first line begins '#!' and contains 
'python' has that first line replaced by the current interpreter.

So in this example if you install your code with:

   /usr/anim/menv/bin/pypix setup.py install

#!/usr/bin/env python would be replaced by your desired 
#!/usr/anim/menv/bin/pypix.

Of course for your current purposes using setup.py might be overkill.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: #! to two different pythons?

2009-06-06 Thread Benjamin Peterson
 mh at pixar.com writes:

 What's the best way to handle this?

#!/usr/bin/env python




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: #! to two different pythons?

2009-06-06 Thread mh
Benjamin Peterson benja...@python.org wrote:
 #!/usr/bin/env python

But how can I handle this with two differently named pythons?

#!/usr/anim/menv/bin/pypix
#!/Users/mh/py/bin/python

Thanks!
Mark

-- 
Mark Harrison
Pixar Animation Studios
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: #! to two different pythons?

2009-06-06 Thread Cameron Simpson
On 06Jun2009 23:46, m...@pixar.com m...@pixar.com wrote:
| Benjamin Peterson benja...@python.org wrote:
|  #!/usr/bin/env python
| 
| But how can I handle this with two differently named pythons?
| 
| #!/usr/anim/menv/bin/pypix
| #!/Users/mh/py/bin/python

Well, it depends _why_ you have a python named pypix, but two
solutions suggest themselves:

  - Keep the #!/usr/bin/env python and then:
  ln -s /usr/anim/menv/bin/pypix /usr/local/bin/python
Presumes no other python, and /usr/local/bin might become ~/bin
or something like that.

  - Write a small wrapper shell script and use:
  #!/usr/bin/env my-wrapper-script

Regarding the first approach, on a personal basis I have two bin
directories: ~/bin and ~/bin-local on the machines I use. The former it
copied from my home account and is always the same - a bunch of useful
scripts. The latter is per-host customisation and is largely symlinks
to preferred versions of apps, apps installed out of the main paths,
and host-specific wrapper scripts.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Soon, Grasshopper, all will understand. And dispair.  The government that
defines what is good for you, will also dictate what is bad.
- Curt Howland  Ace   DoD#0663  EGFC#011  EFF#569
  howl...@priss.com   '82 V45 Sabre
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: #! to two different pythons?

2009-06-06 Thread mh
Cameron Simpson c...@zip.com.au wrote:
   - Keep the #!/usr/bin/env python and then:
   ln -s /usr/anim/menv/bin/pypix /usr/local/bin/python

Ah, that's a good idea.  The pypix is a company-wide maintained
python, but ln -s python pypix on my local Mac laptop python
install  makes the env work quite nicely.

The ~/bin and ~/bin-local is a great idea too... I've symlinked
to my dropbox account for bonus convenience.

thanks!!!
Mark
-- 
Mark Harrison
Pixar Animation Studios
-- 
http://mail.python.org/mailman/listinfo/python-list