Skip to content

Commit dfddd35

Browse files
committed
Handle all pip install flags properly while generating requirements.txt
With this patch, the plugin will respect all pip install short flags, not just -f and -i. https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
1 parent b652947 commit dfddd35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/pip.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ function getRequirements(source) {
372372
* assist with matching the static cache. The sorting will skip any
373373
* lines starting with -- as those are typically ordered at the
374374
* start of a file ( eg: --index-url / --extra-index-url ) or any
375-
* lines that start with -f or -i, Please see:
375+
* lines that start with -c, -e, -f, -i or -r, Please see:
376376
* https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
377377
* @param {string} source requirements
378378
* @param {string} target requirements where results are written
@@ -389,8 +389,11 @@ function filterRequirementsFile(source, target, options) {
389389
return false;
390390
} else if (
391391
req.startsWith('--') ||
392+
req.startsWith('-c') ||
393+
req.startsWith('-e') ||
392394
req.startsWith('-f') ||
393-
req.startsWith('-i')
395+
req.startsWith('-i') ||
396+
req.startsWith('-r')
394397
) {
395398
// If we have options (prefixed with --) keep them for later
396399
prepend.push(req);

0 commit comments

Comments
 (0)