mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
feat(manager): enable pipenv lockfile maintance (#6096)
This commit is contained in:
parent
317a41a43e
commit
84b7eede50
4 changed files with 46 additions and 1 deletions
|
@ -57,6 +57,29 @@ Array [
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`.updateArtifacts() returns updated Pipenv.lock when doing lockfile maintenance 1`] = `
|
||||||
|
Array [
|
||||||
|
Object {
|
||||||
|
"cmd": "pipenv lock",
|
||||||
|
"options": Object {
|
||||||
|
"cwd": "/tmp/github/some/repo",
|
||||||
|
"encoding": "utf-8",
|
||||||
|
"env": Object {
|
||||||
|
"HOME": "/home/user",
|
||||||
|
"HTTPS_PROXY": "https://example.com",
|
||||||
|
"HTTP_PROXY": "http://example.com",
|
||||||
|
"LANG": "en_US.UTF-8",
|
||||||
|
"LC_ALL": "en_US",
|
||||||
|
"NO_PROXY": "localhost",
|
||||||
|
"PATH": "/tmp/path",
|
||||||
|
"PIPENV_CACHE_DIR": "/tmp/renovate/cache/others/pipenv",
|
||||||
|
},
|
||||||
|
"timeout": 900000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`.updateArtifacts() returns updated Pipfile.lock 1`] = `
|
exports[`.updateArtifacts() returns updated Pipfile.lock 1`] = `
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
|
|
|
@ -34,6 +34,7 @@ const config = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const dockerConfig = { ...config, binarySource: BinarySource.Docker };
|
const dockerConfig = { ...config, binarySource: BinarySource.Docker };
|
||||||
|
const lockMaintenceConfig = { ...config, isLockFileMaintenance: true };
|
||||||
|
|
||||||
describe('.updateArtifacts()', () => {
|
describe('.updateArtifacts()', () => {
|
||||||
let pipFileLock;
|
let pipFileLock;
|
||||||
|
@ -139,4 +140,21 @@ describe('.updateArtifacts()', () => {
|
||||||
})
|
})
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
it('returns updated Pipenv.lock when doing lockfile maintenance', async () => {
|
||||||
|
platform.getFile.mockResolvedValueOnce('Current Pipfile.lock');
|
||||||
|
const execSnapshots = mockExecAll(exec);
|
||||||
|
platform.getRepoStatus.mockResolvedValue({
|
||||||
|
modified: ['Pipfile.lock'],
|
||||||
|
} as StatusResult);
|
||||||
|
fs.readFile.mockReturnValueOnce('New Pipfile.lock' as any);
|
||||||
|
expect(
|
||||||
|
await pipenv.updateArtifacts({
|
||||||
|
packageFileName: 'Pipfile',
|
||||||
|
updatedDeps: [],
|
||||||
|
newPackageFileContent: '{}',
|
||||||
|
config: lockMaintenceConfig,
|
||||||
|
})
|
||||||
|
).not.toBeNull();
|
||||||
|
expect(execSnapshots).toMatchSnapshot();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ensureDir, outputFile, readFile } from 'fs-extra';
|
import { ensureDir, outputFile, readFile, remove } from 'fs-extra';
|
||||||
import { join } from 'upath';
|
import { join } from 'upath';
|
||||||
import { exec, ExecOptions } from '../../util/exec';
|
import { exec, ExecOptions } from '../../util/exec';
|
||||||
import { logger } from '../../logger';
|
import { logger } from '../../logger';
|
||||||
|
@ -56,6 +56,9 @@ export async function updateArtifacts({
|
||||||
const localPipfileFileName = join(config.localDir, pipfileName);
|
const localPipfileFileName = join(config.localDir, pipfileName);
|
||||||
await outputFile(localPipfileFileName, newPipfileContent);
|
await outputFile(localPipfileFileName, newPipfileContent);
|
||||||
const localLockFileName = join(config.localDir, lockFileName);
|
const localLockFileName = join(config.localDir, lockFileName);
|
||||||
|
if (config.isLockFileMaintenance) {
|
||||||
|
await remove(localLockFileName);
|
||||||
|
}
|
||||||
const cmd = 'pipenv lock';
|
const cmd = 'pipenv lock';
|
||||||
const tagConstraint = getPythonConstraint(existingLockFileContent, config);
|
const tagConstraint = getPythonConstraint(existingLockFileContent, config);
|
||||||
const execOptions: ExecOptions = {
|
const execOptions: ExecOptions = {
|
||||||
|
|
|
@ -4,6 +4,7 @@ export { extractPackageFile } from './extract';
|
||||||
export { updateArtifacts } from './artifacts';
|
export { updateArtifacts } from './artifacts';
|
||||||
|
|
||||||
export const language = LANGUAGE_PYTHON;
|
export const language = LANGUAGE_PYTHON;
|
||||||
|
export const supportsLockFileMaintenance = true;
|
||||||
|
|
||||||
export const defaultConfig = {
|
export const defaultConfig = {
|
||||||
fileMatch: ['(^|/)Pipfile$'],
|
fileMatch: ['(^|/)Pipfile$'],
|
||||||
|
|
Loading…
Reference in a new issue