summaryrefslogtreecommitdiff
path: root/buildscripts/moduleconfig.py
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2018-03-26 11:25:04 -0400
committerJonathan Abrahams <jonathan@mongodb.com>2018-03-26 13:04:25 -0400
commit36148ad8bbdb94162b2926f4700d935ee4dc5994 (patch)
tree1d893c4ca0b0afa407f7724c7942dfbf643560af /buildscripts/moduleconfig.py
parentd62d631f0ca40c5199fdfae2980080ca0cc982b5 (diff)
downloadmongo-36148ad8bbdb94162b2926f4700d935ee4dc5994.tar.gz
SERVER-23312 Format Python files with yapf
Diffstat (limited to 'buildscripts/moduleconfig.py')
-rw-r--r--buildscripts/moduleconfig.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/buildscripts/moduleconfig.py b/buildscripts/moduleconfig.py
index eece68bcdc3..e6f39b65d5e 100644
--- a/buildscripts/moduleconfig.py
+++ b/buildscripts/moduleconfig.py
@@ -26,12 +26,13 @@ MongoDB SConscript files do.
from __future__ import print_function
__all__ = ('discover_modules', 'discover_module_directories', 'configure_modules',
- 'register_module_test')
+ 'register_module_test')
import imp
import inspect
import os
+
def discover_modules(module_root, allowed_modules):
"""Scans module_root for subdirectories that look like MongoDB modules.
@@ -71,6 +72,7 @@ def discover_modules(module_root, allowed_modules):
return found_modules
+
def discover_module_directories(module_root, allowed_modules):
"""Scans module_root for subdirectories that look like MongoDB modules.
@@ -101,6 +103,7 @@ def discover_module_directories(module_root, allowed_modules):
return found_modules
+
def configure_modules(modules, conf):
""" Run the configure() function in the build.py python modules for each module in "modules"
(as created by discover_modules).
@@ -114,6 +117,7 @@ def configure_modules(modules, conf):
root = os.path.dirname(module.__file__)
module.configure(conf, conf.env)
+
def get_module_sconscripts(modules):
sconscripts = []
for m in modules:
@@ -121,6 +125,7 @@ def get_module_sconscripts(modules):
sconscripts.append(os.path.join(module_dir_path, 'SConscript'))
return sconscripts
+
def __get_src_relative_path(path):
"""Return a path relative to ./src.
@@ -135,6 +140,7 @@ def __get_src_relative_path(path):
result = path[len(src_dir) + 1:]
return result
+
def __get_module_path(module_frame_depth):
"""Return the path to the MongoDB module whose build.py is executing "module_frame_depth" frames
above this function, relative to the "src" directory.
@@ -142,6 +148,7 @@ def __get_module_path(module_frame_depth):
module_filename = inspect.stack()[module_frame_depth + 1][1]
return os.path.dirname(__get_src_relative_path(module_filename))
+
def __get_module_src_path(module_frame_depth):
"""Return the path relative to the SConstruct file of the MongoDB module's source tree.
@@ -150,6 +157,7 @@ def __get_module_src_path(module_frame_depth):
"""
return os.path.join('src', __get_module_path(module_frame_depth + 1))
+
def __get_module_build_path(module_frame_depth):
"""Return the path relative to the SConstruct file of the MongoDB module's build tree.
@@ -158,6 +166,7 @@ def __get_module_build_path(module_frame_depth):
"""
return os.path.join('$BUILD_DIR', __get_module_path(module_frame_depth + 1))
+
def get_current_module_src_path():
"""Return the path relative to the SConstruct file of the current MongoDB module's source tree.
@@ -165,6 +174,7 @@ def get_current_module_src_path():
"""
return __get_module_src_path(1)
+
def get_current_module_build_path():
"""Return the path relative to the SConstruct file of the current MongoDB module's build tree.
@@ -173,6 +183,7 @@ def get_current_module_build_path():
return __get_module_build_path(1)
+
def get_current_module_libdep_name(libdep_rel_path):
"""Return a $BUILD_DIR relative path to a "libdep_rel_path", where "libdep_rel_path"
is specified relative to the MongoDB module's build.py file.