Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(python): pyenv manager (#10128)
- Loading branch information
Showing
6 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 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", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`manager/pyenv/extract extractPackageFile() skips non ranges 1`] = ` | ||
Array [ | ||
Object { | ||
"currentValue": "latestn", | ||
"datasource": "docker", | ||
"depName": "python", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`manager/pyenv/extract extractPackageFile() supports ranges 1`] = ` | ||
Array [ | ||
Object { | ||
"currentValue": "3.8", | ||
"datasource": "docker", | ||
"depName": "python", | ||
}, | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
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, | ||
}; | ||
return { deps: [dep] }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Simply keeps the `.python-version` file updated. |