Skip to content

Reverts Distributive-Network/PythonMonkey#129 #486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Read this if you want to build a local version.
- rust
- python3.8 or later with header files (python3-dev)
- spidermonkey latest from mozilla-central
- npm (nodejs)
- [Poetry](https://python-poetry.org/docs/#installation)
- [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning)

Expand Down
67 changes: 0 additions & 67 deletions python/pminit/pmpm.py

This file was deleted.

42 changes: 34 additions & 8 deletions python/pminit/post-install-hook.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@
import os
import pmpm
import subprocess
import sys
import shutil

WORK_DIR = os.path.join(
os.path.realpath(os.path.dirname(__file__)),
"pythonmonkey"
)
def execute(cmd: str):
popen = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.STDOUT,
shell = True, text = True )
for stdout_line in iter(popen.stdout.readline, ""):
sys.stdout.write(stdout_line)
sys.stdout.flush()

popen.stdout.close()
return_code = popen.wait()
if return_code:
raise subprocess.CalledProcessError(return_code, cmd)

def main():
pmpm.main(WORK_DIR) # cd pythonmonkey && npm i
node_package_manager = 'npm'
# check if npm is installed on the system
if (shutil.which(node_package_manager) is None):
print("""

PythonMonkey Build Error:


* It appears npm is not installed on this system.
* npm is required for PythonMonkey to build.
* Please install NPM and Node.js before installing PythonMonkey.
* Refer to the documentation for installing NPM and Node.js here: https://nodejs.org/en/download


""")
raise Exception("PythonMonkey build error: Unable to find npm on the system.")
else:
execute(f"cd pythonmonkey && {node_package_manager} i --no-package-lock") # do not update package-lock.json

if __name__ == "__main__":
main()
main()

1 change: 0 additions & 1 deletion python/pminit/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ documentation = "https://docs.pythonmonkey.io/"
repository = "https://github.com/Distributive-Network/PythonMonkey"

include = [
"pmpm.py",
# Install extra files into the pythonmonkey package
"pythonmonkey/package*.json",
{ path = "pythonmonkey/node_modules/**/*", format = "wheel" },
Expand Down
Loading