Skip to content

Commit

Permalink
ensure base directory is correctly chosen when determing best python
Browse files Browse the repository at this point in the history
  • Loading branch information
ctheune committed Jul 18, 2021
1 parent ec75f51 commit c40fb52
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/appenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ def ensure_minimal_python():
sys.exit(66)


def ensure_best_python():
def ensure_best_python(base):
os.chdir(base)

if "APPENV_BEST_PYTHON" in os.environ:
# Don't do this twice to avoid being surprised with
# accidental infinite loops.
Expand Down Expand Up @@ -473,7 +475,9 @@ def update_lockfile(self, args=None, remaining=None):


def main():
ensure_best_python()
base = os.path.dirname(__file__)

ensure_best_python(base)
# clear PYTHONPATH variable to get a defined environment
# XXX this is a bit of history. not sure whether its still needed. keeping
# it for good measure
Expand All @@ -482,7 +486,6 @@ def main():

# Determine whether we're being called as appenv or as an application name
application_name = os.path.splitext(os.path.basename(__file__))[0]
base = os.path.dirname(__file__)

appenv = AppEnv(base)
try:
Expand Down

0 comments on commit c40fb52

Please sign in to comment.