Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python): pyenv manager #10128

Merged
merged 5 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 34 additions & 0 deletions lib/manager/pyenv/__snapshots__/extract.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`manager/pyenv/extract extractPackageFile() returns a result 1`] = `
Array [
Object {
"currentValue": "3.7.1",
"datasource": "docker",
"depName": "python",
"lookupName": "python",
},
]
`;

exports[`manager/pyenv/extract extractPackageFile() skips non ranges 1`] = `
Array [
Object {
"currentValue": "latestn",
"datasource": "docker",
"depName": "python",
"lookupName": "python",
},
]
`;

exports[`manager/pyenv/extract extractPackageFile() supports ranges 1`] = `
Array [
Object {
"currentValue": "3.8",
"datasource": "docker",
"depName": "python",
"lookupName": "python",
},
]
`;
19 changes: 19 additions & 0 deletions lib/manager/pyenv/extract.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { getName } from '../../../test/util';
import { extractPackageFile } from './extract';

describe(getName(), () => {
describe('extractPackageFile()', () => {
it('returns a result', () => {
const res = extractPackageFile('3.7.1\n');
expect(res.deps).toMatchSnapshot();
});
it('supports ranges', () => {
const res = extractPackageFile('3.8\n');
expect(res.deps).toMatchSnapshot();
});
it('skips non ranges', () => {
const res = extractPackageFile('latestn');
expect(res.deps).toMatchSnapshot();
});
});
});
12 changes: 12 additions & 0 deletions lib/manager/pyenv/extract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as datasourceDocker from '../../datasource/docker';
import type { PackageDependency, PackageFile } from '../types';

export function extractPackageFile(content: string): PackageFile {
const dep: PackageDependency = {
depName: 'python',
currentValue: content.trim(),
datasource: datasourceDocker.id,
rarkins marked this conversation as resolved.
Show resolved Hide resolved
lookupName: 'python',
caiofbpa marked this conversation as resolved.
Show resolved Hide resolved
};
return { deps: [dep] };
}
11 changes: 11 additions & 0 deletions lib/manager/pyenv/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { LANGUAGE_PYTHON } from '../../constants/languages';
import * as dockerVersioning from '../../versioning/docker';

export { extractPackageFile } from './extract';

export const language = LANGUAGE_PYTHON;

export const defaultConfig = {
fileMatch: ['(^|/).python-version$'],
versioning: dockerVersioning.id,
};
1 change: 1 addition & 0 deletions lib/manager/pyenv/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Simply keeps the `.python-version` file updated.