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) |