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

Unified Diff: recipe_engine/env.py

Issue 2154943002: Assert using realpath when confirming "env". (Closed) Base URL: https://github.com/luci/recipes-py@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_engine/env.py
diff --git a/recipe_engine/env.py b/recipe_engine/env.py
index 1729bd1e5f99813157a1a8bfb6bf5c67d4683baa..c04d7fc04e0874a590697fbd7a8f976da5410312 100644
--- a/recipe_engine/env.py
+++ b/recipe_engine/env.py
@@ -59,6 +59,11 @@ with temp_sys_path():
# From here on out, we're back to normal imports. Let's assert that the we're
# using the correct protobuf package, though.
+#
+# We use "realpath" here because the importer may resolve the path differently
+# based on symlinks, and we want to make sure our calculated path matches the
+# impoter's path regardless.
import google.protobuf
-assert THIRD_PARTY in google.protobuf.__path__[0]
+assert (os.path.realpath(THIRD_PARTY) in
+ os.path.realpath(google.protobuf.__path__[0]))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698