Re: #! /usr/bin/python{,3} -Es

2012-10-26 Thread Floris Bruynooghe
On 25 October 2012 20:34, Piotr Ożarowski pi...@debian.org wrote:
 [Steve Langasek, 2012-10-25]
 On Thu, Oct 25, 2012 at 10:56:05AM -0400, Barry Warsaw wrote:
  Using -E fixed the immediate bug, but I think it is generally useful to
  include -s also, so as to avoid any potential breakage of system scripts by
  things users may have added locally.

 If there's consensus that this should be dealt with in the packages, best
 would be to update the tooling (IIRC dh_python* already have some support
 for shebang rewrites?) and add a lintian warning, foregoing any mass bug
 filing.

  dh_python2 --shebang '/usr/bin/python -Es'
  dh_python3 --shebang '/usr/bin/python3 -Es'

 should do the trick. I don't think adding -Es by default is a good idea
 (although it's very tempting).

Several people have said they don't think this is a good idea.  But
why not?  There is a bad effect if you don't rewrite the shebang to
/usr/bin/python[3] -ES that we know of, but is there any example of
where such a shebang line would cause trouble that warrants not doing
this by default?

Regards,
Floris


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAAWk_Dy4yXr4Xvksw7V6Sc-SYg+3mBZroCqDXnoq1kNF=yu...@mail.gmail.com



Re: #! /usr/bin/python{,3} -Es

2012-10-26 Thread Thomas Kluyver
On 26 October 2012 09:19, Floris Bruynooghe f...@devork.be wrote:
 Several people have said they don't think this is a good idea.  But
 why not?  There is a bad effect if you don't rewrite the shebang to
 /usr/bin/python[3] -ES that we know of, but is there any example of
 where such a shebang line would cause trouble that warrants not doing
 this by default?

Are there any situations where you might want to run a system script
with modified Python environment variables? I can't think of any off
the top of my head. Here's the list of environment variables:

http://docs.python.org/using/cmdline.html#environment-variables

Thomas


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAOvn4qjiW6VicuZnT-CdQnESXkVMc0kO4pVGCV_3vLwx=nd...@mail.gmail.com



Re: #! /usr/bin/python{,3} -Es

2012-10-26 Thread Jakub Wilk

* Thomas Kluyver tho...@kluyver.me.uk, 2012-10-26, 11:03:
Are there any situations where you might want to run a system script 
with modified Python environment variables? I can't think of any off 
the top of my head. Here's the list of environment variables:


http://docs.python.org/using/cmdline.html#environment-variables


What is the definition of system script?

--
Jakub Wilk


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20121026103340.ga3...@jwilk.net



Re: #! /usr/bin/python{,3} -Es

2012-10-26 Thread Chow Loong Jin
On 26/10/2012 18:33, Jakub Wilk wrote:
 * Thomas Kluyver tho...@kluyver.me.uk, 2012-10-26, 11:03:
 Are there any situations where you might want to run a system script with
 modified Python environment variables? I can't think of any off the top of my
 head. Here's the list of environment variables:

 http://docs.python.org/using/cmdline.html#environment-variables
 
 What is the definition of system script?

Any script installed via dpkg, perhaps?

-- 
Kind regards,
Loong Jin



signature.asc
Description: OpenPGP digital signature


Re: #! /usr/bin/python{,3} -Es

2012-10-26 Thread Thomas Kluyver
On 26 October 2012 11:53, Chow Loong Jin hyper...@debian.org wrote:
 What is the definition of system script?

 Any script installed via dpkg, perhaps?

I wouldn't have said so - I install plenty of Python scripts from
packages, like /usr/bin/ipython, that I wouldn't call system scripts.
I don't think there's a robust distinction on Linux, but there's
loosely a difference between system components and user applications.

Thomas


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAOvn4qjjutDhApA1YVBGWY61z9NoLp=r8ctkhggw-jwdnwf...@mail.gmail.com



Re: #! /usr/bin/python{,3} -Es

2012-10-26 Thread Paul Tagliamonte
On Fri, Oct 26, 2012 at 11:03:34AM +0100, Thomas Kluyver wrote:
 On 26 October 2012 09:19, Floris Bruynooghe f...@devork.be wrote:
  Several people have said they don't think this is a good idea.  But
  why not?  There is a bad effect if you don't rewrite the shebang to
  /usr/bin/python[3] -ES that we know of, but is there any example of
  where such a shebang line would cause trouble that warrants not doing
  this by default?
 
 Are there any situations where you might want to run a system script
 with modified Python environment variables? I can't think of any off
 the top of my head. Here's the list of environment variables:

django-admin if I'm using a virtualenv? Perhaps I'm missing the point?
Will this just break all virtualenv support?

If so, I'm not keen on that.

 
 http://docs.python.org/using/cmdline.html#environment-variables
 
 Thomas
 
 
 -- 
 To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
 with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
 Archive: 
 http://lists.debian.org/CAOvn4qjiW6VicuZnT-CdQnESXkVMc0kO4pVGCV_3vLwx=nd...@mail.gmail.com
 

-- 
 .''`.  Paul Tagliamonte paul...@debian.org
: :'  : Proud Debian Developer
`. `'`  4096R / 8F04 9AD8 2C92 066C 7352  D28A 7B58 5B30 807C 2A87
 `- http://people.debian.org/~paultag


signature.asc
Description: Digital signature


Re: #! /usr/bin/python{,3} -Es

2012-10-26 Thread Thomas Kluyver
On 26 October 2012 14:20, Paul Tagliamonte paul...@debian.org wrote:
 django-admin if I'm using a virtualenv? Perhaps I'm missing the point?
 Will this just break all virtualenv support?

To my mind, django-admin is not a system script. A system script would
be something like the unattended-upgrades script, which you wouldn't
really want to be affected by virtualenvs.

Thomas


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caovn4qimsiet2_lwts2p1c37mjabgmi5tsxsy3ptzqgc-vy...@mail.gmail.com



Re: #! /usr/bin/python{,3} -Es

2012-10-26 Thread Floris Bruynooghe
On 26 October 2012 14:20, Paul Tagliamonte paul...@debian.org wrote:
 On Fri, Oct 26, 2012 at 11:03:34AM +0100, Thomas Kluyver wrote:
 On 26 October 2012 09:19, Floris Bruynooghe f...@devork.be wrote:
  Several people have said they don't think this is a good idea.  But
  why not?  There is a bad effect if you don't rewrite the shebang to
  /usr/bin/python[3] -ES that we know of, but is there any example of
  where such a shebang line would cause trouble that warrants not doing
  this by default?

 Are there any situations where you might want to run a system script
 with modified Python environment variables? I can't think of any off
 the top of my head. Here's the list of environment variables:

 django-admin if I'm using a virtualenv? Perhaps I'm missing the point?
 Will this just break all virtualenv support?

I don't think a virtualenv would break.  If I execute a script which
lives outside of the virtualenv I generally want it to work with the
python it was installed with.  I regularly trip over ipython breaking
inside a virtualenv for example.  I tend to keep virtualenvs separated
from the system python, if I need django-admin in the virtualenv then
I should install it there.

Regards,
Floris


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAAWk_DxR=3teKaEtBU6XyuL=kL4VRtWYs=vgxlngm9xjwya...@mail.gmail.com



Re: #! /usr/bin/python{,3} -Es

2012-10-26 Thread Barry Warsaw
On Oct 26, 2012, at 09:19 AM, Floris Bruynooghe wrote:

On 25 October 2012 20:34, Piotr Ożarowski pi...@debian.org wrote:
 [Steve Langasek, 2012-10-25]
 On Thu, Oct 25, 2012 at 10:56:05AM -0400, Barry Warsaw wrote:
  Using -E fixed the immediate bug, but I think it is generally useful to
  include -s also, so as to avoid any potential breakage of system scripts 
  by
  things users may have added locally.

 If there's consensus that this should be dealt with in the packages, best
 would be to update the tooling (IIRC dh_python* already have some support
 for shebang rewrites?) and add a lintian warning, foregoing any mass bug
 filing.

  dh_python2 --shebang '/usr/bin/python -Es'
  dh_python3 --shebang '/usr/bin/python3 -Es'

 should do the trick. I don't think adding -Es by default is a good idea
 (although it's very tempting).

Several people have said they don't think this is a good idea.  But
why not?  There is a bad effect if you don't rewrite the shebang to
/usr/bin/python[3] -ES that we know of, but is there any example of
where such a shebang line would cause trouble that warrants not doing
this by default?

(Note it's a lower-case 's'.  Upper-case 'S' does something different.)

I'm also curious as to why this would be generally bad.  I can completely
understand that there may be some scripts which you want to allow for user
customization, but I think those would be the exception, not the rule.  That's
why I think turning it on by default, with a --disable flag is probably the
right way to go.

Cheers,
-Barry


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20121026111518.27c10378@resist



Re: #! /usr/bin/python{,3} -Es

2012-10-26 Thread Barry Warsaw
On Oct 26, 2012, at 12:33 PM, Jakub Wilk wrote:

* Thomas Kluyver tho...@kluyver.me.uk, 2012-10-26, 11:03:
Are there any situations where you might want to run a system script with 
modified Python environment variables? I can't think of any off the top of 
my head. Here's the list of environment variables:

http://docs.python.org/using/cmdline.html#environment-variables

What is the definition of system script?

It's a good question.  In some sense, it's any script that is vital to the
proper functioning of the system, as opposed to applications which run on the
system.  lsb_release falls under that category for me, but not django-admin.

But maybe it's more like that famous line describing obscenity[1], I know it
when I see it.

Cheers,
-Barry

[1] http://en.wikipedia.org/wiki/I_know_it_when_I_see_it


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20121026112057.67d63f63@resist