port(2P step 2): ScriptLib/PythonLauncher on the embedded interpreter
Link mtpython into port_logic and copy 40250's ScriptLib launcher across: PythonLauncher, PythonUtils and PythonMarshal, plus the 12 forwarding headers that make its `#include <Python-2.7/*>` lines compile unchanged. symtable.h forward-declares mod_ty rather than including Python-ast.h, whose one-word macros (Delete, Module, Set, Print) collide with EterLib/Pool.h — the same clash 40250 sidestepped by commenting out PySymtable_Build. Two `// PORT:` edits: `unsigned char(val)` is an MSVC extension (PythonUtils.cpp, twice), and PyObject_AsCharBuffer wants a Py_ssize_t* (TraceFunc). port_python_launcher_test drives the launcher in the order UserInterface.cpp does (:241-434): Create(), __DEBUG__/__COMMAND_LINE__, TRUE/FALSE, a CRLF script through RunMemoryTextFile, a .pyc through RunCompiledFile, then RunFile reading system.py out of the real pack. It stops at `ImportError: No module named app`, i.e. the first C++ module RunMainScript registers — that is the 2V0 slice, and the stdlib behind it is step 3. The host flags (Py_NoSiteFlag and friends) sit in the test for now; step 3 moves them into the platform layer. port-map statuses are set only for what the test actually executes: 10 of 12 launcher functions and 4 of 11 marshal ones (the small-.pyc path delegates to CPython's own reader, so the ported r_object stays unreached). PythonUtils compiles but nothing calls it until the binding modules arrive, so it stays TODO. Windows has no mtpython yet, so port_logic drops ScriptLib and the shims there. Tests: macOS ctest 27/27 incl. port.python_launcher; port_logic (with ScriptLib) also compiles for android arm64 (NDK API 24) and ios arm64. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/compile.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
#include <compile.h>
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/errcode.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
#include <errcode.h>
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/eval.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
#include <eval.h>
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/frameobject.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
#include <frameobject.h>
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/grammar.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
#include <grammar.h>
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/longintrepr.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
#include <longintrepr.h>
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/marshal.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
#include <marshal.h>
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/node.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
#include <node.h>
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/parsetok.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
// parsetok.h names `node` and `grammar` without including their headers; 40250's StdAfx includes
|
||||
// node.h and grammar.h before it, in this order.
|
||||
#include <node.h>
|
||||
#include <grammar.h>
|
||||
#include <parsetok.h>
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/python.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>.
|
||||
#include <Python.h>
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/symtable.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
// CPython's Include/symtable.h is not self-contained: it names mod_ty, which only Python-ast.h
|
||||
// declares — and that header also defines one-word macros (Module, Delete, Set, Print, Num, ...)
|
||||
// that collide with 40250 identifiers such as CPool::Delete. 40250's own extern/include copy
|
||||
// comments the one declaration that needs mod_ty (PySymtable_Build) out; repeating Python-ast.h's
|
||||
// typedef keeps the upstream header intact and the macros out.
|
||||
struct _mod;
|
||||
typedef struct _mod *mod_ty;
|
||||
#include <symtable.h>
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
// Shim for 40250's <Python-2.7/token.h>: the client includes the CPython headers under a
|
||||
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
|
||||
// (extension/third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
|
||||
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
|
||||
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
|
||||
// alone under the port header gate.
|
||||
#include <Python.h>
|
||||
#include <token.h>
|
||||
Reference in New Issue
Block a user