src/ansible_gentooimgr/

This commit is contained in:
emdee 2023-12-30 12:56:08 +00:00
parent d477ae2217
commit 8803297109
2 changed files with 22 additions and 7 deletions

View file

@ -10,11 +10,18 @@ from argparse import Namespace
import pathlib
import traceback
sys.path.append('/mnt/o/var/local/src/play_tox/src/ansible_gentooimgr')
# in the library
if os.environ.get('TESTF_ANSIBLE_SRC',''):
if os.environ.get('PLAY_ANSIBLE_SRC',''):
# running from source
mod_path = os.environ.get('TESTF_ANSIBLE_SRC','')
mod_path = os.environ.get('PLAY_ANSIBLE_SRC','')
mod_path = os.path.join(mod_path, 'src', 'ansible_gentooimgr')
assert os.path.isdir(mod_path), f"parent {mod_path}"
assert os.path.isfile(os.path.join(mod_path, '__init__.py')),f"index {mod_path}"
assert os.path.isdir(os.path.join(mod_path, 'gentooimgr')), f"sub {mod_path}"
sys.path.append(mod_path)
else:
# in the library
mod_path = os.path.dirname(os.path.realpath('__file__'))
mod_path = os.path.join(mod_path, 'src', 'ansible_gentooimgr')
assert os.path.isdir(mod_path), f"parent {mod_path}"
assert os.path.isfile(os.path.join(mod_path, '__init__.py')),f"index {mod_path}"
@ -23,7 +30,7 @@ if os.environ.get('TESTF_ANSIBLE_SRC',''):
try:
import gentooimgr
except Exception as e:
sys.stderr.write(f"{e} {sys.path} {traceback.print_exc()}")
sys.stderr.write(f"{mod_path} {sys.path} {traceback.print_exc()}")
raise
import ansible