Merge "Accounts for Ubuntu paths on pip installation"

This commit is contained in:
Zuul 2019-08-27 03:17:54 +00:00 committed by Gerrit Code Review
commit 62e378b606
1 changed files with 5 additions and 2 deletions

View File

@ -17,7 +17,10 @@ import sys
LOCATIONS = [ LOCATIONS = [
'.', os.path.abspath('.'),
# This accounts for pip installations on Ubuntu that go into /usr/local
os.path.abspath(os.path.basename(sys.argv[0])),
# This accounts for system-wide installations to /usr
os.path.join(sys.prefix, 'share', 'ironic-python-agent-builder'), os.path.join(sys.prefix, 'share', 'ironic-python-agent-builder'),
] ]
@ -29,7 +32,7 @@ def find_elements_path():
return final return final
sys.exit('ironic-python-agent-ramdisk element has not been found in any ' sys.exit('ironic-python-agent-ramdisk element has not been found in any '
'of the following locations: %s' % ', '.join(LOCATIONS)) 'of the following locations: %s' % ', '.join(set(LOCATIONS)))
def main(): def main():