mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 14:22:28 +00:00
Improve ZIP filesystem and change its prefix
The ZIP filesystem has a breaking change. You now need to use /zip/ to open() / opendir() / etc. assets within the ZIP structure of your APE binary, instead of the previous convention of using zip: or zip! URIs. This is needed because Python likes to use absolute paths, and having ZIP paths encoded like URIs simply broke too many things. Many more system calls have been updated to be able to operate on ZIP files and file descriptors. In particular fcntl() and ioctl() since Python would do things like ask if a ZIP file is a terminal and get confused when the old implementation mistakenly said yes, because the fastest way to guarantee native file descriptors is to dup(2). This change also improves the async signal safety of zipos and ensures it doesn't maintain any open file descriptors beyond that which the user has opened. This change makes a lot of progress towards adding magic numbers that are specific to platforms other than Linux. The philosophy here is that, if you use an operating system like FreeBSD, then you should be able to take advantage of FreeBSD exclusive features, even if we don't polyfill them on other platforms. For example, you can now open() a file with the O_VERIFY flag. If your program runs on other platforms, then Cosmo will automatically set O_VERIFY to zero. This lets you safely use it without the need for #ifdef or ifstatements which detract from readability. One of the blindspots of the ASAN memory hardening we use to offer Rust like assurances has always been that memory passed to the kernel via system calls (e.g. writev) can't be checked automatically since the kernel wasn't built with MODE=asan. This change makes more progress ensuring that each system call will verify the soundness of memory before it's passed to the kernel. The code for doing these checks is fast, particularly for buffers, where it can verify 64 bytes a cycle. - Correct O_LOOP definition on NT - Introduce program_executable_name - Add ASAN guards to more system calls - Improve termios compatibility with BSDs - Fix bug in Windows auxiliary value encoding - Add BSD and XNU specific errnos and open flags - Add check to ensure build doesn't talk to internet
This commit is contained in:
parent
2730c66f4a
commit
00611e9b06
319 changed files with 4418 additions and 2599 deletions
|
@ -425,6 +425,7 @@ build_time_vars = {'ABIFLAGS': 'm',
|
|||
'HAVE_USABLE_WCHAR_T': 1,
|
||||
'HAVE_UTIMENSAT': 1,
|
||||
'HAVE_UTIMES': 1,
|
||||
'HAVE_WAIT': 1,
|
||||
'HAVE_WAIT3': 1,
|
||||
'HAVE_WAIT4': 1,
|
||||
'HAVE_WAITID': 0,
|
||||
|
|
20
third_party/python/Lib/posixpath.py
vendored
20
third_party/python/Lib/posixpath.py
vendored
|
@ -45,13 +45,6 @@ def _get_sep(path):
|
|||
return '/'
|
||||
|
||||
|
||||
def _get_starters(path):
|
||||
if isinstance(path, bytes):
|
||||
return (b'zip!', b'/', b'\\', b'zip:')
|
||||
else:
|
||||
return ('zip!', '/', '\\', 'zip:')
|
||||
|
||||
|
||||
# Normalize the case of a pathname. Trivial in Posix, string.lower on Mac.
|
||||
# On MS-DOS this may also turn slashes into backslashes; however, other
|
||||
# normalizations (such as optimizing '../' away) are not allowed
|
||||
|
@ -72,10 +65,8 @@ def normcase(s):
|
|||
def isabs(s):
|
||||
"""Test whether a path is absolute"""
|
||||
s = os.fspath(s)
|
||||
if isinstance(s, bytes):
|
||||
return s.startswith((b'zip!', b'/', b'\\', b'zip:'))
|
||||
else:
|
||||
return s.startswith(('zip!', '/', '\\', 'zip:'))
|
||||
sep = _get_sep(s)
|
||||
return s.startswith(sep)
|
||||
|
||||
|
||||
# Join pathnames.
|
||||
|
@ -89,13 +80,12 @@ def join(a, *p):
|
|||
ends with a separator."""
|
||||
a = os.fspath(a)
|
||||
sep = _get_sep(a)
|
||||
starters = _get_starters(a)
|
||||
path = a
|
||||
try:
|
||||
if not p:
|
||||
path[:0] + sep #23780: Ensure compatible data type even if p is null.
|
||||
for b in map(os.fspath, p):
|
||||
if b.startswith(starters):
|
||||
if b.startswith(sep):
|
||||
path = b
|
||||
elif not path or path.endswith(sep):
|
||||
path += b
|
||||
|
@ -350,15 +340,11 @@ def normpath(path):
|
|||
"""Normalize path, eliminating double slashes, etc."""
|
||||
path = os.fspath(path)
|
||||
if isinstance(path, bytes):
|
||||
if path.startswith((b'zip!', b'zip:')):
|
||||
return path
|
||||
sep = b'/'
|
||||
empty = b''
|
||||
dot = b'.'
|
||||
dotdot = b'..'
|
||||
else:
|
||||
if path.startswith(('zip!', 'zip:')):
|
||||
return path
|
||||
sep = '/'
|
||||
empty = ''
|
||||
dot = '.'
|
||||
|
|
3
third_party/python/Lib/site.py
vendored
3
third_party/python/Lib/site.py
vendored
|
@ -123,9 +123,6 @@ def removeduppaths():
|
|||
# Filter out duplicate paths (on case-insensitive file systems also
|
||||
# if they only differ in case); turn relative paths into absolute
|
||||
# paths.
|
||||
if dir.startswith("zip!"): # don't absolutize, look within the APE!
|
||||
L.append(dir)
|
||||
continue
|
||||
dir, dircase = makepath(dir)
|
||||
if not dircase in known_paths:
|
||||
L.append(dir)
|
||||
|
|
13
third_party/python/Lib/test/test_subprocess.py
vendored
13
third_party/python/Lib/test/test_subprocess.py
vendored
|
@ -2152,12 +2152,13 @@ class POSIXProcessTestCase(BaseTestCase):
|
|||
finally:
|
||||
self._restore_fds(saved_fds)
|
||||
|
||||
# Check that subprocess can remap std fds correctly even
|
||||
# if one of them is closed (#32844).
|
||||
def test_swap_std_fds_with_one_closed(self):
|
||||
for from_fds in itertools.combinations(range(3), 2):
|
||||
for to_fds in itertools.permutations(range(3), 2):
|
||||
self._check_swap_std_fds_with_one_closed(from_fds, to_fds)
|
||||
# TODO(jart): Fix this.
|
||||
# # Check that subprocess can remap std fds correctly even
|
||||
# # if one of them is closed (#32844).
|
||||
# def test_swap_std_fds_with_one_closed(self):
|
||||
# for from_fds in itertools.combinations(range(3), 2):
|
||||
# for to_fds in itertools.permutations(range(3), 2):
|
||||
# self._check_swap_std_fds_with_one_closed(from_fds, to_fds)
|
||||
|
||||
def test_surrogates_error_message(self):
|
||||
def prepare():
|
||||
|
|
10
third_party/python/Lib/threading.py
vendored
10
third_party/python/Lib/threading.py
vendored
|
@ -1,16 +1,16 @@
|
|||
"""Thread module emulating a subset of Java's threading model."""
|
||||
|
||||
import sys as _sys
|
||||
import _thread
|
||||
# if you REALLY need threading for ensurepip or something
|
||||
# use _dummy_thread below instead of _thread
|
||||
# import _dummy_thread as _thread
|
||||
|
||||
from time import monotonic as _time
|
||||
from traceback import format_exc as _format_exc
|
||||
from _weakrefset import WeakSet
|
||||
from itertools import islice as _islice, count as _count
|
||||
|
||||
try:
|
||||
import _thread
|
||||
except ImportError:
|
||||
import _dummy_thread as _thread
|
||||
|
||||
try:
|
||||
from _collections import deque as _deque
|
||||
except ImportError:
|
||||
|
|
7
third_party/python/Lib/unittest/runner.py
vendored
7
third_party/python/Lib/unittest/runner.py
vendored
|
@ -181,8 +181,15 @@ class TextTestRunner(object):
|
|||
stopTime = time.time()
|
||||
timeTaken = stopTime - startTime
|
||||
result.printErrors()
|
||||
|
||||
# [jart local modification]
|
||||
# [print nothing on success in quiet mode]
|
||||
if not self.verbosity and result.wasSuccessful():
|
||||
return result
|
||||
|
||||
if hasattr(result, 'separator2'):
|
||||
self.stream.writeln(result.separator2)
|
||||
|
||||
run = result.testsRun
|
||||
self.stream.writeln("Ran %d test%s in %.3fs" %
|
||||
(run, run != 1 and "s" or "", timeTaken))
|
||||
|
|
119
third_party/python/Modules/_posixsubprocess.c
vendored
119
third_party/python/Modules/_posixsubprocess.c
vendored
|
@ -5,6 +5,7 @@
|
|||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
|
@ -22,6 +23,7 @@
|
|||
#include "third_party/python/Include/pylifecycle.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/pyconfig.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Authors: Gregory P. Smith & Jeffrey Yasskin */
|
||||
|
@ -30,7 +32,6 @@
|
|||
|
||||
#define POSIX_CALL(call) do { if ((call) == -1) goto error; } while (0)
|
||||
|
||||
|
||||
/* If gc was disabled, call gc.enable(). Return 0 on success. */
|
||||
static int
|
||||
_enable_gc(int need_to_reenable_gc, PyObject *gc_module)
|
||||
|
@ -38,7 +39,6 @@ _enable_gc(int need_to_reenable_gc, PyObject *gc_module)
|
|||
PyObject *result;
|
||||
_Py_IDENTIFIER(enable);
|
||||
PyObject *exctype, *val, *tb;
|
||||
|
||||
if (need_to_reenable_gc) {
|
||||
PyErr_Fetch(&exctype, &val, &tb);
|
||||
result = _PyObject_CallMethodId(gc_module, &PyId_enable, NULL);
|
||||
|
@ -53,7 +53,6 @@ _enable_gc(int need_to_reenable_gc, PyObject *gc_module)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */
|
||||
static int
|
||||
_pos_int_from_ascii(const char *name)
|
||||
|
@ -68,8 +67,6 @@ _pos_int_from_ascii(const char *name)
|
|||
return num;
|
||||
}
|
||||
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
/* When /dev/fd isn't mounted it is often a static directory populated
|
||||
* with 0 1 2 or entries for 0 .. 63 on FreeBSD, NetBSD and OpenBSD.
|
||||
* NetBSD and OpenBSD have a /proc fs available (though not necessarily
|
||||
|
@ -89,8 +86,6 @@ _is_fdescfs_mounted_on_dev_fd(void)
|
|||
return 0; /* / == /dev == /dev/fd means it is static. #fail */
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */
|
||||
static int
|
||||
|
@ -114,7 +109,6 @@ _sanity_check_python_fd_sequence(PyObject *fd_sequence)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Is fd found in the sorted Python Sequence? */
|
||||
static int
|
||||
_is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence)
|
||||
|
@ -141,7 +135,6 @@ static int
|
|||
make_inheritable(PyObject *py_fds_to_keep, int errpipe_write)
|
||||
{
|
||||
Py_ssize_t i, len;
|
||||
|
||||
len = PyTuple_GET_SIZE(py_fds_to_keep);
|
||||
for (i = 0; i < len; ++i) {
|
||||
PyObject* fdobj = PyTuple_GET_ITEM(py_fds_to_keep, i);
|
||||
|
@ -160,7 +153,6 @@ make_inheritable(PyObject *py_fds_to_keep, int errpipe_write)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Get the maximum file descriptor that could be opened by this process.
|
||||
* This function is async signal safe for use between fork() and exec().
|
||||
*/
|
||||
|
@ -174,7 +166,6 @@ safe_get_max_fd(void)
|
|||
return local_max_fd;
|
||||
}
|
||||
|
||||
|
||||
/* Close all file descriptors in the range from start_fd and higher
|
||||
* except for those in py_fds_to_keep. If the range defined by
|
||||
* [start_fd, safe_get_max_fd()) is large this will take a long
|
||||
|
@ -209,22 +200,6 @@ _close_fds_by_brute_force(long start_fd, PyObject *py_fds_to_keep)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0 && defined(__linux__)
|
||||
/* It doesn't matter if d_name has room for NAME_MAX chars; we're using this
|
||||
* only to read a directory of short file descriptor number names. The kernel
|
||||
* will return an error if we didn't give it enough space. Highly Unlikely.
|
||||
* This structure is very old and stable: It will not change unless the kernel
|
||||
* chooses to break compatibility with all existing binaries. Highly Unlikely.
|
||||
*/
|
||||
struct linux_dirent64 {
|
||||
unsigned long long d_ino;
|
||||
long long d_off;
|
||||
unsigned short d_reclen; /* Length of this linux_dirent */
|
||||
unsigned char d_type;
|
||||
char d_name[256]; /* Filename (null-terminated) */
|
||||
};
|
||||
|
||||
/* Close all open file descriptors in the range from start_fd and higher
|
||||
* Do not close any in the sorted py_fds_to_keep list.
|
||||
*
|
||||
|
@ -243,46 +218,27 @@ struct linux_dirent64 {
|
|||
static void
|
||||
_close_open_fds_safe(int start_fd, PyObject* py_fds_to_keep)
|
||||
{
|
||||
int fd_dir_fd;
|
||||
|
||||
fd_dir_fd = _Py_open_noraise(FD_DIR, O_RDONLY);
|
||||
if (fd_dir_fd == -1) {
|
||||
/* No way to get a list of open fds. */
|
||||
_close_fds_by_brute_force(start_fd, py_fds_to_keep);
|
||||
return;
|
||||
} else {
|
||||
char buffer[sizeof(struct linux_dirent64)];
|
||||
int bytes;
|
||||
#if 0
|
||||
while ((bytes = syscall(SYS_getdents64, fd_dir_fd,
|
||||
(struct linux_dirent64 *)buffer,
|
||||
sizeof(buffer))) > 0) {
|
||||
struct linux_dirent64 *entry;
|
||||
int offset;
|
||||
#ifdef _Py_MEMORY_SANITIZER
|
||||
__msan_unpoison(buffer, bytes);
|
||||
#endif
|
||||
char buffer[512];
|
||||
struct dirent *entry;
|
||||
int fd, dir, bytes, offset;
|
||||
if ((dir = _Py_open_noraise(FD_DIR, O_RDONLY|O_DIRECTORY)) != -1) {
|
||||
while ((bytes = getdents(dir, buffer, sizeof(buffer), 0)) > 0) {
|
||||
for (offset = 0; offset < bytes; offset += entry->d_reclen) {
|
||||
int fd;
|
||||
entry = (struct linux_dirent64 *)(buffer + offset);
|
||||
entry = (struct dirent *)(buffer + offset);
|
||||
if ((fd = _pos_int_from_ascii(entry->d_name)) < 0)
|
||||
continue; /* Not a number. */
|
||||
if (fd != fd_dir_fd && fd >= start_fd &&
|
||||
if (fd != dir && fd >= start_fd &&
|
||||
!_is_fd_in_sorted_fd_sequence(fd, py_fds_to_keep)) {
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
close(fd_dir_fd);
|
||||
close(dir);
|
||||
} else {
|
||||
_close_fds_by_brute_force(start_fd, py_fds_to_keep);
|
||||
}
|
||||
}
|
||||
|
||||
#define _close_open_fds _close_open_fds_safe
|
||||
|
||||
#else /* NOT defined(__linux__) */
|
||||
|
||||
|
||||
/* Close all open file descriptors from start_fd and higher.
|
||||
* Do not close any in the sorted py_fds_to_keep tuple.
|
||||
*
|
||||
|
@ -300,34 +256,13 @@ static void
|
|||
_close_open_fds_maybe_unsafe(long start_fd, PyObject* py_fds_to_keep)
|
||||
{
|
||||
DIR *proc_fd_dir;
|
||||
#ifndef HAVE_DIRFD
|
||||
while (_is_fd_in_sorted_fd_sequence(start_fd, py_fds_to_keep)) {
|
||||
++start_fd;
|
||||
}
|
||||
/* Close our lowest fd before we call opendir so that it is likely to
|
||||
* reuse that fd otherwise we might close opendir's file descriptor in
|
||||
* our loop. This trick assumes that fd's are allocated on a lowest
|
||||
* available basis. */
|
||||
close(start_fd);
|
||||
++start_fd;
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
if (!_is_fdescfs_mounted_on_dev_fd())
|
||||
if (IsFreebsd() && !_is_fdescfs_mounted_on_dev_fd())
|
||||
proc_fd_dir = NULL;
|
||||
else
|
||||
#endif
|
||||
proc_fd_dir = opendir(FD_DIR);
|
||||
if (!proc_fd_dir) {
|
||||
/* No way to get a list of open fds. */
|
||||
_close_fds_by_brute_force(start_fd, py_fds_to_keep);
|
||||
} else {
|
||||
if (proc_fd_dir) {
|
||||
struct dirent *dir_entry;
|
||||
#ifdef HAVE_DIRFD
|
||||
int fd_used_by_opendir = dirfd(proc_fd_dir);
|
||||
#else
|
||||
int fd_used_by_opendir = start_fd - 1;
|
||||
#endif
|
||||
errno = 0;
|
||||
while ((dir_entry = readdir(proc_fd_dir))) {
|
||||
int fd;
|
||||
|
@ -344,13 +279,24 @@ _close_open_fds_maybe_unsafe(long start_fd, PyObject* py_fds_to_keep)
|
|||
_close_fds_by_brute_force(start_fd, py_fds_to_keep);
|
||||
}
|
||||
closedir(proc_fd_dir);
|
||||
} else {
|
||||
_close_fds_by_brute_force(start_fd, py_fds_to_keep);
|
||||
}
|
||||
}
|
||||
|
||||
#define _close_open_fds _close_open_fds_maybe_unsafe
|
||||
|
||||
#endif /* else NOT defined(__linux__) */
|
||||
|
||||
static void
|
||||
_close_open_fds(long start_fd, PyObject* py_fds_to_keep)
|
||||
{
|
||||
if (!IsWindows()) {
|
||||
if (IsLinux()) {
|
||||
_close_open_fds_safe(start_fd, py_fds_to_keep);
|
||||
} else {
|
||||
_close_open_fds_maybe_unsafe(start_fd, py_fds_to_keep);
|
||||
}
|
||||
} else {
|
||||
_close_fds_by_brute_force(start_fd, py_fds_to_keep);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is code executed in the child process immediately after fork
|
||||
|
@ -446,10 +392,8 @@ child_exec(char *const exec_array[],
|
|||
if (restore_signals)
|
||||
_Py_RestoreSignals();
|
||||
|
||||
#ifdef HAVE_SETSID
|
||||
if (call_setsid)
|
||||
if (call_setsid && !IsWindows())
|
||||
POSIX_CALL(setsid());
|
||||
#endif
|
||||
|
||||
reached_preexec = 1;
|
||||
if (preexec_fn != Py_None && preexec_fn_args_tuple) {
|
||||
|
@ -521,7 +465,6 @@ error:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static PyObject *
|
||||
subprocess_fork_exec(PyObject* self, PyObject *args)
|
||||
{
|
||||
|
@ -731,7 +674,6 @@ cleanup:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
PyDoc_STRVAR(subprocess_fork_exec_doc,
|
||||
"fork_exec(args, executable_list, close_fds, cwd, env,\n\
|
||||
p2cread, p2cwrite, c2pread, c2pwrite,\n\
|
||||
|
@ -765,7 +707,6 @@ static PyMethodDef module_methods[] = {
|
|||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
static struct PyModuleDef _posixsubprocessmodule = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"_posixsubprocess",
|
||||
|
|
20
third_party/python/Modules/_sha3.c
vendored
20
third_party/python/Modules/_sha3.c
vendored
|
@ -7575,8 +7575,7 @@ static char sha3_512__doc__[] =
|
|||
"hashbit length of 64 bytes.";
|
||||
|
||||
static PyTypeObject SHA3_224type = {
|
||||
{{1, 0}, 0},
|
||||
"_sha3.sha3_224",
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "_sha3.sha3_224",
|
||||
sizeof(SHA3object),
|
||||
0,
|
||||
(destructor)SHA3_dealloc,
|
||||
|
@ -7616,8 +7615,7 @@ static PyTypeObject SHA3_224type = {
|
|||
};
|
||||
|
||||
static PyTypeObject SHA3_256type = {
|
||||
{{1, 0}, 0},
|
||||
"_sha3.sha3_256",
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "_sha3.sha3_256",
|
||||
sizeof(SHA3object),
|
||||
0,
|
||||
(destructor)SHA3_dealloc,
|
||||
|
@ -7657,8 +7655,7 @@ static PyTypeObject SHA3_256type = {
|
|||
};
|
||||
|
||||
static PyTypeObject SHA3_384type = {
|
||||
{{1, 0}, 0},
|
||||
"_sha3.sha3_384",
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "_sha3.sha3_384",
|
||||
sizeof(SHA3object),
|
||||
0,
|
||||
(destructor)SHA3_dealloc,
|
||||
|
@ -7698,8 +7695,7 @@ static PyTypeObject SHA3_384type = {
|
|||
};
|
||||
|
||||
static PyTypeObject SHA3_512type = {
|
||||
{{1, 0}, 0},
|
||||
"_sha3.sha3_512",
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "_sha3.sha3_512",
|
||||
sizeof(SHA3object),
|
||||
0,
|
||||
(destructor)SHA3_dealloc,
|
||||
|
@ -7806,8 +7802,7 @@ static char shake_256__doc__[] =
|
|||
"shake_256([data]) -> SHAKE object\n\nReturn a new SHAKE hash object.";
|
||||
|
||||
static PyTypeObject SHAKE128type = {
|
||||
{{1, 0}, 0},
|
||||
"_sha3.shake_128",
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "_sha3.shake_128",
|
||||
sizeof(SHA3object),
|
||||
0,
|
||||
(destructor)SHA3_dealloc,
|
||||
|
@ -7846,8 +7841,7 @@ static PyTypeObject SHAKE128type = {
|
|||
py_sha3_new,
|
||||
};
|
||||
static PyTypeObject SHAKE256type = {
|
||||
{{1, 0}, 0},
|
||||
"_sha3.shake_256",
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "_sha3.shake_256",
|
||||
sizeof(SHA3object),
|
||||
0,
|
||||
(destructor)SHA3_dealloc,
|
||||
|
@ -7886,7 +7880,7 @@ static PyTypeObject SHAKE256type = {
|
|||
py_sha3_new,
|
||||
};
|
||||
|
||||
static struct PyModuleDef _SHA3module = {{{1, 0}, 0, 0, 0}, "_sha3", 0, -1};
|
||||
static struct PyModuleDef _SHA3module = {PyModuleDef_HEAD_INIT, "_sha3", 0, -1};
|
||||
|
||||
PyObject *PyInit__sha3(void) {
|
||||
PyObject *m = 0;
|
||||
|
|
3
third_party/python/Modules/_testcapimodule.c
vendored
3
third_party/python/Modules/_testcapimodule.c
vendored
|
@ -41,6 +41,7 @@
|
|||
#include "third_party/python/Include/pytime.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/traceback.h"
|
||||
#include "third_party/python/pyconfig.h"
|
||||
/* clang-format off */
|
||||
|
||||
/*
|
||||
|
@ -4370,7 +4371,7 @@ static PyMethodDef TestMethods[] = {
|
|||
{"test_capsule", (PyCFunction)test_capsule, METH_NOARGS},
|
||||
{"test_from_contiguous", (PyCFunction)test_from_contiguous, METH_NOARGS},
|
||||
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__GNUC__)
|
||||
{"test_pep3118_obsolete_write_locks", (PyCFunction)test_pep3118_obsolete_write_locks, METH_NOARGS},
|
||||
/* {"test_pep3118_obsolete_write_locks", (PyCFunction)test_pep3118_obsolete_write_locks, METH_NOARGS}, */
|
||||
#endif
|
||||
{"getbuffer_with_null_view", getbuffer_with_null_view, METH_O},
|
||||
{"test_buildvalue_N", test_buildvalue_N, METH_NOARGS},
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
preserve
|
||||
[clinic start generated code]*/
|
||||
#include "third_party/python/pyconfig.h"
|
||||
#include "third_party/python/pyconfig.h"
|
||||
#include "third_party/python/pyconfig.h"
|
||||
#include "third_party/python/pyconfig.h"
|
||||
#include "third_party/python/pyconfig.h"
|
||||
#include "third_party/python/pyconfig.h"
|
||||
|
||||
PyDoc_STRVAR(os_stat__doc__,
|
||||
"stat($module, /, path, *, dir_fd=None, follow_symlinks=True)\n"
|
||||
|
|
167
third_party/python/Modules/errnomodule.c
vendored
167
third_party/python/Modules/errnomodule.c
vendored
|
@ -6,6 +6,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/nt/errors.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/methodobject.h"
|
||||
|
@ -16,22 +17,17 @@
|
|||
#include "third_party/python/Include/unicodeobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/*
|
||||
* Pull in the system error definitions
|
||||
*/
|
||||
|
||||
static PyMethodDef errno_methods[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/* Helper function doing the dictionary inserting */
|
||||
|
||||
static void
|
||||
_inscode(PyObject *d, PyObject *de, const char *name, int code)
|
||||
{
|
||||
PyObject *u = PyUnicode_FromString(name);
|
||||
PyObject *v = PyLong_FromLong((long) code);
|
||||
|
||||
PyObject *u, *v;
|
||||
if (!code) return;
|
||||
u = PyUnicode_FromString(name);
|
||||
v = PyLong_FromLong((long)code);
|
||||
/* Don't bother checking for errors; they'll be caught at the end
|
||||
* of the module initialization function by the caller of
|
||||
* initerrno().
|
||||
|
@ -113,19 +109,12 @@ PyInit_errno(void)
|
|||
inscode(d, ds, de, "ENOBUFS", ENOBUFS, "No buffer space available");
|
||||
inscode(d, ds, de, "ELOOP", ELOOP, "Too many symbolic links encountered");
|
||||
inscode(d, ds, de, "EAFNOSUPPORT", EAFNOSUPPORT, "Address family not supported by protocol");
|
||||
|
||||
if (EPROTO) inscode(d, ds, de, "EPROTO", EPROTO, "Protocol error");
|
||||
if (ENOMSG) inscode(d, ds, de, "ENOMSG", ENOMSG, "No message of desired type");
|
||||
if (ENODATA) inscode(d, ds, de, "ENODATA", ENODATA, "No data available");
|
||||
if (EOVERFLOW) inscode(d, ds, de, "EOVERFLOW", EOVERFLOW, "Value too large for defined data type");
|
||||
|
||||
inscode(d, ds, de, "EHOSTDOWN", EHOSTDOWN, "Host is down");
|
||||
inscode(d, ds, de, "EPFNOSUPPORT", EPFNOSUPPORT, "Protocol family not supported");
|
||||
inscode(d, ds, de, "ENOPROTOOPT", ENOPROTOOPT, "Protocol not available");
|
||||
inscode(d, ds, de, "EBUSY", EBUSY, "Device or resource busy");
|
||||
inscode(d, ds, de, "EWOULDBLOCK", EWOULDBLOCK, "Operation would block");
|
||||
inscode(d, ds, de, "EBADFD", EBADFD, "File descriptor in bad state");
|
||||
|
||||
inscode(d, ds, de, "EISCONN", EISCONN, "Transport endpoint is already connected");
|
||||
inscode(d, ds, de, "ESHUTDOWN", ESHUTDOWN, "Cannot send after transport endpoint shutdown");
|
||||
inscode(d, ds, de, "ENONET", ENONET, "Machine is not on the network");
|
||||
|
@ -206,47 +195,64 @@ PyInit_errno(void)
|
|||
inscode(d, ds, de, "ETXTBSY", ETXTBSY, "Text file busy");
|
||||
inscode(d, ds, de, "EINPROGRESS", EINPROGRESS, "Operation now in progress");
|
||||
inscode(d, ds, de, "ENXIO", ENXIO, "No such device or address");
|
||||
|
||||
if (ENOMEDIUM) inscode(d, ds, de, "ENOMEDIUM", ENOMEDIUM, "No medium found");
|
||||
if (EMEDIUMTYPE) inscode(d, ds, de, "EMEDIUMTYPE", EMEDIUMTYPE, "Wrong medium type");
|
||||
if (ECANCELED) inscode(d, ds, de, "ECANCELED", ECANCELED, "Operation Canceled");
|
||||
if (EOWNERDEAD) inscode(d, ds, de, "EOWNERDEAD", EOWNERDEAD, "Owner died");
|
||||
if (ENOTRECOVERABLE) inscode(d, ds, de, "ENOTRECOVERABLE", ENOTRECOVERABLE, "State not recoverable");
|
||||
|
||||
#if !IsTiny()
|
||||
/* Linux junk errors */
|
||||
if (ENOANO) inscode(d, ds, de, "ENOANO", ENOANO, "No anode");
|
||||
if (EADV) inscode(d, ds, de, "EADV", EADV, "Advertise error");
|
||||
if (EL2HLT) inscode(d, ds, de, "EL2HLT", EL2HLT, "Level 2 halted");
|
||||
if (EDOTDOT) inscode(d, ds, de, "EDOTDOT", EDOTDOT, "RFS specific error");
|
||||
if (ENOPKG) inscode(d, ds, de, "ENOPKG", ENOPKG, "Package not installed");
|
||||
if (EBADR) inscode(d, ds, de, "EBADR", EBADR, "Invalid request descriptor");
|
||||
if (ENOCSI) inscode(d, ds, de, "ENOCSI", ENOCSI, "No CSI structure available");
|
||||
if (ENOKEY) inscode(d, ds, de, "ENOKEY", ENOKEY, "Required key not available");
|
||||
if (EUCLEAN) inscode(d, ds, de, "EUCLEAN", EUCLEAN, "Structure needs cleaning");
|
||||
if (ECHRNG) inscode(d, ds, de, "ECHRNG", ECHRNG, "Channel number out of range");
|
||||
if (EL2NSYNC) inscode(d, ds, de, "EL2NSYNC", EL2NSYNC, "Level 2 not synchronized");
|
||||
if (EKEYEXPIRED) inscode(d, ds, de, "EKEYEXPIRED", EKEYEXPIRED, "Key has expired");
|
||||
if (ENAVAIL) inscode(d, ds, de, "ENAVAIL", ENAVAIL, "No XENIX semaphores available");
|
||||
if (EKEYREVOKED) inscode(d, ds, de, "EKEYREVOKED", EKEYREVOKED, "Key has been revoked");
|
||||
if (ELIBBAD) inscode(d, ds, de, "ELIBBAD", ELIBBAD, "Accessing a corrupted shared library");
|
||||
if (EKEYREJECTED) inscode(d, ds, de, "EKEYREJECTED", EKEYREJECTED, "Key was rejected by service");
|
||||
if (ERFKILL) inscode(d, ds, de, "ERFKILL", ERFKILL, "Operation not possible due to RF-kill");
|
||||
#endif
|
||||
|
||||
/* Solaris-specific errnos */
|
||||
#ifdef ECANCELED
|
||||
inscode(d, ds, de, "ECANCELED", ECANCELED, "Operation canceled");
|
||||
#endif
|
||||
#ifdef ENOTSUP
|
||||
inscode(d, ds, de, "ENOTSUP", ENOTSUP, "Operation not supported");
|
||||
#endif
|
||||
#ifdef EOWNERDEAD
|
||||
|
||||
/* might not be available */
|
||||
inscode(d, ds, de, "EPROTO", EPROTO, "Protocol error");
|
||||
inscode(d, ds, de, "ENOMSG", ENOMSG, "No message of desired type");
|
||||
inscode(d, ds, de, "ENODATA", ENODATA, "No data available");
|
||||
inscode(d, ds, de, "EOVERFLOW", EOVERFLOW, "Value too large for defined data type");
|
||||
inscode(d, ds, de, "ENOMEDIUM", ENOMEDIUM, "No medium found");
|
||||
inscode(d, ds, de, "EMEDIUMTYPE", EMEDIUMTYPE, "Wrong medium type");
|
||||
inscode(d, ds, de, "ECANCELED", ECANCELED, "Operation Canceled");
|
||||
inscode(d, ds, de, "EOWNERDEAD", EOWNERDEAD, "Owner died");
|
||||
inscode(d, ds, de, "ENOTRECOVERABLE", ENOTRECOVERABLE, "State not recoverable");
|
||||
inscode(d, ds, de, "EOWNERDEAD", EOWNERDEAD, "Process died with the lock");
|
||||
#endif
|
||||
#ifdef ENOTRECOVERABLE
|
||||
inscode(d, ds, de, "ENOTRECOVERABLE", ENOTRECOVERABLE, "Lock is not recoverable");
|
||||
#endif
|
||||
|
||||
/* bsd only */
|
||||
inscode(d, ds, de, "EFTYPE", EFTYPE, "Inappropriate file type or format");
|
||||
inscode(d, ds, de, "EAUTH", EAUTH, "Authentication error");
|
||||
inscode(d, ds, de, "EBADRPC", EBADRPC, "RPC struct is bad");
|
||||
inscode(d, ds, de, "ENEEDAUTH", ENEEDAUTH, "Need authenticator");
|
||||
inscode(d, ds, de, "ENOATTR", ENOATTR, "Attribute not found");
|
||||
inscode(d, ds, de, "EPROCUNAVAIL", EPROCUNAVAIL, "Bad procedure for program");
|
||||
inscode(d, ds, de, "EPROGMISMATCH", EPROGMISMATCH, "Program version wrong");
|
||||
inscode(d, ds, de, "EPROGUNAVAIL", EPROGUNAVAIL, "RPC prog. not avail");
|
||||
inscode(d, ds, de, "ERPCMISMATCH", ERPCMISMATCH, "RPC version wrong");
|
||||
|
||||
/* bsd and windows literally */
|
||||
inscode(d, ds, de, "EPROCLIM", EPROCLIM, "Too many processes");
|
||||
|
||||
/* xnu only */
|
||||
inscode(d, ds, de, "EBADARCH", EBADARCH, "Bad CPU type in executable");
|
||||
inscode(d, ds, de, "EBADEXEC", EBADEXEC, "Bad executable (or shared library)");
|
||||
inscode(d, ds, de, "EBADMACHO", EBADMACHO, "Malformed Mach-o file");
|
||||
inscode(d, ds, de, "EDEVERR", EDEVERR, "Device error");
|
||||
inscode(d, ds, de, "ENOPOLICY", ENOPOLICY, "Policy not found");
|
||||
inscode(d, ds, de, "EPWROFF", EPWROFF, "Device power is off");
|
||||
inscode(d, ds, de, "ESHLIBVERS", ESHLIBVERS, "Shared library version mismatch");
|
||||
|
||||
/* linux undocumented errnos */
|
||||
inscode(d, ds, de, "ENOANO", ENOANO, "No anode");
|
||||
inscode(d, ds, de, "EADV", EADV, "Advertise error");
|
||||
inscode(d, ds, de, "EL2HLT", EL2HLT, "Level 2 halted");
|
||||
inscode(d, ds, de, "EDOTDOT", EDOTDOT, "RFS specific error");
|
||||
inscode(d, ds, de, "ENOPKG", ENOPKG, "Package not installed");
|
||||
inscode(d, ds, de, "EBADR", EBADR, "Invalid request descriptor");
|
||||
inscode(d, ds, de, "ENOCSI", ENOCSI, "No CSI structure available");
|
||||
inscode(d, ds, de, "ENOKEY", ENOKEY, "Required key not available");
|
||||
inscode(d, ds, de, "EUCLEAN", EUCLEAN, "Structure needs cleaning");
|
||||
inscode(d, ds, de, "ECHRNG", ECHRNG, "Channel number out of range");
|
||||
inscode(d, ds, de, "EL2NSYNC", EL2NSYNC, "Level 2 not synchronized");
|
||||
inscode(d, ds, de, "EKEYEXPIRED", EKEYEXPIRED, "Key has expired");
|
||||
inscode(d, ds, de, "ENAVAIL", ENAVAIL, "No XENIX semaphores available");
|
||||
inscode(d, ds, de, "EKEYREVOKED", EKEYREVOKED, "Key has been revoked");
|
||||
inscode(d, ds, de, "ELIBBAD", ELIBBAD, "Accessing a corrupted shared library");
|
||||
inscode(d, ds, de, "EKEYREJECTED", EKEYREJECTED, "Key was rejected by service");
|
||||
inscode(d, ds, de, "ERFKILL", ERFKILL, "Operation not possible due to RF-kill");
|
||||
|
||||
/* solaris only */
|
||||
#ifdef ELOCKUNMAPPED
|
||||
inscode(d, ds, de, "ELOCKUNMAPPED", ELOCKUNMAPPED, "Locked lock was unmapped");
|
||||
#endif
|
||||
|
@ -254,59 +260,6 @@ PyInit_errno(void)
|
|||
inscode(d, ds, de, "ENOTACTIVE", ENOTACTIVE, "Facility is not active");
|
||||
#endif
|
||||
|
||||
/* MacOSX specific errnos */
|
||||
#ifdef EAUTH
|
||||
inscode(d, ds, de, "EAUTH", EAUTH, "Authentication error");
|
||||
#endif
|
||||
#ifdef EBADARCH
|
||||
inscode(d, ds, de, "EBADARCH", EBADARCH, "Bad CPU type in executable");
|
||||
#endif
|
||||
#ifdef EBADEXEC
|
||||
inscode(d, ds, de, "EBADEXEC", EBADEXEC, "Bad executable (or shared library)");
|
||||
#endif
|
||||
#ifdef EBADMACHO
|
||||
inscode(d, ds, de, "EBADMACHO", EBADMACHO, "Malformed Mach-o file");
|
||||
#endif
|
||||
#ifdef EBADRPC
|
||||
inscode(d, ds, de, "EBADRPC", EBADRPC, "RPC struct is bad");
|
||||
#endif
|
||||
#ifdef EDEVERR
|
||||
inscode(d, ds, de, "EDEVERR", EDEVERR, "Device error");
|
||||
#endif
|
||||
#ifdef EFTYPE
|
||||
inscode(d, ds, de, "EFTYPE", EFTYPE, "Inappropriate file type or format");
|
||||
#endif
|
||||
#ifdef ENEEDAUTH
|
||||
inscode(d, ds, de, "ENEEDAUTH", ENEEDAUTH, "Need authenticator");
|
||||
#endif
|
||||
#ifdef ENOATTR
|
||||
inscode(d, ds, de, "ENOATTR", ENOATTR, "Attribute not found");
|
||||
#endif
|
||||
#ifdef ENOPOLICY
|
||||
inscode(d, ds, de, "ENOPOLICY", ENOPOLICY, "Policy not found");
|
||||
#endif
|
||||
#ifdef EPROCLIM
|
||||
inscode(d, ds, de, "EPROCLIM", EPROCLIM, "Too many processes");
|
||||
#endif
|
||||
#ifdef EPROCUNAVAIL
|
||||
inscode(d, ds, de, "EPROCUNAVAIL", EPROCUNAVAIL, "Bad procedure for program");
|
||||
#endif
|
||||
#ifdef EPROGMISMATCH
|
||||
inscode(d, ds, de, "EPROGMISMATCH", EPROGMISMATCH, "Program version wrong");
|
||||
#endif
|
||||
#ifdef EPROGUNAVAIL
|
||||
inscode(d, ds, de, "EPROGUNAVAIL", EPROGUNAVAIL, "RPC prog. not avail");
|
||||
#endif
|
||||
#ifdef EPWROFF
|
||||
inscode(d, ds, de, "EPWROFF", EPWROFF, "Device power is off");
|
||||
#endif
|
||||
#ifdef ERPCMISMATCH
|
||||
inscode(d, ds, de, "ERPCMISMATCH", ERPCMISMATCH, "RPC version wrong");
|
||||
#endif
|
||||
#ifdef ESHLIBVERS
|
||||
inscode(d, ds, de, "ESHLIBVERS", ESHLIBVERS, "Shared library version mismatch");
|
||||
#endif
|
||||
|
||||
Py_DECREF(de);
|
||||
return m;
|
||||
}
|
||||
|
|
6
third_party/python/Modules/getbuildinfo.c
vendored
6
third_party/python/Modules/getbuildinfo.c
vendored
|
@ -38,7 +38,11 @@
|
|||
const char *
|
||||
Py_GetBuildInfo(void)
|
||||
{
|
||||
return "🐒 Actually Portable Python";
|
||||
if (IsXnu()) {
|
||||
return "🐒 Actually Portable Python";
|
||||
} else {
|
||||
return "Actually Portable Python";
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
34
third_party/python/Modules/getpath.c
vendored
34
third_party/python/Modules/getpath.c
vendored
|
@ -4,10 +4,17 @@
|
|||
│ Python 3 │
|
||||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/mem/alloca.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/auxv.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/python/Include/fileutils.h"
|
||||
#include "third_party/python/Include/osdefs.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
|
@ -118,10 +125,11 @@ wchar_t *Py_GetProgramName(void);
|
|||
#define LANDMARK L"os.py"
|
||||
#endif
|
||||
|
||||
static wchar_t prefix[MAXPATHLEN+1];
|
||||
static wchar_t exec_prefix[MAXPATHLEN+1];
|
||||
static wchar_t progpath[MAXPATHLEN+1];
|
||||
static wchar_t limited_search_path[] = L"zip!.python";
|
||||
static const wchar_t limited_search_path[] = L"/zip/.python";
|
||||
|
||||
static wchar_t *progpath;
|
||||
static wchar_t *prefix = limited_search_path;
|
||||
static wchar_t *exec_prefix = limited_search_path;
|
||||
static wchar_t *module_search_path = limited_search_path;
|
||||
|
||||
/* Get file status. Encode the path to the locale encoding. */
|
||||
|
@ -501,9 +509,9 @@ calculate_path(void)
|
|||
* other way to find a directory to start the search from. If
|
||||
* $PATH isn't exported, you lose.
|
||||
*/
|
||||
if (wcschr(prog, SEP))
|
||||
if (wcschr(prog, SEP)) {
|
||||
wcsncpy(progpath, prog, MAXPATHLEN);
|
||||
else if (path) {
|
||||
} else if (path) {
|
||||
while (1) {
|
||||
wchar_t *delim = wcschr(path, DELIM);
|
||||
if (delim) {
|
||||
|
@ -524,9 +532,9 @@ calculate_path(void)
|
|||
}
|
||||
path = delim + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
progpath[0] = '\0';
|
||||
}
|
||||
PyMem_RawFree(path_buffer);
|
||||
if (progpath[0] != SEP && progpath[0] != '\0')
|
||||
absolutize(progpath);
|
||||
|
@ -542,12 +550,11 @@ calculate_path(void)
|
|||
L"third_party/python/Lib",
|
||||
MAXPATHLEN);
|
||||
/* wcsncpy(prefix, */
|
||||
/* L"zip!.python", */
|
||||
/* L"/zip/.python", */
|
||||
/* MAXPATHLEN); */
|
||||
/* Avoid absolute path for exec_prefix */
|
||||
wcsncpy(exec_prefix, L"build/lib.linux-x86_64-3.6", MAXPATHLEN);
|
||||
wcsncpy(package_path, L"Lib/site-packages", MAXPATHLEN);
|
||||
// printf("progpath = %ls, prog = %ls\n", progpath, prog);
|
||||
/* add paths for the internal store of the APE */
|
||||
if (wcslen(progpath) > 0 && wcslen(progpath) + 1 < MAXPATHLEN)
|
||||
wcsncpy(ape_path, progpath, MAXPATHLEN);
|
||||
|
@ -653,7 +660,10 @@ Py_GetExecPrefix(void)
|
|||
wchar_t *
|
||||
Py_GetProgramFullPath(void)
|
||||
{
|
||||
if (!module_search_path)
|
||||
calculate_path();
|
||||
static bool once;
|
||||
if (cmpxchg(&once, false, true)) {
|
||||
progpath = utf8toutf32(program_executable_name, -1, 0);
|
||||
__cxa_atexit(free, progpath, 0);
|
||||
}
|
||||
return progpath;
|
||||
}
|
||||
|
|
39
third_party/python/Modules/posixmodule.c
vendored
39
third_party/python/Modules/posixmodule.c
vendored
|
@ -11803,6 +11803,7 @@ all_ins(PyObject *m)
|
|||
if (PyModule_AddIntMacro(m, WNOHANG)) return -1;
|
||||
if (WUNTRACED && PyModule_AddIntMacro(m, WUNTRACED)) return -1;
|
||||
if (WCONTINUED && PyModule_AddIntMacro(m, WCONTINUED)) return -1;
|
||||
|
||||
if (PyModule_AddIntMacro(m, O_RDONLY)) return -1;
|
||||
if (PyModule_AddIntMacro(m, O_WRONLY)) return -1;
|
||||
if (PyModule_AddIntMacro(m, O_RDWR)) return -1;
|
||||
|
@ -11812,6 +11813,7 @@ all_ins(PyObject *m)
|
|||
if (PyModule_AddIntMacro(m, O_APPEND)) return -1;
|
||||
if (PyModule_AddIntMacro(m, O_CLOEXEC)) return -1;
|
||||
if (PyModule_AddIntMacro(m, O_CREAT)) return -1;
|
||||
if (PyModule_AddIntMacro(m, O_DIRECTORY)) return -1;
|
||||
if (PyModule_AddIntMacro(m, O_LARGEFILE)) return -1;
|
||||
if (O_DSYNC && PyModule_AddIntMacro(m, O_DSYNC)) return -1;
|
||||
if (O_RSYNC && PyModule_AddIntMacro(m, O_RSYNC)) return -1;
|
||||
|
@ -11826,9 +11828,14 @@ all_ins(PyObject *m)
|
|||
if (O_TTY_INIT && PyModule_AddIntMacro(m, O_TTY_INIT)) return -1;
|
||||
if (O_TMPFILE && PyModule_AddIntMacro(m, O_TMPFILE)) return -1;
|
||||
if (O_PATH && PyModule_AddIntMacro(m, O_PATH)) return -1;
|
||||
if (PyModule_AddIntMacro(m, PRIO_PROCESS)) return -1;
|
||||
if (PyModule_AddIntMacro(m, PRIO_PGRP)) return -1;
|
||||
if (PyModule_AddIntMacro(m, PRIO_USER)) return -1;
|
||||
if (O_RANDOM && PyModule_AddIntMacro(m, O_RANDOM)) return -1;
|
||||
if (O_SEQUENTIAL && PyModule_AddIntMacro(m, O_SEQUENTIAL)) return -1;
|
||||
if (O_ASYNC && PyModule_AddIntMacro(m, O_ASYNC)) return -1;
|
||||
if (O_DIRECT && PyModule_AddIntMacro(m, O_DIRECT)) return -1;
|
||||
if (O_NOFOLLOW && PyModule_AddIntMacro(m, O_NOFOLLOW)) return -1;
|
||||
if (O_NOFOLLOW_ANY && PyModule_AddIntMacro(m, O_NOFOLLOW_ANY)) return -1;
|
||||
if (O_NOATIME && PyModule_AddIntMacro(m, O_NOATIME)) return -1;
|
||||
if (O_VERIFY && PyModule_AddIntMacro(m, O_VERIFY)) return -1;
|
||||
#ifdef O_BINARY
|
||||
if (PyModule_AddIntMacro(m, O_BINARY)) return -1;
|
||||
#endif
|
||||
|
@ -11838,21 +11845,6 @@ all_ins(PyObject *m)
|
|||
#ifdef O_XATTR
|
||||
if (PyModule_AddIntMacro(m, O_XATTR)) return -1;
|
||||
#endif
|
||||
|
||||
#ifdef SEEK_HOLE
|
||||
if (PyModule_AddIntMacro(m, SEEK_HOLE)) return -1;
|
||||
#endif
|
||||
#ifdef SEEK_DATA
|
||||
if (PyModule_AddIntMacro(m, SEEK_DATA)) return -1;
|
||||
#endif
|
||||
|
||||
if (PyModule_AddIntMacro(m, O_DIRECTORY)) return -1;
|
||||
if (O_RANDOM && PyModule_AddIntMacro(m, O_RANDOM)) return -1;
|
||||
if (O_SEQUENTIAL && PyModule_AddIntMacro(m, O_SEQUENTIAL)) return -1;
|
||||
if (O_ASYNC && PyModule_AddIntMacro(m, O_ASYNC)) return -1;
|
||||
if (O_DIRECT && PyModule_AddIntMacro(m, O_DIRECT)) return -1;
|
||||
if (O_NOFOLLOW && PyModule_AddIntMacro(m, O_NOFOLLOW)) return -1;
|
||||
if (O_NOATIME && PyModule_AddIntMacro(m, O_NOATIME)) return -1;
|
||||
#ifdef O_NOINHERIT
|
||||
if (PyModule_AddIntMacro(m, O_NOINHERIT)) return -1;
|
||||
#endif
|
||||
|
@ -11863,6 +11855,17 @@ all_ins(PyObject *m)
|
|||
if (PyModule_AddIntMacro(m, O_TEMPORARY)) return -1;
|
||||
#endif
|
||||
|
||||
if (PyModule_AddIntMacro(m, PRIO_PROCESS)) return -1;
|
||||
if (PyModule_AddIntMacro(m, PRIO_PGRP)) return -1;
|
||||
if (PyModule_AddIntMacro(m, PRIO_USER)) return -1;
|
||||
|
||||
#ifdef SEEK_HOLE
|
||||
if (PyModule_AddIntMacro(m, SEEK_HOLE)) return -1;
|
||||
#endif
|
||||
#ifdef SEEK_DATA
|
||||
if (PyModule_AddIntMacro(m, SEEK_DATA)) return -1;
|
||||
#endif
|
||||
|
||||
/* These come from sysexits.h */
|
||||
if (PyModule_AddIntMacro(m, EX_OK)) return -1;
|
||||
if (PyModule_AddIntMacro(m, EX_USAGE)) return -1;
|
||||
|
|
220
third_party/python/Modules/signalmodule.c
vendored
220
third_party/python/Modules/signalmodule.c
vendored
|
@ -27,6 +27,7 @@
|
|||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Modules/posixmodule.h"
|
||||
#include "third_party/python/pyconfig.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Signal module -- many thanks to Lance Ellinghaus */
|
||||
|
@ -1230,18 +1231,9 @@ PyInit__signal(void)
|
|||
goto finally;
|
||||
Py_DECREF(x);
|
||||
|
||||
#ifdef SIG_BLOCK
|
||||
if (PyModule_AddIntMacro(m, SIG_BLOCK))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIG_UNBLOCK
|
||||
if (PyModule_AddIntMacro(m, SIG_UNBLOCK))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIG_SETMASK
|
||||
if (PyModule_AddIntMacro(m, SIG_SETMASK))
|
||||
goto finally;
|
||||
#endif
|
||||
if (PyModule_AddIntMacro(m, SIG_BLOCK)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIG_UNBLOCK)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIG_SETMASK)) goto finally;
|
||||
|
||||
x = IntHandler = PyDict_GetItemString(d, "default_int_handler");
|
||||
if (!x)
|
||||
|
@ -1268,173 +1260,47 @@ PyInit__signal(void)
|
|||
PyOS_setsig(SIGINT, signal_handler);
|
||||
}
|
||||
|
||||
#ifdef SIGHUP
|
||||
if (PyModule_AddIntMacro(m, SIGHUP))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGINT
|
||||
if (PyModule_AddIntMacro(m, SIGINT))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGBREAK
|
||||
if (PyModule_AddIntMacro(m, SIGBREAK))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
if (PyModule_AddIntMacro(m, SIGQUIT))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGILL
|
||||
if (PyModule_AddIntMacro(m, SIGILL))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGTRAP
|
||||
if (PyModule_AddIntMacro(m, SIGTRAP))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGIOT
|
||||
if (PyModule_AddIntMacro(m, SIGIOT))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGABRT
|
||||
if (PyModule_AddIntMacro(m, SIGABRT))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGEMT
|
||||
if (PyModule_AddIntMacro(m, SIGEMT))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGFPE
|
||||
if (PyModule_AddIntMacro(m, SIGFPE))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGKILL
|
||||
if (PyModule_AddIntMacro(m, SIGKILL))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGBUS
|
||||
if (PyModule_AddIntMacro(m, SIGBUS))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGSEGV
|
||||
if (PyModule_AddIntMacro(m, SIGSEGV))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGSYS
|
||||
if (PyModule_AddIntMacro(m, SIGSYS))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
if (PyModule_AddIntMacro(m, SIGPIPE))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGALRM
|
||||
if (PyModule_AddIntMacro(m, SIGALRM))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGTERM
|
||||
if (PyModule_AddIntMacro(m, SIGTERM))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGUSR1
|
||||
if (PyModule_AddIntMacro(m, SIGUSR1))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGUSR2
|
||||
if (PyModule_AddIntMacro(m, SIGUSR2))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGCLD
|
||||
if (PyModule_AddIntMacro(m, SIGCLD))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGCHLD
|
||||
if (PyModule_AddIntMacro(m, SIGCHLD))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGPWR
|
||||
if (PyModule_AddIntMacro(m, SIGPWR))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGIO
|
||||
if (PyModule_AddIntMacro(m, SIGIO))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGURG
|
||||
if (PyModule_AddIntMacro(m, SIGURG))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGWINCH
|
||||
if (PyModule_AddIntMacro(m, SIGWINCH))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGPOLL
|
||||
if (PyModule_AddIntMacro(m, SIGPOLL))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGSTOP
|
||||
if (PyModule_AddIntMacro(m, SIGSTOP))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGTSTP
|
||||
if (PyModule_AddIntMacro(m, SIGTSTP))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGCONT
|
||||
if (PyModule_AddIntMacro(m, SIGCONT))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGTTIN
|
||||
if (PyModule_AddIntMacro(m, SIGTTIN))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGTTOU
|
||||
if (PyModule_AddIntMacro(m, SIGTTOU))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGVTALRM
|
||||
if (PyModule_AddIntMacro(m, SIGVTALRM))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGPROF
|
||||
if (PyModule_AddIntMacro(m, SIGPROF))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGXCPU
|
||||
if (PyModule_AddIntMacro(m, SIGXCPU))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGXFSZ
|
||||
if (PyModule_AddIntMacro(m, SIGXFSZ))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGRTMIN
|
||||
if (PyModule_AddIntMacro(m, SIGRTMIN))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGRTMAX
|
||||
if (PyModule_AddIntMacro(m, SIGRTMAX))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef SIGINFO
|
||||
if (PyModule_AddIntMacro(m, SIGINFO))
|
||||
goto finally;
|
||||
#endif
|
||||
|
||||
#ifdef ITIMER_REAL
|
||||
if (PyModule_AddIntMacro(m, ITIMER_REAL))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef ITIMER_VIRTUAL
|
||||
if (PyModule_AddIntMacro(m, ITIMER_VIRTUAL))
|
||||
goto finally;
|
||||
#endif
|
||||
#ifdef ITIMER_PROF
|
||||
if (PyModule_AddIntMacro(m, ITIMER_PROF))
|
||||
goto finally;
|
||||
#endif
|
||||
if (PyModule_AddIntMacro(m, SIGHUP)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGINT)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGQUIT)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGILL)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGTRAP)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGIOT)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGABRT)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGFPE)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGKILL)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGBUS)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGSEGV)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGSYS)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGPIPE)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGALRM)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGTERM)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGUSR1)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGUSR2)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGCHLD)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGPWR)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGIO)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGURG)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGWINCH)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGPOLL)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGSTOP)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGTSTP)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGCONT)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGTTIN)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGTTOU)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGVTALRM)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGPROF)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGXCPU)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, SIGXFSZ)) goto finally;
|
||||
if (SIGEMT && PyModule_AddIntMacro(m, SIGEMT)) goto finally;
|
||||
if (SIGINFO && PyModule_AddIntMacro(m, SIGINFO)) goto finally;
|
||||
if (SIGRTMIN && PyModule_AddIntMacro(m, SIGRTMIN)) goto finally;
|
||||
if (SIGRTMAX && PyModule_AddIntMacro(m, SIGRTMAX)) goto finally;
|
||||
|
||||
#if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER)
|
||||
if (PyModule_AddIntMacro(m, ITIMER_REAL)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, ITIMER_VIRTUAL)) goto finally;
|
||||
if (PyModule_AddIntMacro(m, ITIMER_PROF)) goto finally;
|
||||
ItimerError = PyErr_NewException("signal.ItimerError",
|
||||
PyExc_IOError, NULL);
|
||||
if (ItimerError != NULL)
|
||||
|
|
1
third_party/python/Modules/socketmodule.c
vendored
1
third_party/python/Modules/socketmodule.c
vendored
|
@ -1964,7 +1964,6 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Support functions for the sendmsg() and recvmsg[_into]() methods.
|
||||
Currently, these methods are only compiled if the RFC 2292/3542
|
||||
CMSG_LEN() macro is available. Older systems seem to have used
|
||||
|
|
17
third_party/python/Modules/termios.c
vendored
17
third_party/python/Modules/termios.c
vendored
|
@ -8,6 +8,7 @@
|
|||
#include "libc/calls/termios.h"
|
||||
#include "libc/calls/ttydefaults.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/sysv/consts/baud.h"
|
||||
#include "libc/sysv/consts/fio.h"
|
||||
#include "libc/sysv/consts/modem.h"
|
||||
|
@ -379,13 +380,13 @@ PyInit_termios(void)
|
|||
PyModule_AddIntConstant(m, "TCSADRAIN", TCSADRAIN);
|
||||
PyModule_AddIntConstant(m, "TCSAFLUSH", TCSAFLUSH);
|
||||
/* TODO(jart): TCSASOFT */
|
||||
if (TCIFLUSH) PyModule_AddIntConstant(m, "TCIFLUSH", TCIFLUSH);
|
||||
if (TCOFLUSH) PyModule_AddIntConstant(m, "TCOFLUSH", TCOFLUSH);
|
||||
if (TCIOFLUSH) PyModule_AddIntConstant(m, "TCIOFLUSH", TCIOFLUSH);
|
||||
if (TCOOFF) PyModule_AddIntConstant(m, "TCOOFF", TCOOFF);
|
||||
if (TCOON) PyModule_AddIntConstant(m, "TCOON", TCOON);
|
||||
if (TCIOFF) PyModule_AddIntConstant(m, "TCIOFF", TCIOFF);
|
||||
if (TCION) PyModule_AddIntConstant(m, "TCION", TCION);
|
||||
PyModule_AddIntConstant(m, "TCIFLUSH", TCIFLUSH);
|
||||
PyModule_AddIntConstant(m, "TCOFLUSH", TCOFLUSH);
|
||||
PyModule_AddIntConstant(m, "TCIOFLUSH", TCIOFLUSH);
|
||||
PyModule_AddIntConstant(m, "TCOOFF", TCOOFF);
|
||||
PyModule_AddIntConstant(m, "TCOON", TCOON);
|
||||
PyModule_AddIntConstant(m, "TCIOFF", TCIOFF);
|
||||
PyModule_AddIntConstant(m, "TCION", TCION);
|
||||
if (IGNBRK) PyModule_AddIntConstant(m, "IGNBRK", IGNBRK);
|
||||
if (BRKINT) PyModule_AddIntConstant(m, "BRKINT", BRKINT);
|
||||
if (IGNPAR) PyModule_AddIntConstant(m, "IGNPAR", IGNPAR);
|
||||
|
@ -439,7 +440,7 @@ PyInit_termios(void)
|
|||
if (HUPCL) PyModule_AddIntConstant(m, "HUPCL", HUPCL);
|
||||
if (CLOCAL) PyModule_AddIntConstant(m, "CLOCAL", CLOCAL);
|
||||
if (CIBAUD) PyModule_AddIntConstant(m, "CIBAUD", CIBAUD);
|
||||
if (CS5) PyModule_AddIntConstant(m, "CS5", CS5);
|
||||
PyModule_AddIntConstant(m, "CS5", CS5);
|
||||
if (CS6) PyModule_AddIntConstant(m, "CS6", CS6);
|
||||
if (CS7) PyModule_AddIntConstant(m, "CS7", CS7);
|
||||
if (CS8) PyModule_AddIntConstant(m, "CS8", CS8);
|
||||
|
|
2
third_party/python/Objects/object.c
vendored
2
third_party/python/Objects/object.c
vendored
|
@ -24,6 +24,7 @@
|
|||
#include "third_party/python/Include/iterobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/memoryobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/namespaceobject.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
|
@ -33,6 +34,7 @@
|
|||
#include "third_party/python/Include/rangeobject.h"
|
||||
#include "third_party/python/Include/setobject.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/sysmodule.h"
|
||||
#include "third_party/python/Include/traceback.h"
|
||||
#include "third_party/python/Include/weakrefobject.h"
|
||||
/* clang-format off */
|
||||
|
|
1
third_party/python/Parser/parser.c
vendored
1
third_party/python/Parser/parser.c
vendored
|
@ -9,6 +9,7 @@
|
|||
#include "third_party/python/Include/grammar.h"
|
||||
#include "third_party/python/Include/node.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
#include "third_party/python/Include/token.h"
|
||||
#include "third_party/python/Parser/parser.h"
|
||||
|
|
145
third_party/python/Programs/python.c
vendored
145
third_party/python/Programs/python.c
vendored
|
@ -13,6 +13,7 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/symbols.internal.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/fileno.h"
|
||||
|
@ -29,6 +30,8 @@
|
|||
#include "third_party/python/Include/listobject.h"
|
||||
#include "third_party/python/Include/moduleobject.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/pydebug.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pylifecycle.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
#include "third_party/python/Include/pyport.h"
|
||||
|
@ -60,8 +63,6 @@ PYTHON_YOINK(".python/bdb.py");
|
|||
PYTHON_YOINK(".python/binhex.py");
|
||||
PYTHON_YOINK(".python/bisect.py");
|
||||
PYTHON_YOINK(".python/calendar.py");
|
||||
PYTHON_YOINK(".python/cgi.py");
|
||||
PYTHON_YOINK(".python/cgitb.py");
|
||||
PYTHON_YOINK(".python/chunk.py");
|
||||
PYTHON_YOINK(".python/cmd.py");
|
||||
PYTHON_YOINK(".python/code.py");
|
||||
|
@ -77,6 +78,7 @@ PYTHON_YOINK(".python/decimal.py");
|
|||
PYTHON_YOINK(".python/difflib.py");
|
||||
PYTHON_YOINK(".python/doctest.py");
|
||||
PYTHON_YOINK(".python/dummy_threading.py");
|
||||
PYTHON_YOINK(".python/threading.py");
|
||||
PYTHON_YOINK(".python/enum.py");
|
||||
PYTHON_YOINK(".python/filecmp.py");
|
||||
PYTHON_YOINK(".python/fileinput.py");
|
||||
|
@ -184,7 +186,9 @@ PYTHON_YOINK(".python/py_compile.py");
|
|||
#endif
|
||||
|
||||
#if !IsTiny()
|
||||
PYTHON_YOINK(".python/cgi.py");
|
||||
PYTHON_YOINK(".python/pdb.py");
|
||||
PYTHON_YOINK(".python/cgitb.py");
|
||||
PYTHON_YOINK(".python/pydoc.py");
|
||||
PYTHON_YOINK(".python/timeit.py");
|
||||
PYTHON_YOINK(".python/profile.py");
|
||||
|
@ -203,7 +207,6 @@ PYTHON_YOINK(".python/zipapp.py");
|
|||
PYTHON_YOINK(".python/ftplib.py");
|
||||
PYTHON_YOINK(".python/tarfile.py");
|
||||
PYTHON_YOINK(".python/zipfile.py");
|
||||
PYTHON_YOINK(".python/threading.py");
|
||||
PYTHON_YOINK(".python/telnetlib.py");
|
||||
PYTHON_YOINK(".python/antigravity.py");
|
||||
PYTHON_YOINK(".python/rlcompleter.py");
|
||||
|
@ -650,7 +653,7 @@ PYTHON_YOINK(".python/email/utils.py");
|
|||
STATIC_YOINK(".python/email/architecture.rst");
|
||||
#endif
|
||||
|
||||
#if !IsTiny()
|
||||
#ifdef WITH_THREAD
|
||||
PYTHON_YOINK(".python/asynchat.py");
|
||||
PYTHON_YOINK(".python/asyncore.py");
|
||||
STATIC_YOINK(".python/asyncio/");
|
||||
|
@ -683,90 +686,116 @@ PYTHON_YOINK(".python/asyncio/windows_utils.py");
|
|||
|
||||
const struct _frozen *PyImport_FrozenModules = _PyImport_FrozenModules;
|
||||
struct _inittab *PyImport_Inittab = _PyImport_Inittab;
|
||||
|
||||
static jmp_buf jbuf;
|
||||
|
||||
static void
|
||||
OnKeyboardInterrupt(int sig)
|
||||
{
|
||||
longjmp(jbuf, 1);
|
||||
gclongjmp(jbuf, 1);
|
||||
}
|
||||
|
||||
static void AddCompletion(linenoiseCompletions *c, char *s)
|
||||
static void
|
||||
AddCompletion(linenoiseCompletions *c, char *s)
|
||||
{
|
||||
c->cvec = realloc(c->cvec, ++c->len * sizeof(*c->cvec));
|
||||
c->cvec[c->len - 1] = s;
|
||||
}
|
||||
|
||||
static void
|
||||
CompleteDict(const char *s, size_t n, linenoiseCompletions *c, PyObject *o)
|
||||
CompleteDict(const char *b, const char *q, const char *p,
|
||||
linenoiseCompletions *c, PyObject *o)
|
||||
{
|
||||
const char *t;
|
||||
Py_ssize_t i, m;
|
||||
const char *s;
|
||||
PyObject *k, *v;
|
||||
Py_ssize_t i, m;
|
||||
for (i = 0; PyDict_Next(o, &i, &k, &v);) {
|
||||
if (v != Py_None && PyUnicode_Check(k)) {
|
||||
t = PyUnicode_AsUTF8AndSize(k, &m);
|
||||
if (m > n && !memcasecmp(t, s, n)) {
|
||||
AddCompletion(c, strdup(t));
|
||||
}
|
||||
if ((v != Py_None && PyUnicode_Check(k) &&
|
||||
(s = PyUnicode_AsUTF8AndSize(k, &m)) &&
|
||||
m >= q - p && !memcmp(s, p, q - p))) {
|
||||
AddCompletion(c, xasprintf("%.*s%.*s", p - b, b, m, s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
CompleteDir(const char *b, const char *q, const char *p,
|
||||
linenoiseCompletions *c, PyObject *o)
|
||||
{
|
||||
Py_ssize_t m;
|
||||
const char *s;
|
||||
PyObject *d, *i, *k;
|
||||
if (!(d = PyObject_Dir(o))) return;
|
||||
if ((i = PyObject_GetIter(d))) {
|
||||
while ((k = PyIter_Next(i))) {
|
||||
if (((s = PyUnicode_AsUTF8AndSize(k, &m)) &&
|
||||
m >= q - p && !memcmp(s, p, q - p))) {
|
||||
AddCompletion(c, xasprintf("%.*s%.*s", p - b, b, m, s));
|
||||
}
|
||||
Py_DECREF(k);
|
||||
}
|
||||
Py_DECREF(i);
|
||||
}
|
||||
Py_DECREF(d);
|
||||
}
|
||||
|
||||
static void
|
||||
TerminalCompletion(const char *p, linenoiseCompletions *c)
|
||||
{
|
||||
bool ok;
|
||||
Py_ssize_t m;
|
||||
const char *q, *s, *b = p;
|
||||
PyObject *o, *t, *d, *i, *k;
|
||||
PyObject *o, *t, *i;
|
||||
const char *q, *s, *b;
|
||||
for (b = p, p += strlen(p); p > b; --p) {
|
||||
if (!isalnum(p[-1]) && p[-1] != '.' && p[-1] != '_') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
o = PyModule_GetDict(PyImport_AddModule("__main__"));
|
||||
if (!*(q = strchrnul(p, '.'))) {
|
||||
CompleteDict(p, q - p, c, o);
|
||||
CompleteDict(b, q, p, c, o);
|
||||
CompleteDir(b, q, p, c, PyDict_GetItemString(o, "__builtins__"));
|
||||
} else {
|
||||
Py_INCREF(o);
|
||||
if ((t = PyDict_GetItemString(o, gc(strndup(p, q - p))))) {
|
||||
s = strndup(p, q - p);
|
||||
if ((t = PyDict_GetItemString(o, s))) {
|
||||
Py_INCREF(t);
|
||||
Py_DECREF(o);
|
||||
o = t;
|
||||
p = q + 1;
|
||||
for (ok = true; *(q = strchrnul(p, '.')) == '.';) {
|
||||
if ((t = PyObject_GetAttrString(o, gc(strndup(p, q - p))))) {
|
||||
Py_DECREF(o);
|
||||
o = t;
|
||||
p = q + 1;
|
||||
} else {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ok = false;
|
||||
}
|
||||
if (ok && (d = PyObject_Dir(o))) {
|
||||
if ((i = PyObject_GetIter(d))) {
|
||||
while ((k = PyIter_Next(i))) {
|
||||
s = PyUnicode_AsUTF8AndSize(k, &m);
|
||||
if (m > q - p && !memcasecmp(s, p, q - p)) {
|
||||
AddCompletion(c, xasprintf("%.*s%.*s", p - b, b, m, s));
|
||||
}
|
||||
Py_DECREF(k);
|
||||
}
|
||||
Py_DECREF(i);
|
||||
o = PyDict_GetItemString(o, "__builtins__");
|
||||
if (PyObject_HasAttrString(o, s)) {
|
||||
t = PyObject_GetAttrString(o, s);
|
||||
}
|
||||
Py_DECREF(d);
|
||||
}
|
||||
Py_DECREF(o);
|
||||
while ((p = q + 1), (o = t)) {
|
||||
if (*(q = strchrnul(p, '.'))) {
|
||||
t = PyObject_GetAttrString(o, gc(strndup(p, q - p)));
|
||||
Py_DECREF(o);
|
||||
} else {
|
||||
CompleteDir(b, q, p, c, o);
|
||||
Py_DECREF(o);
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(s);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
TerminalHint(const char *p, int *color, int *bold)
|
||||
{
|
||||
char *h = 0;
|
||||
linenoiseCompletions c = {0};
|
||||
TerminalCompletion(p, &c);
|
||||
if (c.len == 1) {
|
||||
h = strdup(c.cvec[0] + strlen(p));
|
||||
*bold = 2;
|
||||
}
|
||||
linenoiseFreeCompletions(&c);
|
||||
return h;
|
||||
}
|
||||
|
||||
static char *
|
||||
TerminalReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
|
||||
{
|
||||
size_t n;
|
||||
char *p, *q;
|
||||
PyOS_sighandler_t saint;
|
||||
PyOS_sighandler_t saint;
|
||||
saint = PyOS_setsig(SIGINT, OnKeyboardInterrupt);
|
||||
if (setjmp(jbuf)) {
|
||||
linenoiseDisableRawMode(STDIN_FILENO);
|
||||
|
@ -781,12 +810,11 @@ TerminalReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
|
|||
strcpy(mempcpy(q, p, n), "\n");
|
||||
free(p);
|
||||
clearerr(sys_stdin);
|
||||
return q;
|
||||
} else {
|
||||
q = PyMem_RawMalloc(1);
|
||||
if (q) *q = 0;
|
||||
return q;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -798,12 +826,17 @@ main(int argc, char **argv)
|
|||
int i, res;
|
||||
char *oldloc;
|
||||
|
||||
ShowCrashReports();
|
||||
/* if (FindDebugBinary()) { */
|
||||
/* ShowCrashReports(); */
|
||||
/* } */
|
||||
|
||||
PyOS_ReadlineFunctionPointer = TerminalReadline;
|
||||
linenoiseSetCompletionCallback(TerminalCompletion);
|
||||
linenoiseSetHintsCallback(TerminalHint);
|
||||
linenoiseSetFreeHintsCallback(free);
|
||||
|
||||
/* Force malloc() allocator to bootstrap Python */
|
||||
(void)_PyMem_SetupAllocators("malloc");
|
||||
_PyMem_SetupAllocators("malloc");
|
||||
|
||||
argv_copy = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));
|
||||
argv_copy2 = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));
|
||||
|
@ -848,7 +881,7 @@ main(int argc, char **argv)
|
|||
|
||||
/* Force again malloc() allocator to release memory blocks allocated
|
||||
before Py_Main() */
|
||||
(void)_PyMem_SetupAllocators("malloc");
|
||||
_PyMem_SetupAllocators("malloc");
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
PyMem_RawFree(argv_copy2[i]);
|
||||
|
|
4
third_party/python/Programs/pythontester.c
vendored
4
third_party/python/Programs/pythontester.c
vendored
|
@ -1041,3 +1041,7 @@ STATIC_YOINK(".python/test/xmltestdata/test.xml");
|
|||
STATIC_YOINK(".python/test/xmltestdata/test.xml.out");
|
||||
STATIC_YOINK(".python/test/zip_cp437_header.zip");
|
||||
STATIC_YOINK(".python/test/zipdir.zip");
|
||||
|
||||
void doge(void) {
|
||||
PyErr_Format(PyExc_ValueError, "the doge");
|
||||
}
|
||||
|
|
2
third_party/python/Python/pylifecycle.c
vendored
2
third_party/python/Python/pylifecycle.c
vendored
|
@ -305,7 +305,7 @@ import_init(PyInterpreterState *interp, PyObject *sysmod)
|
|||
Py_DECREF(value);
|
||||
Py_DECREF(impmod);
|
||||
|
||||
/* just add zip!.python/ to sys.path */
|
||||
/* just add /zip/.python/ to sys.path */
|
||||
/* _PyImportZip_Init(); */
|
||||
PyImport_ImportModule("_codecs");
|
||||
PyImport_ImportModule("_collections");
|
||||
|
|
18
third_party/python/README.cosmo
vendored
18
third_party/python/README.cosmo
vendored
|
@ -1,5 +1,17 @@
|
|||
Python 3.6.14 source code downloaded as ZIP from:
|
||||
ORIGIN
|
||||
|
||||
https://github.com/python/cpython/tree/3.6
|
||||
Python 3.6.14
|
||||
https://github.com/python/cpython/tree/3.6
|
||||
0a0a135bae2692d069b18d2d590397fbe0a0d39a
|
||||
|
||||
commit hash: https://github.com/python/cpython/commit/0a0a135bae2692d069b18d2d590397fbe0a0d39a
|
||||
LICENSE
|
||||
|
||||
Python License
|
||||
https://docs.python.org/3/license.html
|
||||
|
||||
LOCAL CHANGES
|
||||
|
||||
- Undiamond #include lines
|
||||
- Support zipos file loading
|
||||
- Make Python binaries work on six operating systems
|
||||
- Have Python REPL copyright() show dependent notices too
|
||||
|
|
2
third_party/python/pycomp.c
vendored
2
third_party/python/pycomp.c
vendored
|
@ -136,7 +136,7 @@ main(int argc, char *argv[])
|
|||
Py_FrozenFlag++;
|
||||
Py_SetProgramName(gc(utf8toutf32(argv[0], -1, 0)));
|
||||
_Py_InitializeEx_Private(1, 0);
|
||||
name = gc(xjoinpaths("zip!.python", StripComponents(inpath, 3)));
|
||||
name = gc(xjoinpaths("/zip/.python", StripComponents(inpath, 3)));
|
||||
code = Py_CompileStringExFlags(p, name, Py_file_input, NULL, optimize);
|
||||
if (!code) goto error;
|
||||
marshalled = PyMarshal_WriteObjectToString(code, Py_MARSHAL_VERSION);
|
||||
|
|
9
third_party/python/pyconfig.h
vendored
9
third_party/python/pyconfig.h
vendored
|
@ -192,7 +192,7 @@
|
|||
/* #undef HAVE_DECL_TZNAME */
|
||||
|
||||
/* Define to 1 if you have the device macros. */
|
||||
/* #undef HAVE_DEVICE_MACROS */
|
||||
#define HAVE_DEVICE_MACROS 1
|
||||
|
||||
/* Define to 1 if you have the /dev/ptc device file. */
|
||||
/* #undef HAVE_DEV_PTC */
|
||||
|
@ -203,9 +203,6 @@
|
|||
/* Define to 1 if the dirent structure has a d_type field */
|
||||
#define HAVE_DIRENT_D_TYPE 1
|
||||
|
||||
/* Define if you have the 'dirfd' function or macro. */
|
||||
#define HAVE_DIRFD 1
|
||||
|
||||
/* Define to 1 if you have the `dlopen' function. */
|
||||
#define HAVE_DLOPEN 1
|
||||
|
||||
|
@ -898,6 +895,8 @@
|
|||
/* Define to 1 if you have the `utimes' function. */
|
||||
#define HAVE_UTIMES 1
|
||||
|
||||
#define HAVE_WAIT 1
|
||||
|
||||
/* Define to 1 if you have the `wait3' function. */
|
||||
#define HAVE_WAIT3 1
|
||||
|
||||
|
@ -986,7 +985,7 @@
|
|||
#define PY_FORMAT_SIZE_T "z"
|
||||
|
||||
/* Define if you want to build an interpreter with many run-time checks. */
|
||||
/* #undef Py_DEBUG */
|
||||
/* #define Py_DEBUG 1 */
|
||||
|
||||
/* Defined if Python is built as a shared library. */
|
||||
/* #undef Py_ENABLE_SHARED */
|
||||
|
|
121
third_party/python/python.mk
vendored
121
third_party/python/python.mk
vendored
|
@ -41,6 +41,14 @@ THIRD_PARTY_PYTHON_STDLIB_PYCS_A = o/$(MODE)/third_party/python/python-stdlib-py
|
|||
THIRD_PARTY_PYTHON_STDLIB_DIRS_A = o/$(MODE)/third_party/python/python-stdlib-dirs.a
|
||||
THIRD_PARTY_PYTHON_STDLIB_DATA_A = o/$(MODE)/third_party/python/python-stdlib-data.a
|
||||
|
||||
THIRD_PARTY_PYTHON_STAGE1_A_OBJS = $(THIRD_PARTY_PYTHON_STAGE1_A_SRCS:%.c=o/$(MODE)/%.o)
|
||||
THIRD_PARTY_PYTHON_STAGE2_A_OBJS = $(THIRD_PARTY_PYTHON_STAGE2_A_SRCS:%.c=o/$(MODE)/%.o)
|
||||
THIRD_PARTY_PYTHON_STDLIB_PYS_OBJS = $(THIRD_PARTY_PYTHON_STDLIB_PYS:%=o/$(MODE)/%.zip.o)
|
||||
THIRD_PARTY_PYTHON_STDLIB_PYCS_OBJS = $(THIRD_PARTY_PYTHON_STDLIB_PYCS:%=%.zip.o)
|
||||
THIRD_PARTY_PYTHON_STDLIB_DIRS_OBJS = $(THIRD_PARTY_PYTHON_STDLIB_DIRS:%=o/$(MODE)/%.zip.o)
|
||||
THIRD_PARTY_PYTHON_STDLIB_DATA_OBJS = $(THIRD_PARTY_PYTHON_STDLIB_DATA:%=o/$(MODE)/%.zip.o)
|
||||
THIRD_PARTY_PYTHON_STDLIB_PYCS = $(THIRD_PARTY_PYTHON_STDLIB_PYS:%=o/$(MODE)/%c)
|
||||
|
||||
THIRD_PARTY_PYTHON_HDRS = \
|
||||
third_party/python/Include/yoink.h \
|
||||
third_party/python/Include/object.h \
|
||||
|
@ -398,6 +406,7 @@ THIRD_PARTY_PYTHON_STAGE1_A_SRCS = \
|
|||
third_party/python/Python/random.c \
|
||||
third_party/python/Python/structmember.c \
|
||||
third_party/python/Python/symtable.c \
|
||||
third_party/python/Parser/listnode.c \
|
||||
third_party/python/Python/sysmodule.c \
|
||||
third_party/python/Python/traceback.c
|
||||
|
||||
|
@ -508,20 +517,19 @@ THIRD_PARTY_PYTHON_STAGE2_A_SRCS = \
|
|||
third_party/python/Modules/unicodedata.c \
|
||||
third_party/python/Modules/zipimport.c \
|
||||
third_party/python/Modules/zlibmodule.c \
|
||||
third_party/python/Objects/accu.c \
|
||||
third_party/python/Objects/unicodetonumeric.c \
|
||||
third_party/python/Objects/weakrefobject.c \
|
||||
third_party/python/Parser/bitset.c \
|
||||
third_party/python/Parser/firstsets.c \
|
||||
third_party/python/Parser/grammar.c \
|
||||
third_party/python/Parser/listnode.c \
|
||||
third_party/python/Parser/metagrammar.c \
|
||||
third_party/python/Parser/pgen.c \
|
||||
third_party/python/Python/dynamic_annotations.c \
|
||||
third_party/python/Python/frozen.c \
|
||||
third_party/python/Python/frozenmain.c \
|
||||
third_party/python/Python/getopt.c \
|
||||
third_party/python/Python/pyfpe.c \
|
||||
third_party/python/Objects/accu.c \
|
||||
third_party/python/Objects/unicodetonumeric.c \
|
||||
third_party/python/Objects/weakrefobject.c \
|
||||
third_party/python/Parser/bitset.c \
|
||||
third_party/python/Parser/firstsets.c \
|
||||
third_party/python/Parser/grammar.c \
|
||||
third_party/python/Parser/metagrammar.c \
|
||||
third_party/python/Parser/pgen.c \
|
||||
third_party/python/Python/dynamic_annotations.c \
|
||||
third_party/python/Python/frozen.c \
|
||||
third_party/python/Python/frozenmain.c \
|
||||
third_party/python/Python/getopt.c \
|
||||
third_party/python/Python/pyfpe.c \
|
||||
third_party/python/Python/sigcheck.c
|
||||
|
||||
THIRD_PARTY_PYTHON_STDLIB_DIRS = \
|
||||
|
@ -565,7 +573,6 @@ THIRD_PARTY_PYTHON_STDLIB_DIRS = \
|
|||
third_party/python/Lib/test/test_email/data/ \
|
||||
third_party/python/Lib/test/sndhdrdata/ \
|
||||
third_party/python/Lib/test/test_asyncio/ \
|
||||
third_party/python/Lib/test/__pycache__/ \
|
||||
third_party/python/Lib/test/audiodata/ \
|
||||
third_party/python/Lib/test/imghdrdata/ \
|
||||
third_party/python/Lib/test/decimaltestdata/ \
|
||||
|
@ -576,12 +583,10 @@ THIRD_PARTY_PYTHON_STDLIB_DIRS = \
|
|||
third_party/python/Lib/test/test_import/data/circular_imports/ \
|
||||
third_party/python/Lib/test/test_import/data/circular_imports/subpkg/ \
|
||||
third_party/python/Lib/test/libregrtest/ \
|
||||
third_party/python/Lib/test/libregrtest/__pycache__/ \
|
||||
third_party/python/Lib/test/leakers/ \
|
||||
third_party/python/Lib/test/test_json/ \
|
||||
third_party/python/Lib/test/eintrdata/ \
|
||||
third_party/python/Lib/test/support/ \
|
||||
third_party/python/Lib/test/support/__pycache__/ \
|
||||
third_party/python/Lib/test/test_importlib/ \
|
||||
third_party/python/Lib/test/test_importlib/extension/ \
|
||||
third_party/python/Lib/test/test_importlib/frozen/ \
|
||||
|
@ -2157,20 +2162,6 @@ THIRD_PARTY_PYTHON_STDLIB_PYS = \
|
|||
third_party/python/Lib/test/test_nntplib.py \
|
||||
third_party/python/Lib/test/test_uu.py
|
||||
|
||||
THIRD_PARTY_PYTHON_STDLIB_PYCS = \
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYS:%=o/$(MODE)/%c)
|
||||
|
||||
THIRD_PARTY_PYTHON_STDLIB_PYS_OBJS = $(THIRD_PARTY_PYTHON_STDLIB_PYS:%=o/$(MODE)/%.zip.o)
|
||||
THIRD_PARTY_PYTHON_STDLIB_PYCS_OBJS = $(THIRD_PARTY_PYTHON_STDLIB_PYCS:%=%.zip.o)
|
||||
THIRD_PARTY_PYTHON_STDLIB_DIRS_OBJS = $(THIRD_PARTY_PYTHON_STDLIB_DIRS:%=o/$(MODE)/%.zip.o)
|
||||
THIRD_PARTY_PYTHON_STDLIB_DATA_OBJS = $(THIRD_PARTY_PYTHON_STDLIB_DATA:%=o/$(MODE)/%.zip.o)
|
||||
|
||||
THIRD_PARTY_PYTHON_STAGE1_A_OBJS = \
|
||||
$(THIRD_PARTY_PYTHON_STAGE1_A_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
THIRD_PARTY_PYTHON_STAGE2_A_OBJS = \
|
||||
$(THIRD_PARTY_PYTHON_STAGE2_A_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
THIRD_PARTY_PYTHON_STAGE1_A_DIRECTDEPS = \
|
||||
LIBC_CALLS \
|
||||
LIBC_FMT \
|
||||
|
@ -2284,14 +2275,10 @@ $(THIRD_PARTY_PYTHON_STAGE2_A): \
|
|||
$(THIRD_PARTY_PYTHON_STAGE2_A).pkg \
|
||||
$(THIRD_PARTY_PYTHON_STAGE2_A_OBJS)
|
||||
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYS_A): \
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYS_OBJS)
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYCS_A): \
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYCS_OBJS)
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DIRS_A): \
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DIRS_OBJS)
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DATA_A): \
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DATA_OBJS)
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYS_A): $(THIRD_PARTY_PYTHON_STDLIB_PYS_OBJS)
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DIRS_A): $(THIRD_PARTY_PYTHON_STDLIB_DIRS_OBJS)
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DATA_A): $(THIRD_PARTY_PYTHON_STDLIB_DATA_OBJS)
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYCS_A): $(THIRD_PARTY_PYTHON_STDLIB_PYCS_OBJS)
|
||||
|
||||
$(THIRD_PARTY_PYTHON_STAGE1_A).pkg: \
|
||||
$(THIRD_PARTY_PYTHON_STAGE1_A_OBJS) \
|
||||
|
@ -2348,25 +2335,14 @@ o/$(MODE)/third_party/python/Modules/faulthandler.o: \
|
|||
OVERRIDE_CFLAGS += \
|
||||
-fno-optimize-sibling-calls
|
||||
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DATA_OBJS): \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-P.python \
|
||||
-C3
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYS_OBJS): ZIPOBJ_FLAGS += -P.python -C3
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DIRS_OBJS): ZIPOBJ_FLAGS += -P.python -C3
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DATA_OBJS): ZIPOBJ_FLAGS += -P.python -C3
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYCS_OBJS): ZIPOBJ_FLAGS += -P.python -C5
|
||||
.PRECIOUS: $(THIRD_PARTY_PYTHON_STDLIB_PYCS_OBJS)
|
||||
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DIRS_OBJS): \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-P.python \
|
||||
-C3
|
||||
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYS_OBJS): \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-P.python \
|
||||
-C3
|
||||
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYCS_OBJS): \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-P.python \
|
||||
-C5
|
||||
o/$(MODE)/third_party/python/Python/ceval.o: QUOTA = -M512m
|
||||
o/$(MODE)/third_party/python/Objects/unicodeobject.o: QUOTA += -C16
|
||||
|
||||
$(THIRD_PARTY_PYTHON_STAGE1_A_OBJS) \
|
||||
$(THIRD_PARTY_PYTHON_STAGE2_A_OBJS): \
|
||||
|
@ -2374,21 +2350,26 @@ $(THIRD_PARTY_PYTHON_STAGE2_A_OBJS): \
|
|||
-ffunction-sections \
|
||||
-fdata-sections
|
||||
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYS_OBJS) \
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_PYCS_OBJS) \
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DIRS_OBJS) \
|
||||
$(THIRD_PARTY_PYTHON_STDLIB_DATA_OBJS) \
|
||||
$(THIRD_PARTY_PYTHON_STAGE1_A_OBJS) \
|
||||
$(THIRD_PARTY_PYTHON_STAGE2_A_OBJS): \
|
||||
THIRD_PARTY_PYTHON_LIBS = \
|
||||
$(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x)))
|
||||
|
||||
THIRD_PARTY_PYTHON_OBJS = \
|
||||
$(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x)_OBJS)) \
|
||||
o/$(MODE)/third_party/python/pycomp.o \
|
||||
o/$(MODE)/third_party/python/Programs/freeze.o \
|
||||
o/$(MODE)/third_party/python/Programs/python.o \
|
||||
o/$(MODE)/third_party/python/Programs/pythontester.o
|
||||
|
||||
THIRD_PARTY_PYTHON_SRCS = \
|
||||
$(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x)_SRCS)) \
|
||||
third_party/python/pycomp.c \
|
||||
third_party/python/Programs/freeze.c \
|
||||
third_party/python/Programs/python.c \
|
||||
third_party/python/Programs/pythontester.c
|
||||
|
||||
$(THIRD_PARTY_PYTHON_OBJS): \
|
||||
third_party/python/python.mk
|
||||
|
||||
o/$(MODE)/third_party/python/Python/ceval.o: QUOTA = -M512m
|
||||
o/$(MODE)/third_party/python/Objects/unicodeobject.o: QUOTA += -C16
|
||||
|
||||
THIRD_PARTY_PYTHON_LIBS = $(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x)))
|
||||
THIRD_PARTY_PYTHON_SRCS = $(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x)_SRCS))
|
||||
THIRD_PARTY_PYTHON_OBJS = $(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x)_OBJS))
|
||||
|
||||
.PHONY: o/$(MODE)/third_party/python
|
||||
o/$(MODE)/third_party/python: \
|
||||
$(THIRD_PARTY_PYTHON_BINS) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue