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

Unified Diff: appengine/swarming/swarming_bot/__main__.py

Issue 2496803002: swarming: Reload the google py library after initializing a bot's path. (Closed)
Patch Set: Created 4 years, 1 month 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: appengine/swarming/swarming_bot/__main__.py
diff --git a/appengine/swarming/swarming_bot/__main__.py b/appengine/swarming/swarming_bot/__main__.py
index 54a9c8d3a2e4a9ed6a7147fbbbe6fbfcb1f49de3..689b2e4b208c6ea1696998ddb1555e8ae692b598 100644
--- a/appengine/swarming/swarming_bot/__main__.py
+++ b/appengine/swarming/swarming_bot/__main__.py
@@ -35,6 +35,15 @@ sys.path.insert(0, os.path.join(THIS_FILE, 'third_party', 'pyasn1'))
sys.path.insert(0, os.path.join(THIS_FILE, 'third_party', 'pyasn1-modules'))
sys.path.insert(0, os.path.join(THIS_FILE, 'third_party', 'rsa'))
+# The google library can occasionally get imported prior to the path
+# maipulation above. If this happens, reload the module to pick up the version
+# packaged in the bot_code in third_party.
+path_to_zip = os.path.dirname(os.path.realpath(__file__))
+path_to_google = os.path.join(path_to_zip, 'third_party', 'google')
+import google
+if google.__path__[0] != path_to_google:
+ google = reload(google)
+
from bot_code import common
« 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