New issue
Advanced search Search tips

Issue 764314 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Find a good way to import python protobuf

Project Member Reported by yakovleva@google.com, Sep 12 2017

Issue description

Python chrome device policy protobuf imports libraries
which has no location when you call:
  from chrome_device_policy_pb2 import ChromeDeviceSettingsProto

We add this locations to put library paths to sys.path.
But libraries might be already loaded (i.e. due to Google App Engine)
and we have to reload this libraries.

Probably, it's possible to find better solution to do it.

Some links from Maxim (emaxx) which could help:
1. GoogleProtobufModuleImporter from binary_proto_generator.py - which probably does the trick, but seems that we can't reuse it without copy-pasting or refactoring its code [https://cs.chromium.org/chromium/src/chrome/browser/resources/protobufs/binary_proto_generator.py?l=21&rcl=69b2a240b29809604dc859c8a41eb4f920deccfa];
2. env.py - which contains another way of doing the magic [https://cs.chromium.org/chromium/infra/recipes-py/recipe_engine/env.py?l=47&rcl=91b41ae8cc30cc42880f60e169a854954c78493e];
3. Discussion between the Chromium and Protobuf authors (probably with essentially the same as #2, but still interesting to read) [https://github.com/google/protobuf/issues/1484];
4. run_slave.py - with another hack [https://cs.chromium.org/chromium/build/slave/run_slave.py?l=453&rcl=8545c35fe412d5154dacb7ab068ba1d3d2eb8cbf];
5. even more [https://cs.chromium.org/chromium/infra/luci/appengine/components/components/utils.py?l=652&rcl=8b90cdd97f8f088bcba2fa376ce49d9863b48902].
 
Project Member

Comment 1 by bugdroid1@chromium.org, Sep 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/579f1f6ef8167f9f4a9c15bbf805c28453a29d93

commit 579f1f6ef8167f9f4a9c15bbf805c28453a29d93
Author: Daria Yakovleva <yakovleva@google.com>
Date: Tue Sep 12 14:07:02 2017

Reload google library in policy remover script

When python script run it could already download
google library (i.e. because of Google App Engine).
This library contains wrong google protobuf library.
Therefore we have to reload google library in the script.

Bug: 764314
Change-Id: I26d7ea31988d7b818d8c4c702e1614c7d35c85d5
Reviewed-on: https://chromium-review.googlesource.com/660222
Commit-Queue: Daria Iakovleva <yakovleva@google.com>
Reviewed-by: Drew Wilson <atwilson@chromium.org>
Reviewed-by: Denis Kuznetsov <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501262}
[modify] https://crrev.com/579f1f6ef8167f9f4a9c15bbf805c28453a29d93/chrome/browser/chromeos/policy/tools/generate_device_policy_remover.py

Project Member

Comment 2 by sheriffbot@chromium.org, Oct 20 2017

Labels: Hotlist-Recharge-BouncingOwner
Owner: ----
The assigned owner "yakovleva@google.com" is not able to receive e-mails, please re-triage.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Components: Enterprise
Labels: -Type-Bug -Hotlist-Recharge-BouncingOwner Hotlist-GoodFirstBug Type-Feature
Labels: Enterprise-Triaged

Comment 5 by wychen@chromium.org, Nov 29 2017

Issue 764774 is similar.

Sign in to add a comment