Merge "Allow to get prefix of base python interpreter"

changes/26/683126/34
Zuul 3 years ago committed by Gerrit Code Review
commit 757e829d7e

@ -1,6 +1,25 @@
#!/usr/bin/env python
import argparse
import os
import sys
print(os.path.realpath(sys.prefix))
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--base",
action="store_true",
help="print Python base prefix")
args = parser.parse_args()
prefix = get_python_prefix(base=args.base)
sys.stdout.write(prefix + '\n')
def get_python_prefix(base=False):
prefix = base and getattr(sys, 'base_prefix', None) or sys.prefix
return os.path.realpath(prefix)
if __name__ == '__main__':
main()

Loading…
Cancel
Save