From e3783576e3bbdaab4094ebb821a8c7e1f63651d9 Mon Sep 17 00:00:00 2001 From: wangcgfan Date: Sun, 11 Feb 2018 23:24:52 +0800 Subject: [PATCH] Add submodules's path to sys.path for windows platform --- pymode/utils.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pymode/utils.py b/pymode/utils.py index 1ce2e343..bbfefd25 100644 --- a/pymode/utils.py +++ b/pymode/utils.py @@ -36,4 +36,13 @@ def patch_paths(): Load required modules from the plugin's sources. """ - sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'libs')) + dir_script = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, os.path.join(dir_script, 'libs')) + if sys.platform == 'win32': + dir_submodule = os.path.abspath(os.path.join(dir_script, + '..', 'submodules')) + sub_modules = ['pylama', 'mccabe', 'autopep8', 'pycodestyle', + 'pydocstyle', 'pyflakes', 'snowball_py'] + for module in sub_modules: + if module not in sys.path: + sys.path.insert(0, os.path.join(dir_submodule, module))