Skip to content

Commit

Permalink
fix conda
Browse files Browse the repository at this point in the history
revert changes


fix


cng


fix python version
  • Loading branch information
PhilipVinc committed Jan 18, 2022
1 parent cf48508 commit 1b30c6f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
os:
- ubuntu-latest
architecture: [x64]
python-version: ['3.x']
python-version: ['3.9']
julia-version:
- '1.6'
- '1'
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ VersionParsing = "81def892-9a0e-5fdd-b105-ffc91e053289"

[compat]
Conda = "1"
VersionParsing = "1"
MacroTools = "0.4, 0.5"
VersionParsing = "1"
julia = "1.6"

[extras]
Expand Down
17 changes: 8 additions & 9 deletions PyPreferences.jl/src/core.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ..PyPreferences: PyPreferences
using .PythonUtils: find_libpython, python_version_of, pythonhome_of
using .PythonUtils: find_libpython, python_version_of, pythonhome_of, conda_python_fullpath

using Preferences: @set_preferences!, @load_preference, @delete_preferences!

Expand All @@ -23,7 +23,7 @@ function set(prefs::PythonPreferences)
if prefs.python === nothing
@delete_preferences!("python")
else
@set_preferences!("python" => get_python_fullpath(prefs.python))
@set_preferences!("python" => prefs.python)
end
if prefs.inprocess
@set_preferences!("inprocess" => prefs.inprocess)
Expand Down Expand Up @@ -53,13 +53,12 @@ function _load_python_preferences()
#isempty(rawprefs) && return nothing

# default value
if !_inprocess && !_conda && _python === nothing
_python = get_python_fullpath(get_default_python())
@info "Setting default Python interpreter to $(_python)"
return set(python=_python)
else
return PythonPreferences(_python, _inprocess, _conda)
end
# if !_inprocess && !_conda && _python === nothing
# _python = get_python_fullpath(get_default_python())
# @info "Setting default Python interpreter to $(_python)"
# return set(python=_python)
# end
return PythonPreferences(_python, _inprocess, _conda)
end

function load_pypreferences_code()
Expand Down
3 changes: 3 additions & 0 deletions PyPreferences.jl/src/python_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ using Libdl: Libdl
using VersionParsing: vparse
using Conda: Conda

conda_python_fullpath() =
abspath(Conda.PYTHONDIR, "python" * (Sys.iswindows() ? ".exe" : ""))

# Fix the environment for running `python`, and setts IO encoding to UTF-8.
# If cmd is the Conda python, then additionally removes all PYTHON* and
# CONDA* environment variables.
Expand Down
2 changes: 1 addition & 1 deletion src/pyinit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function python_cmd(args::Cmd = ``;
end

function find_libpython(python::AbstractString)
script = joinpath(@__DIR__, "..", "deps", "find_libpython.py")
script = joinpath(@__DIR__, "..", "PyPreferences.jl", "src", "find_libpython.py")
cmd = python_cmd(`$script`; python = python)
try
return read(cmd, String)
Expand Down

0 comments on commit 1b30c6f

Please sign in to comment.