ci: scripts + format

This commit is contained in:
Barrett Ruth 2026-03-04 13:51:56 -05:00
parent f2e312f860
commit 8c8e49d75c
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
9 changed files with 1279 additions and 35 deletions

View file

@ -45,7 +45,12 @@ local function run_scraper(platform, subcommand, args, opts)
end
local plugin_path = utils.get_plugin_path()
local cmd = utils.get_python_cmd(platform, plugin_path)
local cmd
if subcommand == 'submit' then
cmd = utils.get_python_submit_cmd(platform, plugin_path)
else
cmd = utils.get_python_cmd(platform, plugin_path)
end
vim.list_extend(cmd, { subcommand })
vim.list_extend(cmd, args)
@ -62,6 +67,10 @@ local function run_scraper(platform, subcommand, args, opts)
end
end
if subcommand == 'submit' and utils.is_nix_build() then
env.UV_PROJECT_ENVIRONMENT = vim.fn.stdpath('cache') .. '/cp-nvim/submit-env'
end
if opts and opts.ndjson then
local uv = vim.uv
local stdout = uv.new_pipe(false)
@ -131,7 +140,12 @@ local function run_scraper(platform, subcommand, args, opts)
return
end
local sysopts = { text = true, timeout = 30000, env = env, cwd = plugin_path }
local sysopts = {
text = true,
timeout = (subcommand == 'submit') and 120000 or 30000,
env = env,
cwd = plugin_path,
}
if opts and opts.stdin then
sysopts.stdin = opts.stdin
end

View file

@ -3,6 +3,7 @@ local M = {}
local logger = require('cp.log')
local _nix_python = nil
local _nix_submit_cmd = nil
local _nix_discovered = false
local uname = vim.uv.os_uname()
@ -111,6 +112,16 @@ function M.get_python_cmd(module, plugin_path)
return { 'uv', 'run', '--directory', plugin_path, '-m', 'scrapers.' .. module }
end
---@param module string
---@param plugin_path string
---@return string[]
function M.get_python_submit_cmd(module, plugin_path)
if _nix_submit_cmd then
return { _nix_submit_cmd, 'run', '--directory', plugin_path, '-m', 'scrapers.' .. module }
end
return M.get_python_cmd(module, plugin_path)
end
local python_env_setup = false
---@return boolean