mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
WIP
This commit is contained in:
parent
fa4c46c23d
commit
f400c5576a
12 changed files with 59 additions and 213 deletions
22
packages/safe-chain/bin/aikido-python.js
Normal file
22
packages/safe-chain/bin/aikido-python.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
|
||||
import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js";
|
||||
import { setEcoSystem, ECOSYSTEM_PY } from "../src/config/settings.js";
|
||||
import { main } from "../src/main.js";
|
||||
|
||||
const argv = process.argv.slice(2);
|
||||
|
||||
const supportedArgs = ["pip", "pip3"];
|
||||
|
||||
if (argv[0] === "-m" && argv[1] && supportedArgs.includes(argv[1])) {
|
||||
setEcoSystem(ECOSYSTEM_PY);
|
||||
|
||||
initializePackageManager(argv[1]);
|
||||
var exitCode = await main(argv.slice(2));
|
||||
process.exit(exitCode);
|
||||
} else {
|
||||
// Fallback: run the real python
|
||||
const { spawn } = await import("child_process");
|
||||
spawn("python", argv, { stdio: "inherit" });
|
||||
}
|
||||
22
packages/safe-chain/bin/aikido-python3.js
Normal file
22
packages/safe-chain/bin/aikido-python3.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
|
||||
import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js";
|
||||
import { setEcoSystem, ECOSYSTEM_PY } from "../src/config/settings.js";
|
||||
import { main } from "../src/main.js";
|
||||
|
||||
const argv = process.argv.slice(2);
|
||||
|
||||
const supportedArgs = ["pip", "pip3"];
|
||||
|
||||
if (argv[0] === "-m" && argv[1] && supportedArgs.includes(argv[1])) {
|
||||
setEcoSystem(ECOSYSTEM_PY);
|
||||
// python3 -m pip or python3 -m pip3: always use pip3 package manager
|
||||
initializePackageManager("pip3");
|
||||
var exitCode = await main(argv.slice(2));
|
||||
process.exit(exitCode);
|
||||
} else {
|
||||
// Fallback: run the real python3
|
||||
const { spawn } = await import("child_process");
|
||||
spawn("python3", argv, { stdio: "inherit" });
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue