fix: always run uv sync to recover from partial installs
Problem: setup_python_env() skips uv sync when .venv/ exists. If a previous sync was interrupted (e.g. network timeout), the directory exists but is broken, and every subsequent session silently uses a corrupt environment. Solution: remove the isdirectory guard and always run uv sync. It is idempotent and near-instant when dependencies are already installed, so the only cost is one subprocess call per session.
This commit is contained in:
parent
06f72bbe2b
commit
976838d981
1 changed files with 10 additions and 15 deletions
|
|
@ -175,10 +175,7 @@ function M.setup_python_env()
|
||||||
|
|
||||||
if vim.fn.executable('uv') == 1 then
|
if vim.fn.executable('uv') == 1 then
|
||||||
local plugin_path = M.get_plugin_path()
|
local plugin_path = M.get_plugin_path()
|
||||||
local venv_dir = plugin_path .. '/.venv'
|
|
||||||
|
|
||||||
if vim.fn.isdirectory(venv_dir) == 0 then
|
|
||||||
logger.log('Setting up Python environment for scrapers...')
|
|
||||||
local env = vim.fn.environ()
|
local env = vim.fn.environ()
|
||||||
env.VIRTUAL_ENV = ''
|
env.VIRTUAL_ENV = ''
|
||||||
env.PYTHONPATH = ''
|
env.PYTHONPATH = ''
|
||||||
|
|
@ -190,8 +187,6 @@ function M.setup_python_env()
|
||||||
logger.log('Failed to setup Python environment: ' .. result.stderr, vim.log.levels.ERROR)
|
logger.log('Failed to setup Python environment: ' .. result.stderr, vim.log.levels.ERROR)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
logger.log('Python environment setup complete.')
|
|
||||||
end
|
|
||||||
|
|
||||||
python_env_setup = true
|
python_env_setup = true
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue