From 1e73865feeba21f1c952ede7605b4e110cc47266 Mon Sep 17 00:00:00 2001 From: Farley Date: Fri, 28 Feb 2020 17:09:36 +1300 Subject: [PATCH 1/3] Initial commit --- lib/pip.js | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/lib/pip.js b/lib/pip.js index 14864794..d8f4f216 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -366,12 +366,10 @@ function getRequirements(source) { } /** create a filtered requirements.txt without anything from noDeploy - * then remove all comments and empty lines, and sort the list which - * assist with matching the static cache. The sorting will skip any - * lines starting with -- as those are typically ordered at the - * start of a file ( eg: --index-url / --extra-index-url ) or any - * lines that start with -f or -i, Please see: - * https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format + * then remove all comments and empty lines. NOTE: In contrast to how + * this function used to work, it no longer re-orders requirements.txt + * contents to preserve ordering-related issues. See: + * https://pip.pypa.io/en/stable/reference/pip_install/#installation-order * @param {string} source requirements * @param {string} target requirements where results are written * @param {Object} options @@ -379,32 +377,16 @@ function getRequirements(source) { function filterRequirementsFile(source, target, options) { const noDeploy = new Set(options.noDeploy || []); const requirements = getRequirements(source); - var prepend = []; const filteredRequirements = requirements.filter(req => { req = req.trim(); if (req.startsWith('#')) { // Skip comments return false; - } else if ( - req.startsWith('--') || - req.startsWith('-f') || - req.startsWith('-i') - ) { - // If we have options (prefixed with --) keep them for later - prepend.push(req); - return false; } else if (req === '') { return false; } return !noDeploy.has(req.split(/[=<> \t]/)[0].trim()); }); - filteredRequirements.sort(); // Sort remaining alphabetically - // Then prepend any options from above in the same order - for (let item of prepend.reverse()) { - if (item && item.length > 0) { - filteredRequirements.unshift(item); - } - } fse.writeFileSync(target, filteredRequirements.join('\n') + '\n'); } From 68fcf630f190761ba8b846d02b8d93e027216b67 Mon Sep 17 00:00:00 2001 From: Farley Date: Fri, 28 Feb 2020 19:23:05 +1300 Subject: [PATCH 2/3] fixing lint --- lib/pip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pip.js b/lib/pip.js index d8f4f216..5b349ef4 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -368,7 +368,7 @@ function getRequirements(source) { /** create a filtered requirements.txt without anything from noDeploy * then remove all comments and empty lines. NOTE: In contrast to how * this function used to work, it no longer re-orders requirements.txt - * contents to preserve ordering-related issues. See: + * contents to preserve ordering-related issues. See: * https://pip.pypa.io/en/stable/reference/pip_install/#installation-order * @param {string} source requirements * @param {string} target requirements where results are written From bfbfb66d67efd9389c8d9b07ed48ad0d142990f7 Mon Sep 17 00:00:00 2001 From: Farley Date: Sat, 29 Feb 2020 12:01:53 +1300 Subject: [PATCH 3/3] Bumping to re-run CI --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3196d8c8..5bf42433 100644 --- a/README.md +++ b/README.md @@ -553,3 +553,4 @@ package: - [@bweigel](https://github.com/bweigel) - adding the `slimPatternsAppendDefaults` option & fixing per-function packaging when some functions don't have requirements & Porting tests from bats to js! - [@squaresurf](https://github.com/squaresurf) - adding usePoetry option - [@david-mk-lawrence](https://github.com/david-mk-lawrence) - added Lambda Layer support +