Skip to content

Commit 6a2563b

Browse files
committed
Invoke post-install hook post-build via build.py; locate node_modules in pminit
1 parent 307d927 commit 6a2563b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# @file build.py
2+
# Main PythonMonkey build automation script. Run with `poetry build`.
3+
# @author Hamada Gasmallah, [email protected]
4+
# @date April 2023
5+
#
16
import subprocess
27
import os, sys
38
import platform
@@ -52,6 +57,8 @@ def build():
5257
ensure_spidermonkey()
5358
run_cmake_build()
5459
copy_artifacts()
60+
os.chdir(TOP_DIR + "/python/pminit")
61+
execute(sys.executable + " ./post-install-hook.py")
5562

5663
if __name__ == "__main__":
5764
build()

python/pythonmonkey/require.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from importlib import util
3131

3232
from . import pythonmonkey as pm
33+
node_modules = os.path.abspath(os.path.dirname(__file__) + "/../pminit/pythonmonkey/node_modules")
3334

3435
# Add some python functions to the global python object for code in this file to use.
3536
globalThis = pm.eval("globalThis;")
@@ -190,7 +191,7 @@ def readFileSync(filename, charset) -> str:
190191
# require and exports symbols injected from the bootstrap object above. Current PythonMonkey bugs
191192
# prevent us from injecting names properly so they are stolen from trail left behind in the global
192193
# scope until that can be fixed.
193-
with open(os.path.dirname(__file__) + "/node_modules/ctx-module/ctx-module.js", "r") as ctxModuleSource:
194+
with open(node_modules + "/ctx-module/ctx-module.js", "r") as ctxModuleSource:
194195
initCtxModule = pm.eval("""'use strict';
195196
(function moduleWrapper_forCtxModule(broken_require, broken_exports)
196197
{

0 commit comments

Comments
 (0)