forked from renovatebot/renovate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(manager/pip-compile): Move functionality to common module (r…
- Loading branch information
Showing
2 changed files
with
45 additions
and
42 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,38 @@ | ||
import is from '@sindresorhus/is'; | ||
import { logger } from '../../../logger'; | ||
import { regEx } from '../../../util/regex'; | ||
import type { UpdateArtifactsConfig } from '../types'; | ||
|
||
export function getPythonConstraint( | ||
config: UpdateArtifactsConfig, | ||
): string | undefined | null { | ||
const { constraints = {} } = config; | ||
const { python } = constraints; | ||
|
||
if (python) { | ||
logger.debug('Using python constraint from config'); | ||
return python; | ||
} | ||
|
||
return undefined; | ||
} | ||
export function getPipToolsConstraint(config: UpdateArtifactsConfig): string { | ||
const { constraints = {} } = config; | ||
const { pipTools } = constraints; | ||
|
||
if (is.string(pipTools)) { | ||
logger.debug('Using pipTools constraint from config'); | ||
return pipTools; | ||
} | ||
|
||
return ''; | ||
} | ||
export const constraintLineRegex = regEx( | ||
/^(#.*?\r?\n)+# {4}pip-compile(?<arguments>.*?)\r?\n/, | ||
); | ||
export const allowedPipArguments = [ | ||
'--allow-unsafe', | ||
'--generate-hashes', | ||
'--no-emit-index-url', | ||
'--strip-extras', | ||
]; |