Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ロードするモジュールのパスに環境変数を設定可能にする #256

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions OpenRTM_aist/ModuleManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,26 +272,29 @@ def load_prop(self, prop, init_func=None):
import_name = os.path.split(file_name)[-1]
pathChanged = False

if OpenRTM_aist.isAbsolutePath(file_name):
name = OpenRTM_aist.replaceEnv(file_name)
if OpenRTM_aist.isAbsolutePath(name):
if not self._absoluteAllowed:
raise ModuleManager.NotAllowedOperation(
"Absolute path is not allowed")
else:
splitted_name = os.path.split(file_name)
splitted_name = os.path.split(name)
save_path = sys.path[:]
sys.path.append(splitted_name[0])

pathChanged = True
import_name = splitted_name[-1]
file_path = file_name
file_path = name

elif not file_path:
paths = self._properties.getProperty(
else:
paths_lang = self._properties.getProperty(
"manager.modules.Python.load_paths").split(",")
paths.extend(self._properties.getProperty(
paths_lang.extend(self._properties.getProperty(
"manager.modules.Python3.load_paths").split(","))
paths.extend(self._loadPath)

paths_lang.extend(self._loadPath)
paths = []
for path in paths_lang:
paths.append(OpenRTM_aist.replaceEnv(path))
file_path = self.findFile(file_name, paths)

if not file_path:
Expand Down Expand Up @@ -583,6 +586,7 @@ def getModuleList(self, lang, modules):
continue
self._rtcout.RTC_DEBUG("Module load path: %s", path)
flist = []
path = OpenRTM_aist.replaceEnv(path)
for suffix in suffixes:
suffix = OpenRTM_aist.eraseHeadBlank(suffix)

Expand Down
Loading