Skip to content

Commit 2daad79

Browse files
authored
Merge pull request #141 from kichik/docker_windows_paths
Fix paths for Docker on Windows
2 parents ee990d7 + ac4a047 commit 2daad79

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lib/pip.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ function installRequirements(requirementsPath, targetFolder, serverless, service
3434
let cmdOptions;
3535
let pipCmd = [
3636
options.pythonBin, '-m', 'pip', '--isolated', 'install',
37-
'-t', targetRequirementsFolder, '-r', dotSlsReqs,
37+
'-t', dockerPathForWin(options, targetRequirementsFolder),
38+
'-r', dockerPathForWin(options, dotSlsReqs),
3839
...options.pipCmdExtraArgs,
3940
];
4041
if (!options.dockerizePip) {
@@ -117,7 +118,19 @@ function installRequirements(requirementsPath, targetFolder, serverless, service
117118
};
118119

119120
/**
120-
* create a filtered requirements.txt without anything from noDeploy
121+
* convert path from Windows style to Linux style, if needed
122+
* @param {Object} options
123+
* @param {string} path
124+
* @return {string}
125+
*/
126+
function dockerPathForWin(options, path) {
127+
if (process.platform === 'win32' && options.dockerizePip) {
128+
return path.replace('\\', '/');
129+
}
130+
return path;
131+
}
132+
133+
/** create a filtered requirements.txt without anything from noDeploy
121134
* @param {string} source requirements
122135
* @param {string} target requirements where results are written
123136
* @param {Object} options

0 commit comments

Comments
 (0)