mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-06 09:50:28 +00:00
minimal changes to os.py
python checks os-based assumptions at startup, some of which can be bypassed since this is Cosmopolitan Python.
This commit is contained in:
parent
9e24f01101
commit
1999f5e3b3
2 changed files with 7 additions and 14 deletions
19
third_party/python/Lib/os.py
vendored
19
third_party/python/Lib/os.py
vendored
|
@ -38,24 +38,15 @@ def _exists(name):
|
|||
return name in globals()
|
||||
|
||||
def _get_exports_list(module):
|
||||
try:
|
||||
return list(module.__all__)
|
||||
except AttributeError:
|
||||
return [n for n in dir(module) if n[0] != '_']
|
||||
return getattr(module, "__all__", (n for n in dir(module) if n[0] != '_'))
|
||||
|
||||
name = 'posix'
|
||||
linesep = '\n'
|
||||
from posix import *
|
||||
try:
|
||||
from posix import _exit
|
||||
__all__.append('_exit')
|
||||
except ImportError:
|
||||
pass
|
||||
from posix import _exit
|
||||
__all__.append('_exit')
|
||||
import posixpath as path
|
||||
try:
|
||||
from posix import _have_functions
|
||||
except ImportError:
|
||||
pass
|
||||
from posix import _have_functions
|
||||
import posix
|
||||
__all__.extend(_get_exports_list(posix))
|
||||
del posix
|
||||
|
@ -67,7 +58,7 @@ from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
|
|||
del _names
|
||||
|
||||
|
||||
if _exists("_have_functions"):
|
||||
if True or _exists("_have_functions"):
|
||||
_globals = globals()
|
||||
def _add(str, fn):
|
||||
if (fn in _globals) and (str in _have_functions):
|
||||
|
|
2
third_party/python/Modules/posixmodule.c
vendored
2
third_party/python/Modules/posixmodule.c
vendored
|
@ -78,6 +78,8 @@
|
|||
|
||||
PYTHON_PROVIDE("posix");
|
||||
PYTHON_PROVIDE("posix._getfinalpathname");
|
||||
PYTHON_PROVIDE("posix._exit");
|
||||
PYTHON_PROVIDE("posix._have_functions");
|
||||
|
||||
/* POSIX module implementation */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue