Skip to content

Commit 30d83ba

Browse files
committed
Add submodules's path to sys.path for windows platform python-mode#852 with corrections
1 parent 7e43337 commit 30d83ba

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

pymode/utils.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
""" Pymode utils. """
1+
"""Pymode utils."""
22
import os.path
33
import sys
44
import threading
55
import warnings
66
from contextlib import contextmanager
77

8-
import vim # noqa
8+
import vim # noqa
99
from ._compat import StringIO
1010

1111

@@ -16,7 +16,7 @@
1616

1717
@contextmanager
1818
def silence_stderr():
19-
""" Redirect stderr. """
19+
"""Redirect stderr."""
2020
if DEBUG:
2121
yield
2222

@@ -36,4 +36,13 @@ def patch_paths():
3636
3737
Load required modules from the plugin's sources.
3838
"""
39-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'libs'))
39+
dir_script = os.path.dirname(os.path.abspath(__file__))
40+
sys.path.insert(0, os.path.join(dir_script, 'libs'))
41+
if sys.platform == 'win32':
42+
dir_submodule = os.path.abspath(os.path.join(dir_script,
43+
'..', 'submodules'))
44+
sub_modules = os.listdir(dir_submodule)
45+
for module in sub_modules:
46+
module_full_path = os.path.join(dir_submodule, module)
47+
if module_full_path not in sys.path:
48+
sys.path.insert(0, module_full_path)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy