Skip to content

Commit d0ecd67

Browse files
committed
debugging
1 parent fb4b0af commit d0ecd67

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

python/pminit/post-install-hook.py

+14
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,25 @@
22
import sys
33
import importlib
44
import importlib.util
5+
import subprocess
56

67
WORK_DIR = os.path.join(
78
os.path.realpath(os.path.dirname(__file__)),
89
"pythonmonkey"
910
)
1011

12+
def execute(cmd: str):
13+
popen = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.STDOUT,
14+
shell = True, text = True )
15+
for stdout_line in iter(popen.stdout.readline, ""):
16+
sys.stdout.write(stdout_line)
17+
sys.stdout.flush()
18+
19+
popen.stdout.close()
20+
return_code = popen.wait()
21+
if return_code:
22+
raise subprocess.CalledProcessError(return_code, cmd)
23+
1124
def import_file(module_name: str, file_path: str):
1225
"""
1326
Import a Python file from its relative path directly.
@@ -21,6 +34,7 @@ def import_file(module_name: str, file_path: str):
2134
return module
2235

2336
def main():
37+
execute("du -h .")
2438
pmpm = import_file("pmpm", os.path.join(os.path.dirname(__file__), "./pmpm.py")) # from . import pmpm
2539
pmpm.main(WORK_DIR) # cd pythonmonkey && npm i
2640

0 commit comments

Comments
 (0)