mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Refactor PyPI logic and cleanup
This commit is contained in:
parent
e7cf3488b7
commit
e211f531c5
11 changed files with 450 additions and 138 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js";
|
||||
import { setCurrentPipInvocation, PIP_INVOCATIONS, PIP_PACKAGE_MANAGER } from "../src/packagemanager/pip/pipSettings.js";
|
||||
import { PIP_PACKAGE_MANAGER, PYTHON_COMMAND } from "../src/packagemanager/pip/pipSettings.js";
|
||||
import { setEcoSystem, ECOSYSTEM_PY } from "../src/config/settings.js";
|
||||
import { main } from "../src/main.js";
|
||||
|
||||
|
|
@ -11,20 +11,9 @@ setEcoSystem(ECOSYSTEM_PY);
|
|||
// Strip nodejs and wrapper script from args
|
||||
let argv = process.argv.slice(2);
|
||||
|
||||
initializePackageManager(PIP_PACKAGE_MANAGER, { tool: PYTHON_COMMAND, args: argv });
|
||||
|
||||
(async () => {
|
||||
if (argv[0] === '-m' && (argv[1] === 'pip' || argv[1] === 'pip3')) {
|
||||
setEcoSystem(ECOSYSTEM_PY);
|
||||
setCurrentPipInvocation(argv[1] === 'pip3' ? PIP_INVOCATIONS.PY_PIP3 : PIP_INVOCATIONS.PY_PIP);
|
||||
initializePackageManager(PIP_PACKAGE_MANAGER);
|
||||
|
||||
// Strip off the '-m pip' or '-m pip3' from the args
|
||||
argv = argv.slice(2);
|
||||
|
||||
var exitCode = await main(argv);
|
||||
process.exit(exitCode);
|
||||
} else {
|
||||
// Forward to real python binary for non-pip flows
|
||||
const { spawn } = await import('child_process');
|
||||
spawn('python', argv, { stdio: 'inherit' });
|
||||
}
|
||||
var exitCode = await main(argv);
|
||||
process.exit(exitCode);
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue