Files
openide/python/helpers/extra_syspath.py
Semyon Proshev 65be4fea6d Supports iterable as module.__path__ (PY-29817)
We have to update this after change in pygobject:
4208d1eab0
2018-10-25 18:12:17 +03:00

19 lines
519 B
Python

import sys, os
qualified_name = sys.argv[-1]
path = qualified_name.split(".")
try:
module = __import__(qualified_name, globals(), locals(), [path[-1]])
try:
module_path = module.__path__
if isinstance(module_path, str):
sys.stdout.write(os.sep.join(module_path.split(os.sep)[:-1]))
else:
paths = (os.sep.join(p.split(os.sep)[:-1]) for p in module_path)
sys.stdout.write(os.path.pathsep.join(paths))
sys.stdout.flush()
except AttributeError:
pass
except ImportError:
pass