Search another path for etc/tempest
sys.prefix is gotten from the path which pyconfig.h is installed under.
Some envs contain it under /usr/include, not /user/local/include.
Then prefix becomes /usr on such envs.
However, etc/tempest is installed under /usr/local and the original
path logic mismatches.
This patch adds a workaround for such envs.
Closes-Bug: #1573873
Change-Id: I1ce3e639d77ab2d0e786fea5aaca574653e48673
diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py
index 6fb4e5b..d8d9d7c 100644
--- a/tempest/cmd/init.py
+++ b/tempest/cmd/init.py
@@ -66,7 +66,16 @@
# '[sys.prefix]/etc/tempest'
return global_conf_dir
else:
- return os.path.join(prefix, 'etc/tempest')
+ conf_dir = os.path.join(prefix, 'etc/tempest')
+ if os.path.isdir(conf_dir):
+ return conf_dir
+ else:
+ # NOTE: The prefix is gotten from the path which pyconfig.h is
+ # installed under. Some envs contain it under /usr/include, not
+ # /user/local/include. Then prefix becomes /usr on such envs.
+ # However, etc/tempest is installed under /usr/local and the bove
+ # path logic mismatches. This is a workaround for such envs.
+ return os.path.join(prefix, 'local/etc/tempest')
class TempestInit(command.Command):