Skip to content

Commit

Permalink
Removes path manipulation workaround. Please see yarnpkg/yarn#5874 fo…
Browse files Browse the repository at this point in the history
…r more
  • Loading branch information
akolson committed Oct 31, 2022
1 parent 1eae610 commit a1c5030
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions packages/kolibri-tools/lib/read_webpack_json.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ function readPythonPlugins({ pluginFile, plugins, pluginPath }) {
const webpack_json_tempfile = temp.openSync({ suffix: '.json' }).path;

// Extract the relevant information about the plugin configuration from the Python code.

// For reasons unknown, there is an extra /usr/bin injected into PATH while running
// execSync, which by-passes the virtualenv!

// Refs: https://github.com/yarnpkg/yarn/issues/5874
// See PR: https://github.com/learningequality/kolibri/pull/3777

// You can debug it like this:
// execSync("PATH=$(echo $PATH | sed 's/\\/usr\\/bin://g')\":/usr/bin\" which python >&2 && exit 1", {env: process.env});
// ..hence, we have manipulated the path in the shell command to remove Node's
// unwanted manipulation
let command = `python ${webpack_json} --output_file ${webpack_json_tempfile} `;
// The plugin file takes precedence here.
if (pluginFile) {
Expand All @@ -54,11 +43,7 @@ function readPythonPlugins({ pluginFile, plugins, pluginPath }) {
command += ` --plugin_path ${pluginPath}`;
}
}
if (process.platform !== 'win32') {
execSync(`PATH=$(echo $PATH | sed 's/\\/usr\\/bin://g')":/usr/bin" ${command}`);
} else {
execSync(command);
}
execSync(command);

const result = fs.readFileSync(webpack_json_tempfile);

Expand Down

0 comments on commit a1c5030

Please sign in to comment.