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

Unified Diff: appengine/predator/analysis/old_init.py

Issue 2447253002: [Findit & Predator] Code reorg of Findit. (Closed)
Patch Set: Clean up. 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
Index: appengine/predator/analysis/old_init.py
diff --git a/appengine/predator/analysis/old_init.py b/appengine/predator/analysis/old_init.py
new file mode 100644
index 0000000000000000000000000000000000000000..599f3b8206c1883bdfe0e6bb6f4295ff8cb86673
--- /dev/null
+++ b/appengine/predator/analysis/old_init.py
@@ -0,0 +1,19 @@
+import os
+import sys
+
+# The main reason for this hack is: we want this module to be self-contained.
+# And due to testing setup in the infra repo, appengine/cr_culprit_finder would
+# be the current working directory during test execution instead of this
+# directory. But we can't import from appengine/cr_culprit_finder, because the
+# root directory for app deployment is appengine/cr_culprit_finder/service/*
+# instead.
+#
+# As a side effect, clients importing this module via symbolic links don't have
+# to explicitly add this directory to the PYTHONPATH or sys.path, because it is
+# implicitly done here.
+#
+# Add to sys.path this directory so that unittests and deployed app won't
+# complain about modules not found.
+_THIS_DIR = os.path.dirname(os.path.abspath(__file__))
+if _THIS_DIR not in sys.path:
+ sys.path.insert(0, _THIS_DIR)

Powered by Google App Engine
This is Rietveld 408576698