Skip to content

Commit

Permalink
Merge pull request #151 from Darsstar/pyenv-win
Browse files Browse the repository at this point in the history
Correct path for pyenv-win.
  • Loading branch information
matteius committed Oct 6, 2023
2 parents e3db21c + d3dd1ce commit 19d973d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/pythonfinder/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import os
import platform
import sys
import re
import shutil
import sys


def is_type_checking():
Expand All @@ -19,7 +19,7 @@ def possibly_convert_to_windows_style_path(path):
if not isinstance(path, str):
path = str(path)
# Check if the path is in Unix-style (Git Bash)
if os.name != 'nt':
if os.name != "nt":
return path
if os.path.exists(path):
return path
Expand Down Expand Up @@ -72,19 +72,15 @@ def set_asdf_paths():
if os.path.isdir(os.path.join(python_versions, name)):
asdf_path = os.path.join(python_versions, name)
asdf_path = os.path.join(asdf_path, "bin")
os.environ['PATH'] = asdf_path + os.pathsep + os.environ['PATH']
os.environ["PATH"] = asdf_path + os.pathsep + os.environ["PATH"]
except FileNotFoundError:
pass


def set_pyenv_paths():
if PYENV_INSTALLED:
is_windows = False
if os.name == "nt":
python_versions = os.path.join(PYENV_ROOT, "pyenv-win", "versions")
is_windows = True
else:
python_versions = os.path.join(PYENV_ROOT, "versions")
python_versions = os.path.join(PYENV_ROOT, "versions")
is_windows = os.name == "nt"
try:
# Get a list of all files and directories in the given path
all_files_and_dirs = os.listdir(python_versions)
Expand All @@ -94,6 +90,6 @@ def set_pyenv_paths():
pyenv_path = os.path.join(python_versions, name)
if not is_windows:
pyenv_path = os.path.join(pyenv_path, "bin")
os.environ['PATH'] = pyenv_path + os.pathsep + os.environ['PATH']
os.environ["PATH"] = pyenv_path + os.pathsep + os.environ["PATH"]
except FileNotFoundError:
pass

0 comments on commit 19d973d

Please sign in to comment.