Page MenuHomePhabricator

Change Python hashbang to `#! /usr/bin/env python -E -s` for user-facing tools
Closed, ResolvedPublic

Description

-E ignores the PYTHONPATH environment variable, while -s ignores the user-packages directory. This prevents confusion such as in T144554: BUB 503: AttributeError: 'module' object has no attribute 'python_2_unicode_compatible'.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

In addition, -E -s makes webservice start much faster if PYTHONPATH refers to a directory on NFS; the user-packages directory is always on NFS and therefore always slow.

Change 322790 had a related patch set uploaded (by BryanDavis):
jsub: guard against PYTHONPATH munging in caller's environment

https://gerrit.wikimedia.org/r/322790

Change 322799 had a related patch set uploaded (by BryanDavis):
webservice: guard against PYTHONPATH munging in caller's environment

https://gerrit.wikimedia.org/r/322799

Change 322799 merged by jenkins-bot:
webservice: guard against PYTHONPATH munging in caller's environment

https://gerrit.wikimedia.org/r/322799

Change 322790 merged by jenkins-bot:
jsub: guard against PYTHONPATH munging in caller's environment

https://gerrit.wikimedia.org/r/322790

scfc assigned this task to bd808.
scfc added a subscriber: scfc.

The packages still need to be built and deployed.

Thanks @scfc. @yuvipanda reminded me of this but I had not dug up the task and reopened it yet. I'll get this done "soon".

bd808 triaged this task as High priority.Dec 1 2016, 9:58 PM

Change 325431 had a related patch set uploaded (by BryanDavis):
jsub: Fix #!... to actually work

https://gerrit.wikimedia.org/r/325431

Change 325431 merged by jenkins-bot:
jsub: Fix #!... to actually work

https://gerrit.wikimedia.org/r/325431

Mentioned in SAL (#wikimedia-labs) [2016-12-05T22:52:46Z] <bd808> Updated jobutils to 1.17 on tools-bastion-02 (T147350)

Mentioned in SAL (#wikimedia-labs) [2016-12-05T22:52:56Z] <bd808> Updated jobutils to 1.17 on tools-bastion-03 (T147350)

Mentioned in SAL (#wikimedia-labs) [2016-12-05T22:53:08Z] <bd808> Updated jobutils to 1.17 on tools-cron-01 (T147350)

Mentioned in SAL (#wikimedia-labs) [2016-12-05T22:53:41Z] <bd808> Updated jobutils to 1.17 on tools-precise-dev (T147350)

Mentioned in SAL (#wikimedia-labs) [2016-12-05T22:55:10Z] <bd808> Updated jobutils to 1.17 on tools-mail (T147350)

Change 325436 had a related patch set uploaded (by BryanDavis):
webservice: Fix #!...

https://gerrit.wikimedia.org/r/325436

Change 325436 merged by jenkins-bot:
webservice: Fix #!...

https://gerrit.wikimedia.org/r/325436

Mentioned in SAL (#wikimedia-labs) [2016-12-05T23:19:22Z] <bd808> Updated toollabs-webservice to 0.31 on tools-bastion-02 (T147350)

Mentioned in SAL (#wikimedia-labs) [2016-12-06T00:36:50Z] <bd808> Updated toollabs-webservice to 0.31 on rest of cluster (T147350)

Packages have been built and deployed.

bd808 moved this task from Done to Archive on the User-bd808 board.