Disabling site-packages when running Python scripts during Chromium build

24 views
Skip to first unread message

Adam Michalik

unread,
Apr 22, 2016, 7:51:03 PM4/22/16
to Chromium-dev
I had lots of fun debugging crbug.com/605592, which was caused by the Python script incorrectly using the protobuf library provided by the system instead of shipped by Chromium. This got me wondering whether we should disable site-packages when executing Python actions during build (i.e. pass "-s -S" to Python).

Is there any reason why we don't do that already? We shouldn't depend on the libraries being available on the system anyway -- instead, we should ship them ourselves inside third_party/.

Adam

Paweł Hajdan, Jr.

unread,
Apr 28, 2016, 6:42:43 AM4/28/16
to Adam Michalik, Chromium-dev
See https://groups.google.com/a/chromium.org/d/msg/blink-dev/m-9S04U12Xs/ljgLUVm1DEgJ for some past discussion about this.

I've changed my mind somewhat - infra python virtualenv works really well, and interactions with system libraries indeed are hard to debug.

Hermetic environment provides a nice, consistent and solid base.

I'd have a slight suggestion to add an option to control whether -S will be passed to python invocations or not. I could write patches for that, and your initial version could do the simplest thing that works.

WDYT?

Paweł

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Adam Michalik

unread,
Apr 28, 2016, 1:36:46 PM4/28/16
to Paweł Hajdan, Jr., Adam Michalik, Chromium-dev
Infra python virtualenv still seems to have some extra stuff available in path -- e.g. I remember one of the buildbots had protobuf-2 library available in path that was coming from somewhere in /build or /infra. Additionally, they only solve problem in the infra environment -- stuff still could be broken for people who just try to compile Chromium themselves. We might want to start to require virtualenv and run all Python actions in virtualenvs not only on infra, but for all builds.

Having "-S" available as an option is good, however I believe that in every case we use some Python library we ship ourselves, we'll likely want to use it, and invocation of Python without "-S" would be reserved only for simple scripts that only use standard library.

I'd be very grateful for your patches! 

Adam
Reply all
Reply to author
Forward
0 new messages