fix: fix uv conflict

This commit is contained in:
Barrett Ruth 2025-11-28 23:45:17 -05:00
parent e12b39bda1
commit bbe04589b8
2 changed files with 14 additions and 3 deletions

View file

@ -29,6 +29,11 @@ local function run_scraper(platform, subcommand, args, opts)
local cmd = { 'uv', 'run', '--directory', plugin_path, '-m', 'scrapers.' .. platform, subcommand }
vim.list_extend(cmd, args)
local env = vim.fn.environ()
env.VIRTUAL_ENV = ''
env.PYTHONPATH = ''
env.CONDA_PREFIX = ''
if opts and opts.ndjson then
local uv = vim.loop
local stdout = uv.new_pipe(false)
@ -38,7 +43,7 @@ local function run_scraper(platform, subcommand, args, opts)
local handle
handle = uv.spawn(
cmd[1],
{ args = vim.list_slice(cmd, 2), stdio = { nil, stdout, stderr } },
{ args = vim.list_slice(cmd, 2), stdio = { nil, stdout, stderr }, env = env },
function(code, signal)
if buf ~= '' and opts.on_event then
local ok_tail, ev_tail = pcall(vim.json.decode, buf)
@ -97,7 +102,7 @@ local function run_scraper(platform, subcommand, args, opts)
return
end
local sysopts = { text = true, timeout = 30000 }
local sysopts = { text = true, timeout = 30000, env = env }
if opts and opts.sync then
local result = vim.system(cmd, sysopts):wait()
return syshandle(result)

View file

@ -100,7 +100,13 @@ function M.setup_python_env()
if vim.fn.isdirectory(venv_dir) == 0 then
logger.log('Setting up Python environment for scrapers...')
local result = vim.system({ 'uv', 'sync' }, { cwd = plugin_path, text = true }):wait()
local env = vim.fn.environ()
env.VIRTUAL_ENV = ''
env.PYTHONPATH = ''
env.CONDA_PREFIX = ''
local result = vim
.system({ 'uv', 'sync' }, { cwd = plugin_path, text = true, env = env })
:wait()
if result.code ~= 0 then
logger.log('Failed to setup Python environment: ' .. result.stderr, vim.log.levels.ERROR)
return false