<commit_before>module("lunaci.tasks.dependencies", package.seeall)


-- Dependency resolving task.
local check_package_dependencies = function(package, target, manifest)
    local config = require "lunaci.config"
    local pl = require "pl.import_into"()
    local DependencySolver = require "rocksolver.DependencySolver"
    local const = require "rocksolver.constraints"

    -- Add target to manifest as a virtual package
    local manifest = pl.tablex.deepcopy(manifest)
    manifest.packages["lua"] = {[target.compatibility] = {}}

    local solver = DependencySolver(manifest, config.platform)
    local deps, err = solver:resolve_dependencies(tostring(package))

    if err then
        return config.STATUS_FAIL, "Error resolving dependencies for package " .. tostring(package) .. ":\n" .. err, false
    end

    local has_deps = false
    local out = "Resolved dependencies for package " .. tostring(package) .. ": "
    for _, dep in pairs(deps) do
        -- Do not print self as a dependency
        if dep ~= package then
            out = out .. "\n- " .. tostring(dep)
            has_deps = true
        end
    end

    if not has_deps then
        out = out .. "None"<commit_msg>Tasks: add argument "deploy_dir"<commit_after>module("lunaci.tasks.dependencies", package.seeall)


-- Dependency resolving task.
local check_package_dependencies = function(package, target, deploy_dir, manifest)
    local config = require "lunaci.config"
    local pl = require "pl.import_into"()
    local DependencySolver = require "rocksolver.DependencySolver"
    local const = require "rocksolver.constraints"

    -- Add target to manifest as a virtual package
    local manifest = pl.tablex.deepcopy(manifest)
    manifest.packages["lua"] = {[target.compatibility] = {}}

    local solver = DependencySolver(manifest, config.platform)
    local deps, err = solver:resolve_dependencies(tostring(package))

    if err then
        return config.STATUS_FAIL, "Error resolving dependencies for package " .. tostring(package) .. ":\n" .. err, false
    end

    local has_deps = false
    local out = "Resolved dependencies for package " .. tostring(package) .. ": "
    for _, dep in pairs(deps) do
        -- Do not print self as a dependency
        if dep ~= package then
            out = out .. "\n- " .. tostring(dep)
            has_deps = true
        end
    end

    if not has_deps then
        out = out .. "None"
{'fraction_non_alphanumeric': 0.103831891223733, 'fraction_numerical': 0.0, 'mean_word_length': 2.8848, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3076620', 'n_tokens_mistral': 716, 'n_tokens_neox': 680, 'n_words': 209}