-
Notifications
You must be signed in to change notification settings - Fork 0
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
make start failing #9
Comments
it seems virtualenv failed to resolve python path again |
https://peps.python.org/pep-0405/#specification says:
but I saw virtualenv python binaries were symlinks.
Okay, it doesn't work well because pyvenv.cfg was created outside of non-packaged subdirectory. This doesn't meet above criteria. |
We had to fix up virtualenv created by Haiku's python. diff --git a/python/mach/mach/site.py b/python/mach/mach/site.py
index 7065f60020..47763d532d 100644
--- a/python/mach/mach/site.py
+++ b/python/mach/mach/site.py
@@ -1184,6 +1184,12 @@ def _create_venv_with_pthfile(
]
)
+ for dir in ("bin", "lib"):
+ src = os.path.join(virtualenv_root, "non-packaged", dir)
+ dst = os.path.join(virtualenv_root, dir)
+ shutil.rmtree(dst, ignore_errors=True)
+ os.symlink(src, dst, target_is_directory=True)
+
platlib_site_packages_dir = target_venv.resolve_sysconfig_packages_path("platlib")
pthfile_contents = "\n".join(pthfile_lines)
with open(os.path.join(platlib_site_packages_dir, PTH_FILENAME), "w") as f: now build proceeds
|
Worked around by running cargo through pty diff --git a/build/RunCbindgen.py b/build/RunCbindgen.py
index 4c5bc8ce6e..d506c9e61b 100644
--- a/build/RunCbindgen.py
+++ b/build/RunCbindgen.py
@@ -8,6 +8,7 @@ import mozpack.path as mozpath
import os
import six
import subprocess
+import pty
import pytoml
@@ -41,7 +42,12 @@ def _run_process(args):
def generate_metadata(output, cargo_config):
- stdout, returncode = _run_process(
+ # stdout, returncode = _run_process(
+ def read(fd):
+ data = os.read(fd, 1)
+ output.write(data)
+ return data
+ pty.spawn(
[
buildconfig.substs["CARGO"],
"metadata",
@@ -52,12 +58,13 @@ def generate_metadata(output, cargo_config):
"--manifest-path",
CARGO_TOML,
]
- )
+ # )
+ , read)
- if returncode != 0:
- return returncode
+ # if returncode != 0:
+ # return returncode
- output.write(stdout)
+ # output.write(stdout)
# This is not quite accurate, but cbindgen only cares about a subset of the
# data which, when changed, causes these files to change.
@@ -65,7 +72,12 @@ def generate_metadata(output, cargo_config):
def generate(output, metadata_path, cbindgen_crate_path, *in_tree_dependencies):
- stdout, returncode = _run_process(
+ # stdout, returncode = _run_process(
+ def read(fd):
+ data = os.read(fd, 1)
+ output.write(data)
+ return data
+ pty.spawn(
[
buildconfig.substs["CBINDGEN"],
buildconfig.topsrcdir,
@@ -77,12 +89,13 @@ def generate(output, metadata_path, cbindgen_crate_path, *in_tree_dependencies):
metadata_path,
"--cpp-compat",
]
- )
+ # )
+ , read)
- if returncode != 0:
- return returncode
+ # if returncode != 0:
+ # return returncode
- output.write(stdout)
+ # output.write(stdout)
deps = set()
deps.add(CARGO_LOCK) references: |
diff --git a/build/RunCbindgen.py b/build/RunCbindgen.py
index 4c5bc8ce6e..7130922811 100644
--- a/build/RunCbindgen.py
+++ b/build/RunCbindgen.py
@@ -4,10 +4,13 @@
from __future__ import print_function
import buildconfig
+import errno
import mozpack.path as mozpath
import os
+import select
import six
import subprocess
+import pty
import pytoml
@@ -29,18 +32,54 @@ def _run_process(args):
env["CARGO"] = str(buildconfig.substs["CARGO"])
env["RUSTC"] = str(buildconfig.substs["RUSTC"])
- p = subprocess.Popen(args, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-
- stdout, stderr = p.communicate()
- stdout = six.ensure_text(stdout)
- stderr = six.ensure_text(stderr)
+ #p = subprocess.Popen(args, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ #stdout, stderr = p.communicate()
+ #stdout = six.ensure_text(stdout)
+ #stderr = six.ensure_text(stderr)
+ mo, so = pty.openpty()
+ me, se = pty.openpty()
+ p = subprocess.Popen(args, env=env, stdout=so, stderr=se, close_fds=True)
+ for fd in [so, se]:
+ os.close(fd)
+
+ timeout = 0.04 # seconds
+ readable = [mo, me]
+ result = {mo: b'', me: b''}
+ try:
+ try:
+ while readable:
+ ready, _, _ = select.select(readable, [], [], timeout)
+ for fd in ready:
+ try:
+ data = os.read(fd, 512)
+ except OSError as e:
+ if e.errno != errno.EIO:
+ raise
+ # EIO means EOF on some systems
+ readable.remove(fd)
+ else:
+ if not data: # EOF
+ readable.remove(fd)
+ result[fd] += data
+ finally:
+ for fd in [mo, me]:
+ os.close(fd)
+ if p.poll() is None:
+ p.kill()
+ p.wait()
+
+ stdout = six.ensure_text(result[mo])
+ stderr = six.ensure_text(result[me])
if p.returncode != 0:
print(stdout)
print(stderr)
return (stdout, p.returncode)
-
def generate_metadata(output, cargo_config):
+ #def read(fd):
+ # data = os.read(fd, 1024)
+ # output.write(data)
+ # return data
+ #pty.spawn(
stdout, returncode = _run_process(
[
buildconfig.substs["CARGO"],
@@ -53,6 +92,7 @@ def generate_metadata(output, cargo_config): |
work around is not required now with patched cargo.
|
we may missed some steps to build with old-configure
The text was updated successfully, but these errors were encountered: