FreeCAD WebAssembly development snapshot
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled

This commit is contained in:
2026-08-20 07:00:53 +08:00
commit b5a086fda5
12718 changed files with 7841410 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import debugpy
from multiprocessing.connection import Listener
from freecad.utils import get_python_exe
# get_python_exe is needed because debugpy needs a python interpreter to work.
# It does not have to be FC embedded interpreter.
# By default it attempts to use Freecad's PID mistaking it for python.
# https://github.com/microsoft/debugpy/issues/262
debugpy.configure(python=get_python_exe())
# As of Python 3.12, debugpy runs a forwarding process that listens both on the port specified here for the debugger
# to connect to, but also on an internal port for the underlying pydevd within the python process to connect to. The
# default for that internal port is 5678, so we need to not duplicate it for the external port. Also, on Linux the
# attempt to spawn the forwarding process separately fails, so we force it to be internal to our main process.
debugpy.listen(('localhost', 5679),in_process_debug_adapter=True)
# Turns out you cannot probe debugpy to see if it is up:
# https://github.com/microsoft/debugpy/issues/974
# Open another port that the script WaitForDebugpy can probe to see if
# debugpy is running
listener = Listener(('localhost', 39999), backlog=10)
debugpy.wait_for_client()

View File

@@ -0,0 +1,29 @@
import socket
from contextlib import closing
import time
TIMEOUT_TIME_S = 30
RETRY_DELAY_S = 0.1
MAX_ATTEMPTS = TIMEOUT_TIME_S / RETRY_DELAY_S
def check_socket(host, port):
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
sock.settimeout(RETRY_DELAY_S)
return sock.connect_ex((host, port)) == 0
def main():
# DO NOT CHECK the actual port 5678/5879 or debugpy will break
# Check that the other port 39999 used as a flag is manually opened instead
attempt_counter = 0
while (not check_socket('localhost', 39999)) and attempt_counter < MAX_ATTEMPTS:
time.sleep(RETRY_DELAY_S)
attempt_counter += 1
if attempt_counter >= MAX_ATTEMPTS:
exit(1)
else:
exit(0)
if __name__ == "__main__":
main()