Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1007)

Unified Diff: third_party/dom_distiller_js/protoc_plugins/util/plugin_protos.py

Issue 2935953002: Fix protobuf's Python runtime and imports.
Patch Set: debug import path Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/dom_distiller_js/BUILD.gn ('k') | third_party/protobuf/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/dom_distiller_js/protoc_plugins/util/plugin_protos.py
diff --git a/third_party/dom_distiller_js/protoc_plugins/util/plugin_protos.py b/third_party/dom_distiller_js/protoc_plugins/util/plugin_protos.py
index 009987dfd18b1a5d0357847a45ca308b4b381be4..e60cba19618783049cb7d6d15956021f5dddfb32 100644
--- a/third_party/dom_distiller_js/protoc_plugins/util/plugin_protos.py
+++ b/third_party/dom_distiller_js/protoc_plugins/util/plugin_protos.py
@@ -12,22 +12,22 @@ and https://developers.google.com/protocol-buffers/docs/reference/cpp/google.pro
import os
import sys
-SCRIPT_DIR = os.path.dirname(__file__)
-SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..', '..', '..'))
-
-sys.path.insert(
- 1, os.path.join(SRC_DIR, 'third_party', 'protobuf', 'python'))
-sys.path.insert(
- 1, os.path.join(SRC_DIR, 'third_party', 'protobuf', 'third_party', 'six'))
+PYPROTO_DIR = os.path.abspath('pyproto')
+sys.path.insert(0, PYPROTO_DIR)
+import google.protobuf
+
+FOO = os.path.abspath( \
+ os.path.join(os.path.dirname(google.protobuf.__file__), '..', '..'))
+if PYPROTO_DIR != FOO:
+ print >> sys.stderr, 'PYPROTO_DIR = ' + PYPROTO_DIR
+ print >> sys.stderr, 'FOO = ' + FOO
+ assert False
+
+from google.protobuf.compiler import plugin_pb2
from google.protobuf.descriptor_pb2 import FieldDescriptorProto
from . import types
-sys.path.insert(
- 1, os.path.join(SRC_DIR,
- 'third_party', 'dom_distiller_js', 'dist', 'python'))
-import plugin_pb2
-
class PluginRequest(object):
def __init__(self, proto):
« no previous file with comments | « third_party/dom_distiller_js/BUILD.gn ('k') | third_party/protobuf/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698