"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.allowedPipArguments = exports.constraintLineRegex = exports.getPipToolsConstraint = exports.getPythonConstraint = void 0;
const tslib_1 = require("tslib");
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
const logger_1 = require("../../../logger");
const regex_1 = require("../../../util/regex");
function getPythonConstraint(config) {
    const { constraints = {} } = config;
    const { python } = constraints;
    if (python) {
        logger_1.logger.debug('Using python constraint from config');
        return python;
    }
    return undefined;
}
exports.getPythonConstraint = getPythonConstraint;
function getPipToolsConstraint(config) {
    const { constraints = {} } = config;
    const { pipTools } = constraints;
    if (is_1.default.string(pipTools)) {
        logger_1.logger.debug('Using pipTools constraint from config');
        return pipTools;
    }
    return '';
}
exports.getPipToolsConstraint = getPipToolsConstraint;
exports.constraintLineRegex = (0, regex_1.regEx)(/^(#.*?\r?\n)+# {4}pip-compile(?<arguments>.*?)\r?\n/);
exports.allowedPipArguments = [
    '--allow-unsafe',
    '--generate-hashes',
    '--no-emit-index-url',
    '--strip-extras',
];
//# sourceMappingURL=common.js.map