Compare commits
No commits in common. "main" and "0.1.0" have entirely different histories.
22
itame.py
22
itame.py
@ -4,26 +4,20 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def eprint(*args, **kwargs):
|
|
||||||
print(*args, file=sys.stderr, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["bun", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
|
["bun", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
|
||||||
)
|
)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
eprint("bun not found, please run the following command to install it:")
|
print("bun not found, please run the following command to install it:")
|
||||||
eprint('powershell -c "irm bun.sh/install.ps1|iex"')
|
print('powershell -c "irm bun.sh/install.ps1|iex"')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
file_dir = Path(__file__).parent
|
file_dir = Path(__file__).parent
|
||||||
itame_vendor_dir = file_dir / "itame"
|
itame_vendor_dir = file_dir / "itame"
|
||||||
|
|
||||||
if not itame_vendor_dir.exists():
|
if not itame_vendor_dir.exists():
|
||||||
eprint(
|
print("script must be placed in the parent directory of the vendor itame directory")
|
||||||
"script must be placed in the parent directory of the vendor itame directory"
|
|
||||||
)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
node_modules_dir = itame_vendor_dir / "node_modules"
|
node_modules_dir = itame_vendor_dir / "node_modules"
|
||||||
@ -33,15 +27,11 @@ if not node_modules_dir.exists():
|
|||||||
old_dir = os.getcwd()
|
old_dir = os.getcwd()
|
||||||
os.chdir(itame_vendor_dir)
|
os.chdir(itame_vendor_dir)
|
||||||
|
|
||||||
eprint("installing dependencies")
|
p = subprocess.run(["bun", "i"])
|
||||||
p = subprocess.run(["bun", "i"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
eprint("failed to install dependencies")
|
print("failed to install node modules")
|
||||||
eprint(p.stderr.decode("utf-8"))
|
|
||||||
eprint(p.stdout.decode("utf-8"))
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
os.chdir(old_dir)
|
os.chdir(old_dir)
|
||||||
eprint()
|
|
||||||
|
|
||||||
exit(subprocess.run(["bun", "run", str(entrypoint)] + sys.argv[1:]).returncode)
|
subprocess.run(["bun", "run", str(entrypoint)] + sys.argv[1:])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user