mirror of
https://github.com/YosysHQ/sby.git
synced 2025-04-06 14:24:08 +00:00
Use local jobslots as fallback on Windows.
As we have no make jobserver support on windows, fallback to using process local slots to limit prallelism.
This commit is contained in:
parent
b0786aea43
commit
e91977e01e
|
@ -17,7 +17,6 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
import fcntl
|
|
||||||
import os
|
import os
|
||||||
import select
|
import select
|
||||||
import shlex
|
import shlex
|
||||||
|
@ -26,6 +25,8 @@ import sys
|
||||||
import weakref
|
import weakref
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
|
if os.name == "posix":
|
||||||
|
import fcntl
|
||||||
|
|
||||||
inherited_jobcount = None
|
inherited_jobcount = None
|
||||||
inherited_jobserver_auth = None
|
inherited_jobserver_auth = None
|
||||||
|
@ -56,15 +57,16 @@ def process_jobserver_environment():
|
||||||
pass
|
pass
|
||||||
elif flag.startswith("--jobserver-auth=") or flag.startswith("--jobserver-fds="):
|
elif flag.startswith("--jobserver-auth=") or flag.startswith("--jobserver-fds="):
|
||||||
inherited_jobserver_auth_present = True
|
inherited_jobserver_auth_present = True
|
||||||
arg = flag.split("=", 1)[1].split(",")
|
if os.name == "posix":
|
||||||
try:
|
arg = flag.split("=", 1)[1].split(",")
|
||||||
jobserver_fds = int(arg[0]), int(arg[1])
|
try:
|
||||||
for fd in jobserver_fds:
|
jobserver_fds = int(arg[0]), int(arg[1])
|
||||||
fcntl.fcntl(fd, fcntl.F_GETFD)
|
for fd in jobserver_fds:
|
||||||
except (ValueError, OSError):
|
fcntl.fcntl(fd, fcntl.F_GETFD)
|
||||||
pass
|
except (ValueError, OSError):
|
||||||
else:
|
pass
|
||||||
inherited_jobserver_auth = jobserver_fds
|
else:
|
||||||
|
inherited_jobserver_auth = jobserver_fds
|
||||||
|
|
||||||
|
|
||||||
def jobserver_helper(jobserver_read_fd, jobserver_write_fd, request_fd, response_fd):
|
def jobserver_helper(jobserver_read_fd, jobserver_write_fd, request_fd, response_fd):
|
||||||
|
@ -159,6 +161,12 @@ class SbyJobClient:
|
||||||
|
|
||||||
have_jobserver = inherited_jobserver_auth_present
|
have_jobserver = inherited_jobserver_auth_present
|
||||||
|
|
||||||
|
if os.name == "nt" and inherited_jobserver_auth_present:
|
||||||
|
# There are even more incompatible variants of the make jobserver on
|
||||||
|
# windows, none of them are supported for now.
|
||||||
|
print("WARNING: Found jobserver in MAKEFLAGS, this is not supported on windows.")
|
||||||
|
have_jobserver = False
|
||||||
|
|
||||||
if have_jobserver and inherited_jobserver_auth is None:
|
if have_jobserver and inherited_jobserver_auth is None:
|
||||||
print("WARNING: Could not connect to jobserver specified in MAKEFLAGS, disabling parallel execution.")
|
print("WARNING: Could not connect to jobserver specified in MAKEFLAGS, disabling parallel execution.")
|
||||||
have_jobserver = False
|
have_jobserver = False
|
||||||
|
@ -178,6 +186,9 @@ class SbyJobClient:
|
||||||
|
|
||||||
if have_jobserver:
|
if have_jobserver:
|
||||||
self.read_fd, self.write_fd = inherited_jobserver_auth
|
self.read_fd, self.write_fd = inherited_jobserver_auth
|
||||||
|
elif os.name == "nt":
|
||||||
|
# On Windows, without a jobserver, use only local slots
|
||||||
|
self.local_slots = jobcount
|
||||||
else:
|
else:
|
||||||
self.sby_jobserver = SbyJobServer(jobcount)
|
self.sby_jobserver = SbyJobServer(jobcount)
|
||||||
self.read_fd = self.sby_jobserver.read_fd
|
self.read_fd = self.sby_jobserver.read_fd
|
||||||
|
|
Loading…
Reference in a new issue