From 7bbda2fbfd7a6235202c50ef9f3bc4a0c938cc48 Mon Sep 17 00:00:00 2001 From: Robert Guo Date: Thu, 5 Oct 2017 10:14:59 -0400 Subject: [PATCH] SERVER-30839 add back resmoke import checks --- buildscripts/collect_resource_info.py | 4 +++- buildscripts/combine_reports.py | 4 +++- buildscripts/resmoke.py | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/buildscripts/collect_resource_info.py b/buildscripts/collect_resource_info.py index 5fc6c614afa..56bbb073fca 100755 --- a/buildscripts/collect_resource_info.py +++ b/buildscripts/collect_resource_info.py @@ -18,7 +18,9 @@ import requests # Get relative imports to work when the package is not installed on the PYTHONPATH. -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +if __name__ == "__main__" and __package__ is None: + sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + from buildscripts.resmokelib import utils diff --git a/buildscripts/combine_reports.py b/buildscripts/combine_reports.py index e0e81569a80..619817a9f3c 100755 --- a/buildscripts/combine_reports.py +++ b/buildscripts/combine_reports.py @@ -14,7 +14,9 @@ import sys from optparse import OptionParser # Get relative imports to work when the package is not installed on the PYTHONPATH. -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +if __name__ == "__main__" and __package__ is None: + sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + from buildscripts.resmokelib.testing import report from buildscripts.resmokelib import utils diff --git a/buildscripts/resmoke.py b/buildscripts/resmoke.py index aa8d437d815..ef4152baed9 100755 --- a/buildscripts/resmoke.py +++ b/buildscripts/resmoke.py @@ -12,7 +12,9 @@ import sys import time # Get relative imports to work when the package is not installed on the PYTHONPATH. -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +if __name__ == "__main__" and __package__ is None: + sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + from buildscripts import resmokelib