mirror of https://github.com/python/cpython
Remove support for BeOS
This commit is contained in:
parent
e9af284e99
commit
eb33e5ae79
|
@ -7,7 +7,7 @@
|
|||
|
||||
|
||||
This module provides access to the BSD *socket* interface. It is available on
|
||||
all modern Unix systems, Windows, MacOS, BeOS, OS/2, and probably additional
|
||||
all modern Unix systems, Windows, MacOS, OS/2, and probably additional
|
||||
platforms.
|
||||
|
||||
.. note::
|
||||
|
|
|
@ -500,12 +500,6 @@ in platform-specific #ifdefs.
|
|||
extern int gethostname(char *, int);
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
/* Unchecked */
|
||||
/* It's in the libs, but not the headers... - [cjh] */
|
||||
int shutdown(int, int);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__GETPTY
|
||||
#include <sys/types.h> /* we need to import mode_t */
|
||||
extern char * _getpty(int *, int, mode_t, int);
|
||||
|
@ -577,10 +571,10 @@ extern double hypot(double, double);
|
|||
/*
|
||||
All windows ports, except cygwin, are handled in PC/pyconfig.h.
|
||||
|
||||
BeOS and cygwin are the only other autoconf platform requiring special
|
||||
linkage handling and both of these use __declspec().
|
||||
Cygwin is the only other autoconf platform requiring special
|
||||
linkage handling and it uses __declspec().
|
||||
*/
|
||||
#if defined(__CYGWIN__) || defined(__BEOS__)
|
||||
#if defined(__CYGWIN__)
|
||||
# define HAVE_DECLSPEC_DLL
|
||||
#endif
|
||||
|
||||
|
@ -591,7 +585,7 @@ extern double hypot(double, double);
|
|||
# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
|
||||
# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
|
||||
/* module init functions inside the core need no external linkage */
|
||||
/* except for Cygwin to handle embedding (FIXME: BeOS too?) */
|
||||
/* except for Cygwin to handle embedding */
|
||||
# if defined(__CYGWIN__)
|
||||
# define PyMODINIT_FUNC __declspec(dllexport) void
|
||||
# else /* __CYGWIN__ */
|
||||
|
|
|
@ -394,24 +394,6 @@ def _init_posix():
|
|||
|
||||
g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
|
||||
|
||||
elif sys.platform == 'beos':
|
||||
# Linker script is in the config directory. In the Makefile it is
|
||||
# relative to the srcdir, which after installation no longer makes
|
||||
# sense.
|
||||
python_lib = get_python_lib(standard_lib=1)
|
||||
linkerscript_path = g['LDSHARED'].split()[0]
|
||||
linkerscript_name = os.path.basename(linkerscript_path)
|
||||
linkerscript = os.path.join(python_lib, 'config',
|
||||
linkerscript_name)
|
||||
|
||||
# XXX this isn't the right place to do this: adding the Python
|
||||
# library to the link, if needed, should be in the "build_ext"
|
||||
# command. (It's also needed for non-MS compilers on Windows, and
|
||||
# it's taken care of for them by the 'build_ext.get_libraries()'
|
||||
# method.)
|
||||
g['LDSHARED'] = ("%s -L%s/lib -lpython%s" %
|
||||
(linkerscript, PREFIX, get_python_version()))
|
||||
|
||||
global _config_vars
|
||||
_config_vars = g
|
||||
|
||||
|
|
|
@ -1,327 +0,0 @@
|
|||
# Generated by h2py from /boot/develop/headers/be/net/netinet/in.h
|
||||
|
||||
# Included from socket.h
|
||||
|
||||
# Included from BeBuild.h
|
||||
B_BEOS_VERSION_4 = 0x0400
|
||||
B_BEOS_VERSION_4_5 = 0x0450
|
||||
B_BEOS_VERSION_5 = 0x0500
|
||||
B_BEOS_VERSION = B_BEOS_VERSION_5
|
||||
B_BEOS_VERSION_MAUI = B_BEOS_VERSION_5
|
||||
_PR2_COMPATIBLE_ = 1
|
||||
_PR3_COMPATIBLE_ = 1
|
||||
_R4_COMPATIBLE_ = 1
|
||||
_R4_5_COMPATIBLE_ = 1
|
||||
_PR2_COMPATIBLE_ = 0
|
||||
_PR3_COMPATIBLE_ = 0
|
||||
_R4_COMPATIBLE_ = 1
|
||||
_R4_5_COMPATIBLE_ = 1
|
||||
def _UNUSED(x): return x
|
||||
|
||||
|
||||
# Included from sys/types.h
|
||||
|
||||
# Included from time.h
|
||||
|
||||
# Included from be_setup.h
|
||||
def __std(ref): return ref
|
||||
|
||||
__be_os = 2
|
||||
__dest_os = __be_os
|
||||
__MSL__ = 0x4011
|
||||
__GLIBC__ = -2
|
||||
__GLIBC_MINOR__ = 1
|
||||
|
||||
# Included from null.h
|
||||
NULL = (0)
|
||||
NULL = 0
|
||||
|
||||
# Included from size_t.h
|
||||
|
||||
# Included from stddef.h
|
||||
|
||||
# Included from wchar_t.h
|
||||
CLOCKS_PER_SEC = 1000
|
||||
CLK_TCK = CLOCKS_PER_SEC
|
||||
MAX_TIMESTR = 70
|
||||
|
||||
# Included from sys/time.h
|
||||
|
||||
# Included from ByteOrder.h
|
||||
|
||||
# Included from endian.h
|
||||
__LITTLE_ENDIAN = 1234
|
||||
LITTLE_ENDIAN = __LITTLE_ENDIAN
|
||||
__BYTE_ORDER = __LITTLE_ENDIAN
|
||||
BYTE_ORDER = __BYTE_ORDER
|
||||
__BIG_ENDIAN = 0
|
||||
BIG_ENDIAN = 0
|
||||
__BIG_ENDIAN = 4321
|
||||
BIG_ENDIAN = __BIG_ENDIAN
|
||||
__BYTE_ORDER = __BIG_ENDIAN
|
||||
BYTE_ORDER = __BYTE_ORDER
|
||||
__LITTLE_ENDIAN = 0
|
||||
LITTLE_ENDIAN = 0
|
||||
__PDP_ENDIAN = 3412
|
||||
PDP_ENDIAN = __PDP_ENDIAN
|
||||
|
||||
# Included from SupportDefs.h
|
||||
|
||||
# Included from Errors.h
|
||||
|
||||
# Included from limits.h
|
||||
|
||||
# Included from float.h
|
||||
FLT_ROUNDS = 1
|
||||
FLT_RADIX = 2
|
||||
FLT_MANT_DIG = 24
|
||||
FLT_DIG = 6
|
||||
FLT_MIN_EXP = (-125)
|
||||
FLT_MIN_10_EXP = (-37)
|
||||
FLT_MAX_EXP = 128
|
||||
FLT_MAX_10_EXP = 38
|
||||
DBL_MANT_DIG = 53
|
||||
DBL_DIG = 15
|
||||
DBL_MIN_EXP = (-1021)
|
||||
DBL_MIN_10_EXP = (-308)
|
||||
DBL_MAX_EXP = 1024
|
||||
DBL_MAX_10_EXP = 308
|
||||
LDBL_MANT_DIG = DBL_MANT_DIG
|
||||
LDBL_DIG = DBL_DIG
|
||||
LDBL_MIN_EXP = DBL_MIN_EXP
|
||||
LDBL_MIN_10_EXP = DBL_MIN_10_EXP
|
||||
LDBL_MAX_EXP = DBL_MAX_EXP
|
||||
LDBL_MAX_10_EXP = DBL_MAX_10_EXP
|
||||
CHAR_BIT = (8)
|
||||
SCHAR_MIN = (-127-1)
|
||||
SCHAR_MAX = (127)
|
||||
CHAR_MIN = SCHAR_MIN
|
||||
CHAR_MAX = SCHAR_MAX
|
||||
MB_LEN_MAX = (1)
|
||||
SHRT_MIN = (-32767-1)
|
||||
SHRT_MAX = (32767)
|
||||
LONG_MIN = (-2147483647-1)
|
||||
LONG_MAX = (2147483647)
|
||||
INT_MIN = LONG_MIN
|
||||
INT_MAX = LONG_MAX
|
||||
ARG_MAX = (32768)
|
||||
ATEXIT_MAX = (32)
|
||||
CHILD_MAX = (1024)
|
||||
IOV_MAX = (256)
|
||||
FILESIZEBITS = (64)
|
||||
LINK_MAX = (1)
|
||||
LOGIN_NAME_MAX = (32)
|
||||
MAX_CANON = (255)
|
||||
MAX_INPUT = (255)
|
||||
NAME_MAX = (256)
|
||||
NGROUPS_MAX = (32)
|
||||
OPEN_MAX = (128)
|
||||
PATH_MAX = (1024)
|
||||
PIPE_MAX = (512)
|
||||
SSIZE_MAX = (2147483647)
|
||||
TTY_NAME_MAX = (256)
|
||||
TZNAME_MAX = (32)
|
||||
SYMLINKS_MAX = (16)
|
||||
_POSIX_ARG_MAX = (32768)
|
||||
_POSIX_CHILD_MAX = (1024)
|
||||
_POSIX_LINK_MAX = (1)
|
||||
_POSIX_LOGIN_NAME_MAX = (9)
|
||||
_POSIX_MAX_CANON = (255)
|
||||
_POSIX_MAX_INPUT = (255)
|
||||
_POSIX_NAME_MAX = (255)
|
||||
_POSIX_NGROUPS_MAX = (0)
|
||||
_POSIX_OPEN_MAX = (128)
|
||||
_POSIX_PATH_MAX = (1024)
|
||||
_POSIX_PIPE_BUF = (512)
|
||||
_POSIX_SSIZE_MAX = (2147483647)
|
||||
_POSIX_STREAM_MAX = (8)
|
||||
_POSIX_TTY_NAME_MAX = (256)
|
||||
_POSIX_TZNAME_MAX = (3)
|
||||
B_GENERAL_ERROR_BASE = LONG_MIN
|
||||
B_OS_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x1000
|
||||
B_APP_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x2000
|
||||
B_INTERFACE_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x3000
|
||||
B_MEDIA_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x4000
|
||||
B_TRANSLATION_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x4800
|
||||
B_MIDI_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x5000
|
||||
B_STORAGE_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x6000
|
||||
B_POSIX_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x7000
|
||||
B_MAIL_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x8000
|
||||
B_PRINT_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x9000
|
||||
B_DEVICE_ERROR_BASE = B_GENERAL_ERROR_BASE + 0xa000
|
||||
B_ERRORS_END = (B_GENERAL_ERROR_BASE + 0xffff)
|
||||
E2BIG = (B_POSIX_ERROR_BASE + 1)
|
||||
ECHILD = (B_POSIX_ERROR_BASE + 2)
|
||||
EDEADLK = (B_POSIX_ERROR_BASE + 3)
|
||||
EFBIG = (B_POSIX_ERROR_BASE + 4)
|
||||
EMLINK = (B_POSIX_ERROR_BASE + 5)
|
||||
ENFILE = (B_POSIX_ERROR_BASE + 6)
|
||||
ENODEV = (B_POSIX_ERROR_BASE + 7)
|
||||
ENOLCK = (B_POSIX_ERROR_BASE + 8)
|
||||
ENOSYS = (B_POSIX_ERROR_BASE + 9)
|
||||
ENOTTY = (B_POSIX_ERROR_BASE + 10)
|
||||
ENXIO = (B_POSIX_ERROR_BASE + 11)
|
||||
ESPIPE = (B_POSIX_ERROR_BASE + 12)
|
||||
ESRCH = (B_POSIX_ERROR_BASE + 13)
|
||||
EFPOS = (B_POSIX_ERROR_BASE + 14)
|
||||
ESIGPARM = (B_POSIX_ERROR_BASE + 15)
|
||||
EDOM = (B_POSIX_ERROR_BASE + 16)
|
||||
ERANGE = (B_POSIX_ERROR_BASE + 17)
|
||||
EPROTOTYPE = (B_POSIX_ERROR_BASE + 18)
|
||||
EPROTONOSUPPORT = (B_POSIX_ERROR_BASE + 19)
|
||||
EPFNOSUPPORT = (B_POSIX_ERROR_BASE + 20)
|
||||
EAFNOSUPPORT = (B_POSIX_ERROR_BASE + 21)
|
||||
EADDRINUSE = (B_POSIX_ERROR_BASE + 22)
|
||||
EADDRNOTAVAIL = (B_POSIX_ERROR_BASE + 23)
|
||||
ENETDOWN = (B_POSIX_ERROR_BASE + 24)
|
||||
ENETUNREACH = (B_POSIX_ERROR_BASE + 25)
|
||||
ENETRESET = (B_POSIX_ERROR_BASE + 26)
|
||||
ECONNABORTED = (B_POSIX_ERROR_BASE + 27)
|
||||
ECONNRESET = (B_POSIX_ERROR_BASE + 28)
|
||||
EISCONN = (B_POSIX_ERROR_BASE + 29)
|
||||
ENOTCONN = (B_POSIX_ERROR_BASE + 30)
|
||||
ESHUTDOWN = (B_POSIX_ERROR_BASE + 31)
|
||||
ECONNREFUSED = (B_POSIX_ERROR_BASE + 32)
|
||||
EHOSTUNREACH = (B_POSIX_ERROR_BASE + 33)
|
||||
ENOPROTOOPT = (B_POSIX_ERROR_BASE + 34)
|
||||
ENOBUFS = (B_POSIX_ERROR_BASE + 35)
|
||||
EINPROGRESS = (B_POSIX_ERROR_BASE + 36)
|
||||
EALREADY = (B_POSIX_ERROR_BASE + 37)
|
||||
EILSEQ = (B_POSIX_ERROR_BASE + 38)
|
||||
ENOMSG = (B_POSIX_ERROR_BASE + 39)
|
||||
ESTALE = (B_POSIX_ERROR_BASE + 40)
|
||||
EOVERFLOW = (B_POSIX_ERROR_BASE + 41)
|
||||
EMSGSIZE = (B_POSIX_ERROR_BASE + 42)
|
||||
EOPNOTSUPP = (B_POSIX_ERROR_BASE + 43)
|
||||
ENOTSOCK = (B_POSIX_ERROR_BASE + 44)
|
||||
false = 0
|
||||
true = 1
|
||||
NULL = (0)
|
||||
FALSE = 0
|
||||
TRUE = 1
|
||||
|
||||
# Included from TypeConstants.h
|
||||
B_HOST_IS_LENDIAN = 1
|
||||
B_HOST_IS_BENDIAN = 0
|
||||
def B_HOST_TO_LENDIAN_DOUBLE(arg): return (double)(arg)
|
||||
|
||||
def B_HOST_TO_LENDIAN_FLOAT(arg): return (float)(arg)
|
||||
|
||||
def B_HOST_TO_LENDIAN_INT64(arg): return (uint64)(arg)
|
||||
|
||||
def B_HOST_TO_LENDIAN_INT32(arg): return (uint32)(arg)
|
||||
|
||||
def B_HOST_TO_LENDIAN_INT16(arg): return (uint16)(arg)
|
||||
|
||||
def B_HOST_TO_BENDIAN_DOUBLE(arg): return __swap_double(arg)
|
||||
|
||||
def B_HOST_TO_BENDIAN_FLOAT(arg): return __swap_float(arg)
|
||||
|
||||
def B_HOST_TO_BENDIAN_INT64(arg): return __swap_int64(arg)
|
||||
|
||||
def B_HOST_TO_BENDIAN_INT32(arg): return __swap_int32(arg)
|
||||
|
||||
def B_HOST_TO_BENDIAN_INT16(arg): return __swap_int16(arg)
|
||||
|
||||
def B_LENDIAN_TO_HOST_DOUBLE(arg): return (double)(arg)
|
||||
|
||||
def B_LENDIAN_TO_HOST_FLOAT(arg): return (float)(arg)
|
||||
|
||||
def B_LENDIAN_TO_HOST_INT64(arg): return (uint64)(arg)
|
||||
|
||||
def B_LENDIAN_TO_HOST_INT32(arg): return (uint32)(arg)
|
||||
|
||||
def B_LENDIAN_TO_HOST_INT16(arg): return (uint16)(arg)
|
||||
|
||||
def B_BENDIAN_TO_HOST_DOUBLE(arg): return __swap_double(arg)
|
||||
|
||||
def B_BENDIAN_TO_HOST_FLOAT(arg): return __swap_float(arg)
|
||||
|
||||
def B_BENDIAN_TO_HOST_INT64(arg): return __swap_int64(arg)
|
||||
|
||||
def B_BENDIAN_TO_HOST_INT32(arg): return __swap_int32(arg)
|
||||
|
||||
def B_BENDIAN_TO_HOST_INT16(arg): return __swap_int16(arg)
|
||||
|
||||
B_HOST_IS_LENDIAN = 0
|
||||
B_HOST_IS_BENDIAN = 1
|
||||
def B_HOST_TO_LENDIAN_DOUBLE(arg): return __swap_double(arg)
|
||||
|
||||
def B_HOST_TO_LENDIAN_FLOAT(arg): return __swap_float(arg)
|
||||
|
||||
def B_HOST_TO_LENDIAN_INT64(arg): return __swap_int64(arg)
|
||||
|
||||
def B_HOST_TO_LENDIAN_INT32(arg): return __swap_int32(arg)
|
||||
|
||||
def B_HOST_TO_LENDIAN_INT16(arg): return __swap_int16(arg)
|
||||
|
||||
def B_HOST_TO_BENDIAN_DOUBLE(arg): return (double)(arg)
|
||||
|
||||
def B_HOST_TO_BENDIAN_FLOAT(arg): return (float)(arg)
|
||||
|
||||
def B_HOST_TO_BENDIAN_INT64(arg): return (uint64)(arg)
|
||||
|
||||
def B_HOST_TO_BENDIAN_INT32(arg): return (uint32)(arg)
|
||||
|
||||
def B_HOST_TO_BENDIAN_INT16(arg): return (uint16)(arg)
|
||||
|
||||
def B_LENDIAN_TO_HOST_DOUBLE(arg): return __swap_double(arg)
|
||||
|
||||
def B_LENDIAN_TO_HOST_FLOAT(arg): return __swap_float(arg)
|
||||
|
||||
def B_LENDIAN_TO_HOST_INT64(arg): return __swap_int64(arg)
|
||||
|
||||
def B_LENDIAN_TO_HOST_INT32(arg): return __swap_int32(arg)
|
||||
|
||||
def B_LENDIAN_TO_HOST_INT16(arg): return __swap_int16(arg)
|
||||
|
||||
def B_BENDIAN_TO_HOST_DOUBLE(arg): return (double)(arg)
|
||||
|
||||
def B_BENDIAN_TO_HOST_FLOAT(arg): return (float)(arg)
|
||||
|
||||
def B_BENDIAN_TO_HOST_INT64(arg): return (uint64)(arg)
|
||||
|
||||
def B_BENDIAN_TO_HOST_INT32(arg): return (uint32)(arg)
|
||||
|
||||
def B_BENDIAN_TO_HOST_INT16(arg): return (uint16)(arg)
|
||||
|
||||
def B_SWAP_DOUBLE(arg): return __swap_double(arg)
|
||||
|
||||
def B_SWAP_FLOAT(arg): return __swap_float(arg)
|
||||
|
||||
def B_SWAP_INT64(arg): return __swap_int64(arg)
|
||||
|
||||
def B_SWAP_INT32(arg): return __swap_int32(arg)
|
||||
|
||||
def B_SWAP_INT16(arg): return __swap_int16(arg)
|
||||
|
||||
def htonl(x): return B_HOST_TO_BENDIAN_INT32(x)
|
||||
|
||||
def ntohl(x): return B_BENDIAN_TO_HOST_INT32(x)
|
||||
|
||||
def htons(x): return B_HOST_TO_BENDIAN_INT16(x)
|
||||
|
||||
def ntohs(x): return B_BENDIAN_TO_HOST_INT16(x)
|
||||
|
||||
AF_INET = 1
|
||||
INADDR_ANY = 0x00000000
|
||||
INADDR_BROADCAST = 0xffffffff
|
||||
INADDR_LOOPBACK = 0x7f000001
|
||||
SOL_SOCKET = 1
|
||||
SO_DEBUG = 1
|
||||
SO_REUSEADDR = 2
|
||||
SO_NONBLOCK = 3
|
||||
SO_REUSEPORT = 4
|
||||
MSG_OOB = 0x1
|
||||
SOCK_DGRAM = 1
|
||||
SOCK_STREAM = 2
|
||||
IPPROTO_UDP = 1
|
||||
IPPROTO_TCP = 2
|
||||
IPPROTO_ICMP = 3
|
||||
B_UDP_MAX_SIZE = (65536 - 1024)
|
||||
FD_SETSIZE = 256
|
||||
FDSETSIZE = FD_SETSIZE
|
||||
NFDBITS = 32
|
||||
def _FDMSKNO(fd): return ((fd) / NFDBITS)
|
||||
|
||||
def _FDBITNO(fd): return ((fd) % NFDBITS)
|
|
@ -1,7 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
H2PY=../../Tools/scripts/h2py.py
|
||||
HEADERS=/boot/develop/headers
|
||||
|
||||
set -v
|
||||
python $H2PY -i '(u_long)' $HEADERS/be/net/netinet/in.h
|
|
@ -7,9 +7,6 @@ child after a fork().
|
|||
|
||||
On some systems (e.g. Solaris without posix threads) we find that all
|
||||
active threads survive in the child after a fork(); this is an error.
|
||||
|
||||
While BeOS doesn't officially support fork and native threading in
|
||||
the same application, the present example should work just fine. DC
|
||||
"""
|
||||
|
||||
import os, sys, time, thread, unittest
|
||||
|
|
|
@ -875,17 +875,6 @@ libainstall: all
|
|||
echo; echo "See Misc/AIX-NOTES for details."; \
|
||||
else true; \
|
||||
fi
|
||||
@case "$(MACHDEP)" in beos*) \
|
||||
echo; echo "Installing support files for building shared extension modules on BeOS:"; \
|
||||
$(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
|
||||
echo; echo "$(LIBPL)/README"; \
|
||||
$(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
|
||||
echo "$(LIBPL)/ar_beos"; \
|
||||
$(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
|
||||
echo "$(LIBPL)/ld_so_beos"; \
|
||||
echo; echo "See Misc/BeOS-NOTES for details."; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
# Install the dynamically loadable modules
|
||||
# This goes into $(exec_prefix)
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
Python for BeOS R5
|
||||
|
||||
In Python-2.1, the standard version of the new setup.py program
|
||||
will not build the full complement of modules on BeOS. Instead,
|
||||
please replace it with the special BeOS version in Misc/BeOS-setup.py.
|
||||
|
||||
To build,
|
||||
|
||||
1) cp Misc/BeOS-setup.py setup.py
|
||||
2) ./configure --prefix=/boot/home/config
|
||||
3) make
|
||||
|
||||
The modules will all build, except termios which assumes some flags
|
||||
we don't have. Put a libreadline.a in /boot/home/config/lib to get
|
||||
a readline.so for your interactive editing convenience; NB, not
|
||||
libreadline.so, you want to link a static readline library into the
|
||||
dynamically loaded Python module.
|
||||
|
||||
Test:
|
||||
|
||||
make test
|
||||
|
||||
The BeOS is Not UNIX category:
|
||||
- test_select crashed -- select.error : (-2147459072, 'Bad file descriptor')
|
||||
- test_socket crashed -- exceptions.AttributeError : SOCK_RAW
|
||||
- test_fcntl crashed -- exceptions.IOError: [Errno -2147483643] Invalid argument
|
||||
|
||||
This one is funny! BeOS does support large files, and that's why
|
||||
we get this error: the file is too big for my filesystem!
|
||||
- test_largefile crashed -- exceptions.IOError: [Errno -2147459065]
|
||||
No space left on device
|
||||
|
||||
- test_pickle crashed. This is apparently a serious problem, "complex"
|
||||
number objects reconstructed from a pickle don't compare equal to
|
||||
their ancestors. But it happens on BeOS PPC only, not Intel.
|
||||
|
||||
Install:
|
||||
|
||||
make install
|
||||
|
||||
|
||||
Maintainer: Mikael Jansson (mail at mikael.jansson.be)
|
|
@ -1,547 +0,0 @@
|
|||
# Autodetecting setup.py script for building the Python extensions
|
||||
#
|
||||
# Modified for BeOS build. Donn Cave, March 27 2001.
|
||||
|
||||
__version__ = "special BeOS after 1.37"
|
||||
|
||||
import sys, os, getopt
|
||||
from distutils import sysconfig
|
||||
from distutils import text_file
|
||||
from distutils.errors import *
|
||||
from distutils.core import Extension, setup
|
||||
from distutils.command.build_ext import build_ext
|
||||
|
||||
# This global variable is used to hold the list of modules to be disabled.
|
||||
disabled_module_list = ['dbm', 'mmap', 'resource', 'nis']
|
||||
|
||||
def find_file(filename, std_dirs, paths):
|
||||
"""Searches for the directory where a given file is located,
|
||||
and returns a possibly-empty list of additional directories, or None
|
||||
if the file couldn't be found at all.
|
||||
|
||||
'filename' is the name of a file, such as readline.h or libcrypto.a.
|
||||
'std_dirs' is the list of standard system directories; if the
|
||||
file is found in one of them, no additional directives are needed.
|
||||
'paths' is a list of additional locations to check; if the file is
|
||||
found in one of them, the resulting list will contain the directory.
|
||||
"""
|
||||
|
||||
# Check the standard locations
|
||||
for dir in std_dirs:
|
||||
f = os.path.join(dir, filename)
|
||||
if os.path.exists(f): return []
|
||||
|
||||
# Check the additional directories
|
||||
for dir in paths:
|
||||
f = os.path.join(dir, filename)
|
||||
if os.path.exists(f):
|
||||
return [dir]
|
||||
|
||||
# Not found anywhere
|
||||
return None
|
||||
|
||||
def find_library_file(compiler, libname, std_dirs, paths):
|
||||
filename = compiler.library_filename(libname, lib_type='shared')
|
||||
result = find_file(filename, std_dirs, paths)
|
||||
if result is not None: return result
|
||||
|
||||
filename = compiler.library_filename(libname, lib_type='static')
|
||||
result = find_file(filename, std_dirs, paths)
|
||||
return result
|
||||
|
||||
def module_enabled(extlist, modname):
|
||||
"""Returns whether the module 'modname' is present in the list
|
||||
of extensions 'extlist'."""
|
||||
extlist = [ext for ext in extlist if ext.name == modname]
|
||||
return len(extlist)
|
||||
|
||||
class PyBuildExt(build_ext):
|
||||
|
||||
def build_extensions(self):
|
||||
|
||||
# Detect which modules should be compiled
|
||||
self.detect_modules()
|
||||
|
||||
# Remove modules that are present on the disabled list
|
||||
self.extensions = [ext for ext in self.extensions
|
||||
if ext.name not in disabled_module_list]
|
||||
|
||||
# Fix up the autodetected modules, prefixing all the source files
|
||||
# with Modules/ and adding Python's include directory to the path.
|
||||
(srcdir,) = sysconfig.get_config_vars('srcdir')
|
||||
|
||||
# Figure out the location of the source code for extension modules
|
||||
moddir = os.path.join(os.getcwd(), srcdir, 'Modules')
|
||||
moddir = os.path.normpath(moddir)
|
||||
srcdir, tail = os.path.split(moddir)
|
||||
srcdir = os.path.normpath(srcdir)
|
||||
moddir = os.path.normpath(moddir)
|
||||
|
||||
# Fix up the paths for scripts, too
|
||||
self.distribution.scripts = [os.path.join(srcdir, filename)
|
||||
for filename in self.distribution.scripts]
|
||||
|
||||
for ext in self.extensions[:]:
|
||||
ext.sources = [ os.path.join(moddir, filename)
|
||||
for filename in ext.sources ]
|
||||
ext.include_dirs.append( '.' ) # to get config.h
|
||||
ext.include_dirs.append( os.path.join(srcdir, './Include') )
|
||||
|
||||
# If a module has already been built statically,
|
||||
# don't build it here
|
||||
if ext.name in sys.builtin_module_names:
|
||||
self.extensions.remove(ext)
|
||||
|
||||
# Parse Modules/Setup to figure out which modules are turned
|
||||
# on in the file.
|
||||
input = text_file.TextFile('Modules/Setup', join_lines=1)
|
||||
remove_modules = []
|
||||
while 1:
|
||||
line = input.readline()
|
||||
if not line: break
|
||||
line = line.split()
|
||||
remove_modules.append( line[0] )
|
||||
input.close()
|
||||
|
||||
for ext in self.extensions[:]:
|
||||
if ext.name in remove_modules:
|
||||
self.extensions.remove(ext)
|
||||
|
||||
# When you run "make CC=altcc" or something similar, you really want
|
||||
# those environment variables passed into the setup.py phase. Here's
|
||||
# a small set of useful ones.
|
||||
compiler = os.environ.get('CC')
|
||||
linker_so = os.environ.get('LDSHARED')
|
||||
args = {}
|
||||
# unfortunately, distutils doesn't let us provide separate C and C++
|
||||
# compilers
|
||||
if compiler is not None:
|
||||
args['compiler_so'] = compiler
|
||||
if linker_so is not None:
|
||||
args['linker_so'] = linker_so + ' -shared'
|
||||
self.compiler.set_executables(**args)
|
||||
|
||||
build_ext.build_extensions(self)
|
||||
|
||||
def build_extension(self, ext):
|
||||
|
||||
try:
|
||||
build_ext.build_extension(self, ext)
|
||||
except (CCompilerError, DistutilsError) as why:
|
||||
self.announce('WARNING: building of extension "%s" failed: %s' %
|
||||
(ext.name, sys.exc_info()[1]))
|
||||
|
||||
def get_platform (self):
|
||||
# Get value of sys.platform
|
||||
platform = sys.platform
|
||||
if platform[:6] =='cygwin':
|
||||
platform = 'cygwin'
|
||||
elif platform[:4] =='beos':
|
||||
platform = 'beos'
|
||||
|
||||
return platform
|
||||
|
||||
def detect_modules(self):
|
||||
try:
|
||||
belibs = os.environ['BELIBRARIES'].split(';')
|
||||
except KeyError:
|
||||
belibs = ['/boot/beos/system/lib']
|
||||
belibs.append('/boot/home/config/lib')
|
||||
self.compiler.library_dirs.append('/boot/home/config/lib')
|
||||
try:
|
||||
beincl = os.environ['BEINCLUDES'].split(';')
|
||||
except KeyError:
|
||||
beincl = []
|
||||
beincl.append('/boot/home/config/include')
|
||||
self.compiler.include_dirs.append('/boot/home/config/include')
|
||||
# lib_dirs and inc_dirs are used to search for files;
|
||||
# if a file is found in one of those directories, it can
|
||||
# be assumed that no additional -I,-L directives are needed.
|
||||
lib_dirs = belibs
|
||||
inc_dirs = beincl
|
||||
exts = []
|
||||
|
||||
platform = self.get_platform()
|
||||
|
||||
# Check for MacOS X, which doesn't need libm.a at all
|
||||
math_libs = ['m']
|
||||
if platform in ['Darwin1.2', 'beos']:
|
||||
math_libs = []
|
||||
|
||||
#
|
||||
# The following modules are all pretty straightforward, and compile
|
||||
# on pretty much any POSIXish platform.
|
||||
#
|
||||
|
||||
# Some modules that are normally always on:
|
||||
exts.append( Extension('_weakref', ['_weakref.c']) )
|
||||
exts.append( Extension('_symtable', ['symtablemodule.c']) )
|
||||
|
||||
# array objects
|
||||
exts.append( Extension('array', ['arraymodule.c']) )
|
||||
# complex math library functions
|
||||
exts.append( Extension('cmath', ['cmathmodule.c'],
|
||||
libraries=math_libs) )
|
||||
|
||||
# math library functions, e.g. sin()
|
||||
exts.append( Extension('math', ['mathmodule.c'],
|
||||
libraries=math_libs) )
|
||||
# time operations and variables
|
||||
exts.append( Extension('time', ['timemodule.c'],
|
||||
libraries=math_libs) )
|
||||
# operator.add() and similar goodies
|
||||
exts.append( Extension('operator', ['operator.c']) )
|
||||
# access to the builtin codecs and codec registry
|
||||
exts.append( Extension('_codecs', ['_codecsmodule.c']) )
|
||||
# Python C API test module
|
||||
exts.append( Extension('_testcapi', ['_testcapimodule.c']) )
|
||||
# static Unicode character database
|
||||
exts.append( Extension('unicodedata', ['unicodedata.c']) )
|
||||
# access to ISO C locale support
|
||||
exts.append( Extension('_locale', ['_localemodule.c']) )
|
||||
|
||||
# Modules with some UNIX dependencies -- on by default:
|
||||
# (If you have a really backward UNIX, select and socket may not be
|
||||
# supported...)
|
||||
|
||||
# fcntl(2) and ioctl(2)
|
||||
exts.append( Extension('fcntl', ['fcntlmodule.c']) )
|
||||
# pwd(3)
|
||||
exts.append( Extension('pwd', ['pwdmodule.c']) )
|
||||
# grp(3)
|
||||
exts.append( Extension('grp', ['grpmodule.c']) )
|
||||
# posix (UNIX) errno values
|
||||
exts.append( Extension('errno', ['errnomodule.c']) )
|
||||
# select(2); not on ancient System V
|
||||
exts.append( Extension('select', ['selectmodule.c']) )
|
||||
|
||||
# The md5 module implements the RSA Data Security, Inc. MD5
|
||||
# Message-Digest Algorithm, described in RFC 1321. The necessary files
|
||||
# md5c.c and md5.h are included here.
|
||||
exts.append( Extension('md5', ['md5module.c', 'md5c.c']) )
|
||||
|
||||
# The sha module implements the SHA checksum algorithm.
|
||||
# (NIST's Secure Hash Algorithm.)
|
||||
exts.append( Extension('sha', ['shamodule.c']) )
|
||||
|
||||
# Helper module for various ascii-encoders
|
||||
exts.append( Extension('binascii', ['binascii.c']) )
|
||||
|
||||
# Fred Drake's interface to the Python parser
|
||||
exts.append( Extension('parser', ['parsermodule.c']) )
|
||||
|
||||
# Memory-mapped files (also works on Win32).
|
||||
exts.append( Extension('mmap', ['mmapmodule.c']) )
|
||||
|
||||
# Lance Ellinghaus's syslog daemon interface
|
||||
exts.append( Extension('syslog', ['syslogmodule.c']) )
|
||||
|
||||
#
|
||||
# Here ends the simple stuff. From here on, modules need certain
|
||||
# libraries, are platform-specific, or present other surprises.
|
||||
#
|
||||
|
||||
# Multimedia modules
|
||||
# These don't work for 64-bit platforms!!!
|
||||
# These represent audio samples or images as strings:
|
||||
|
||||
# Disabled on 64-bit platforms
|
||||
if sys.maxint != 9223372036854775807L:
|
||||
# Operations on audio samples
|
||||
exts.append( Extension('audioop', ['audioop.c']) )
|
||||
# Operations on images
|
||||
exts.append( Extension('imageop', ['imageop.c']) )
|
||||
# Read SGI RGB image files (but coded portably)
|
||||
exts.append( Extension('rgbimg', ['rgbimgmodule.c']) )
|
||||
|
||||
# readline
|
||||
if self.compiler.find_library_file(lib_dirs, 'readline'):
|
||||
readline_libs = ['readline']
|
||||
if self.compiler.find_library_file(lib_dirs +
|
||||
['/usr/lib/termcap'],
|
||||
'termcap'):
|
||||
readline_libs.append('termcap')
|
||||
exts.append( Extension('readline', ['readline.c'],
|
||||
library_dirs=['/usr/lib/termcap'],
|
||||
libraries=readline_libs) )
|
||||
|
||||
# The crypt module is now disabled by default because it breaks builds
|
||||
# on many systems (where -lcrypt is needed), e.g. Linux (I believe).
|
||||
|
||||
if self.compiler.find_library_file(lib_dirs, 'crypt'):
|
||||
libs = ['crypt']
|
||||
else:
|
||||
libs = []
|
||||
exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) )
|
||||
|
||||
# socket(2)
|
||||
# Detect SSL support for the socket module
|
||||
ssl_incs = find_file('openssl/ssl.h', inc_dirs,
|
||||
['/usr/local/ssl/include',
|
||||
'/usr/contrib/ssl/include/'
|
||||
]
|
||||
)
|
||||
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
|
||||
['/usr/local/ssl/lib',
|
||||
'/usr/contrib/ssl/lib/'
|
||||
] )
|
||||
|
||||
if (ssl_incs is not None and
|
||||
ssl_libs is not None):
|
||||
exts.append( Extension('_socket', ['socketmodule.c'],
|
||||
include_dirs = ssl_incs,
|
||||
library_dirs = ssl_libs,
|
||||
libraries = ['ssl', 'crypto'],
|
||||
define_macros = [('USE_SSL',1)] ) )
|
||||
else:
|
||||
exts.append( Extension('_socket', ['socketmodule.c']) )
|
||||
|
||||
# Modules that provide persistent dictionary-like semantics. You will
|
||||
# probably want to arrange for at least one of them to be available on
|
||||
# your machine, though none are defined by default because of library
|
||||
# dependencies. The Python module anydbm.py provides an
|
||||
# implementation independent wrapper for these; dumbdbm.py provides
|
||||
# similar functionality (but slower of course) implemented in Python.
|
||||
|
||||
# The standard Unix dbm module:
|
||||
if platform not in ['cygwin']:
|
||||
if (self.compiler.find_library_file(lib_dirs, 'ndbm')):
|
||||
exts.append( Extension('dbm', ['dbmmodule.c'],
|
||||
libraries = ['ndbm'] ) )
|
||||
else:
|
||||
exts.append( Extension('dbm', ['dbmmodule.c']) )
|
||||
|
||||
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
|
||||
if (self.compiler.find_library_file(lib_dirs, 'gdbm')):
|
||||
exts.append( Extension('gdbm', ['gdbmmodule.c'],
|
||||
libraries = ['gdbm'] ) )
|
||||
|
||||
# Berkeley DB interface.
|
||||
#
|
||||
# This requires the Berkeley DB code, see
|
||||
# ftp://ftp.cs.berkeley.edu/pub/4bsd/db.1.85.tar.gz
|
||||
#
|
||||
# Edit the variables DB and DBPORT to point to the db top directory
|
||||
# and the subdirectory of PORT where you built it.
|
||||
#
|
||||
# (See http://electricrain.com/greg/python/bsddb3/ for an interface to
|
||||
# BSD DB 3.x.)
|
||||
|
||||
dblib = []
|
||||
if self.compiler.find_library_file(lib_dirs, 'db'):
|
||||
dblib = ['db']
|
||||
|
||||
db_inc = find_file('db.h', inc_dirs, ['/usr/include/db1'])
|
||||
db_inc is not None:
|
||||
exts.append( Extension('bsddb', ['bsddbmodule.c'],
|
||||
include_dirs = db_inc,
|
||||
libraries = dblib) )
|
||||
|
||||
# Unix-only modules
|
||||
if platform not in ['mac', 'win32']:
|
||||
# Steen Lumholt's termios module
|
||||
exts.append( Extension('termios', ['termios.c']) )
|
||||
# Jeremy Hylton's rlimit interface
|
||||
if platform not in ['cygwin']:
|
||||
exts.append( Extension('resource', ['resource.c']) )
|
||||
|
||||
# Generic dynamic loading module
|
||||
#exts.append( Extension('dl', ['dlmodule.c']) )
|
||||
|
||||
# Sun yellow pages. Some systems have the functions in libc.
|
||||
if platform not in ['cygwin']:
|
||||
if (self.compiler.find_library_file(lib_dirs, 'nsl')):
|
||||
libs = ['nsl']
|
||||
else:
|
||||
libs = []
|
||||
exts.append( Extension('nis', ['nismodule.c'],
|
||||
libraries = libs) )
|
||||
|
||||
# Curses support, requring the System V version of curses, often
|
||||
# provided by the ncurses library.
|
||||
if (self.compiler.find_library_file(lib_dirs, 'ncurses')):
|
||||
curses_libs = ['ncurses']
|
||||
exts.append( Extension('_curses', ['_cursesmodule.c'],
|
||||
libraries = curses_libs) )
|
||||
elif (self.compiler.find_library_file(lib_dirs, 'curses')):
|
||||
if (self.compiler.find_library_file(lib_dirs, 'terminfo')):
|
||||
curses_libs = ['curses', 'terminfo']
|
||||
else:
|
||||
curses_libs = ['curses', 'termcap']
|
||||
|
||||
exts.append( Extension('_curses', ['_cursesmodule.c'],
|
||||
libraries = curses_libs) )
|
||||
|
||||
# If the curses module is enabled, check for the panel module
|
||||
if (os.path.exists('Modules/_curses_panel.c') and
|
||||
module_enabled(exts, '_curses') and
|
||||
self.compiler.find_library_file(lib_dirs, 'panel')):
|
||||
exts.append( Extension('_curses_panel', ['_curses_panel.c'],
|
||||
libraries = ['panel'] + curses_libs) )
|
||||
|
||||
|
||||
|
||||
# Lee Busby's SIGFPE modules.
|
||||
# The library to link fpectl with is platform specific.
|
||||
# Choose *one* of the options below for fpectl:
|
||||
|
||||
if platform == 'irix5':
|
||||
# For SGI IRIX (tested on 5.3):
|
||||
exts.append( Extension('fpectl', ['fpectlmodule.c'],
|
||||
libraries=['fpe']) )
|
||||
elif 0: # XXX how to detect SunPro?
|
||||
# For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2):
|
||||
# (Without the compiler you don't have -lsunmath.)
|
||||
#fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm
|
||||
pass
|
||||
else:
|
||||
# For other systems: see instructions in fpectlmodule.c.
|
||||
#fpectl fpectlmodule.c ...
|
||||
exts.append( Extension('fpectl', ['fpectlmodule.c']) )
|
||||
|
||||
|
||||
# Andrew Kuchling's zlib module.
|
||||
# This require zlib 1.1.3 (or later).
|
||||
# See http://www.gzip.org/zlib/
|
||||
if (self.compiler.find_library_file(lib_dirs, 'z')):
|
||||
exts.append( Extension('zlib', ['zlibmodule.c'],
|
||||
libraries = ['z']) )
|
||||
|
||||
# Interface to the Expat XML parser
|
||||
#
|
||||
# Expat is written by James Clark and must be downloaded separately
|
||||
# (see below). The pyexpat module was written by Paul Prescod after a
|
||||
# prototype by Jack Jansen.
|
||||
#
|
||||
# The Expat dist includes Windows .lib and .dll files. Home page is
|
||||
# at http://www.jclark.com/xml/expat.html, the current production
|
||||
# release is always ftp://ftp.jclark.com/pub/xml/expat.zip.
|
||||
#
|
||||
# EXPAT_DIR, below, should point to the expat/ directory created by
|
||||
# unpacking the Expat source distribution.
|
||||
#
|
||||
# Note: the expat build process doesn't yet build a libexpat.a; you
|
||||
# can do this manually while we try convince the author to add it. To
|
||||
# do so, cd to EXPAT_DIR, run "make" if you have not done so, then
|
||||
# run:
|
||||
#
|
||||
# ar cr libexpat.a xmltok/*.o xmlparse/*.o
|
||||
#
|
||||
expat_defs = []
|
||||
expat_incs = find_file('expat.h', inc_dirs, [])
|
||||
if expat_incs is not None:
|
||||
# expat.h was found
|
||||
expat_defs = [('HAVE_EXPAT_H', 1)]
|
||||
else:
|
||||
expat_incs = find_file('xmlparse.h', inc_dirs, [])
|
||||
|
||||
if (expat_incs is not None and
|
||||
self.compiler.find_library_file(lib_dirs, 'expat')):
|
||||
exts.append( Extension('pyexpat', ['pyexpat.c'],
|
||||
define_macros = expat_defs,
|
||||
libraries = ['expat']) )
|
||||
|
||||
self.extensions.extend(exts)
|
||||
|
||||
# Call the method for detecting whether _tkinter can be compiled
|
||||
self.detect_tkinter(inc_dirs, lib_dirs)
|
||||
|
||||
|
||||
def detect_tkinter(self, inc_dirs, lib_dirs):
|
||||
# The _tkinter module.
|
||||
|
||||
# Assume we haven't found any of the libraries or include files
|
||||
tcllib = tklib = tcl_includes = tk_includes = None
|
||||
for version in ['8.4', '8.3', '8.2', '8.1', '8.0']:
|
||||
tklib = self.compiler.find_library_file(lib_dirs,
|
||||
'tk' + version )
|
||||
tcllib = self.compiler.find_library_file(lib_dirs,
|
||||
'tcl' + version )
|
||||
if tklib and tcllib:
|
||||
# Exit the loop when we've found the Tcl/Tk libraries
|
||||
break
|
||||
|
||||
# Now check for the header files
|
||||
if tklib and tcllib:
|
||||
# Check for the include files on Debian, where
|
||||
# they're put in /usr/include/{tcl,tk}X.Y
|
||||
debian_tcl_include = [ '/usr/include/tcl' + version ]
|
||||
debian_tk_include = [ '/usr/include/tk' + version ] + debian_tcl_include
|
||||
tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include)
|
||||
tk_includes = find_file('tk.h', inc_dirs, debian_tk_include)
|
||||
|
||||
if (tcllib is None or tklib is None and
|
||||
tcl_includes is None or tk_includes is None):
|
||||
# Something's missing, so give up
|
||||
return
|
||||
|
||||
# OK... everything seems to be present for Tcl/Tk.
|
||||
|
||||
include_dirs = [] ; libs = [] ; defs = [] ; added_lib_dirs = []
|
||||
for dir in tcl_includes + tk_includes:
|
||||
if dir not in include_dirs:
|
||||
include_dirs.append(dir)
|
||||
|
||||
# Check for various platform-specific directories
|
||||
platform = self.get_platform()
|
||||
if platform == 'sunos5':
|
||||
include_dirs.append('/usr/openwin/include')
|
||||
added_lib_dirs.append('/usr/openwin/lib')
|
||||
elif os.path.exists('/usr/X11R6/include'):
|
||||
include_dirs.append('/usr/X11R6/include')
|
||||
added_lib_dirs.append('/usr/X11R6/lib')
|
||||
elif os.path.exists('/usr/X11R5/include'):
|
||||
include_dirs.append('/usr/X11R5/include')
|
||||
added_lib_dirs.append('/usr/X11R5/lib')
|
||||
else:
|
||||
# Assume default location for X11
|
||||
include_dirs.append('/usr/X11/include')
|
||||
added_lib_dirs.append('/usr/X11/lib')
|
||||
|
||||
# Check for BLT extension
|
||||
if self.compiler.find_library_file(lib_dirs + added_lib_dirs, 'BLT8.0'):
|
||||
defs.append( ('WITH_BLT', 1) )
|
||||
libs.append('BLT8.0')
|
||||
|
||||
# Add the Tcl/Tk libraries
|
||||
libs.append('tk'+version)
|
||||
libs.append('tcl'+version)
|
||||
|
||||
if platform in ['aix3', 'aix4']:
|
||||
libs.append('ld')
|
||||
|
||||
# Finally, link with the X11 libraries
|
||||
libs.append('X11')
|
||||
|
||||
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
|
||||
define_macros=[('WITH_APPINIT', 1)] + defs,
|
||||
include_dirs = include_dirs,
|
||||
libraries = libs,
|
||||
library_dirs = added_lib_dirs,
|
||||
)
|
||||
self.extensions.append(ext)
|
||||
|
||||
# XXX handle these, but how to detect?
|
||||
# *** Uncomment and edit for PIL (TkImaging) extension only:
|
||||
# -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
|
||||
# *** Uncomment and edit for TOGL extension only:
|
||||
# -DWITH_TOGL togl.c \
|
||||
# *** Uncomment these for TOGL extension only:
|
||||
# -lGL -lGLU -lXext -lXmu \
|
||||
|
||||
def main():
|
||||
setup(name = 'Python standard library',
|
||||
version = '%d.%d' % sys.version_info[:2],
|
||||
cmdclass = {'build_ext':PyBuildExt},
|
||||
# The struct module is defined here, because build_ext won't be
|
||||
# called unless there's at least one extension module defined.
|
||||
ext_modules=[Extension('struct', ['structmodule.c'])],
|
||||
|
||||
# Scripts to install
|
||||
scripts = ['Tools/scripts/pydoc']
|
||||
)
|
||||
|
||||
# --install-platlib
|
||||
if __name__ == '__main__':
|
||||
sysconfig.set_python_build()
|
||||
main()
|
|
@ -9,8 +9,6 @@ Files found here
|
|||
|
||||
ACKS Acknowledgements
|
||||
AIX-NOTES Notes for building Python on AIX
|
||||
BeOS-NOTES Notes for building on BeOS
|
||||
BeOS-setup.py setup.py replacement for BeOS, see BeOS-NOTES
|
||||
cheatsheet Quick summary of Python by Ken Manheimer
|
||||
find_recursionlimit.py Script to find a value for sys.maxrecursionlimit
|
||||
gdbinit Handy stuff to put in your .gdbinit file, if you use gdb
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
co-exist. */
|
||||
#include "pyexpatns.h"
|
||||
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__CYGWIN__)
|
||||
#define XML_USE_MSC_EXTENSIONS 1
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
Under Unix, the file descriptors are small integers.
|
||||
Under Win32, select only exists for sockets, and sockets may
|
||||
have any value except INVALID_SOCKET.
|
||||
Under BeOS, we suffer the same dichotomy as Win32; sockets can be anything
|
||||
>= 0.
|
||||
*/
|
||||
|
||||
#include "Python.h"
|
||||
|
@ -49,9 +47,7 @@ extern void bzero(void *, int);
|
|||
# include <winsock.h>
|
||||
#else
|
||||
# define SOCKET int
|
||||
# ifdef __BEOS__
|
||||
# include <net/socket.h>
|
||||
# elif defined(__VMS)
|
||||
# if defined(__VMS)
|
||||
# include <socket.h>
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -242,9 +242,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\
|
|||
# include <netdb.h>
|
||||
|
||||
/* Headers needed for inet_ntoa() and inet_addr() */
|
||||
# ifdef __BEOS__
|
||||
# include <net/netdb.h>
|
||||
# elif defined(PYOS_OS2) && defined(PYCC_VACPP)
|
||||
# if defined(PYOS_OS2) && defined(PYCC_VACPP)
|
||||
# include <netdb.h>
|
||||
typedef size_t socklen_t;
|
||||
# else
|
||||
|
@ -326,8 +324,7 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
|
|||
#include "getnameinfo.c"
|
||||
#endif
|
||||
|
||||
#if defined(MS_WINDOWS) || defined(__BEOS__)
|
||||
/* BeOS suffers from the same socket dichotomy as Win32... - [cjh] */
|
||||
#if defined(MS_WINDOWS)
|
||||
/* seem to be a few differences in the API */
|
||||
#define SOCKETCLOSE closesocket
|
||||
#define NO_DUP /* Actually it exists on NT 3.5, but what the heck... */
|
||||
|
@ -650,11 +647,6 @@ internal_setblocking(PySocketSockObject *s, int block)
|
|||
#endif
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
#ifdef __BEOS__
|
||||
block = !block;
|
||||
setsockopt(s->sock_fd, SOL_SOCKET, SO_NONBLOCK,
|
||||
(void *)(&block), sizeof(int));
|
||||
#else
|
||||
#ifndef MS_WINDOWS
|
||||
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
|
||||
block = !block;
|
||||
|
@ -674,7 +666,6 @@ internal_setblocking(PySocketSockObject *s, int block)
|
|||
block = !block;
|
||||
ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block);
|
||||
#endif /* MS_WINDOWS */
|
||||
#endif /* __BEOS__ */
|
||||
Py_END_ALLOW_THREADS
|
||||
|
||||
/* Since these don't return anything */
|
||||
|
@ -992,11 +983,6 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
|
|||
return Py_None;
|
||||
}
|
||||
|
||||
#ifdef __BEOS__
|
||||
/* XXX: BeOS version of accept() doesn't set family correctly */
|
||||
addr->sa_family = AF_INET;
|
||||
#endif
|
||||
|
||||
switch (addr->sa_family) {
|
||||
|
||||
case AF_INET:
|
||||
|
@ -1715,12 +1701,6 @@ sock_getsockopt(PySocketSockObject *s, PyObject *args)
|
|||
PyObject *buf;
|
||||
socklen_t buflen = 0;
|
||||
|
||||
#ifdef __BEOS__
|
||||
/* We have incomplete socket support. */
|
||||
PyErr_SetString(socket_error, "getsockopt not supported");
|
||||
return NULL;
|
||||
#else
|
||||
|
||||
if (!PyArg_ParseTuple(args, "ii|i:getsockopt",
|
||||
&level, &optname, &buflen))
|
||||
return NULL;
|
||||
|
@ -1759,7 +1739,6 @@ sock_getsockopt(PySocketSockObject *s, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
return buf;
|
||||
#endif /* __BEOS__ */
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(getsockopt_doc,
|
||||
|
@ -3248,11 +3227,6 @@ socket_getprotobyname(PyObject *self, PyObject *args)
|
|||
{
|
||||
char *name;
|
||||
struct protoent *sp;
|
||||
#ifdef __BEOS__
|
||||
/* Not available in BeOS yet. - [cjh] */
|
||||
PyErr_SetString(socket_error, "getprotobyname not supported");
|
||||
return NULL;
|
||||
#else
|
||||
if (!PyArg_ParseTuple(args, "s:getprotobyname", &name))
|
||||
return NULL;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
@ -3263,7 +3237,6 @@ socket_getprotobyname(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((long) sp->p_proto);
|
||||
#endif
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(getprotobyname_doc,
|
||||
|
@ -4277,14 +4250,12 @@ init_socket(void)
|
|||
/* Socket types */
|
||||
PyModule_AddIntConstant(m, "SOCK_STREAM", SOCK_STREAM);
|
||||
PyModule_AddIntConstant(m, "SOCK_DGRAM", SOCK_DGRAM);
|
||||
#ifndef __BEOS__
|
||||
/* We have incomplete socket support. */
|
||||
PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW);
|
||||
PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET);
|
||||
#if defined(SOCK_RDM)
|
||||
PyModule_AddIntConstant(m, "SOCK_RDM", SOCK_RDM);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SO_DEBUG
|
||||
PyModule_AddIntConstant(m, "SO_DEBUG", SO_DEBUG);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# include <sys/socket.h>
|
||||
# endif
|
||||
# include <netinet/in.h>
|
||||
# if !(defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP)))
|
||||
# if defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP))
|
||||
# include <netinet/tcp.h>
|
||||
# endif
|
||||
|
||||
|
|
|
@ -80,13 +80,6 @@ static long main_thread;
|
|||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
#include <time.h>
|
||||
/* For bigtime_t, snooze(). - [cjh] */
|
||||
#include <support/SupportDefs.h>
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
|
||||
/* Forward declarations */
|
||||
static int floatsleep(double);
|
||||
static double floattime(void);
|
||||
|
@ -894,7 +887,7 @@ static int
|
|||
floatsleep(double secs)
|
||||
{
|
||||
/* XXX Should test for MS_WINDOWS first! */
|
||||
#if defined(HAVE_SELECT) && !defined(__BEOS__) && !defined(__EMX__)
|
||||
#if defined(HAVE_SELECT) && !defined(__EMX__)
|
||||
struct timeval t;
|
||||
double frac;
|
||||
frac = fmod(secs, 1.0);
|
||||
|
@ -963,22 +956,6 @@ floatsleep(double secs)
|
|||
return -1;
|
||||
}
|
||||
Py_END_ALLOW_THREADS
|
||||
#elif defined(__BEOS__)
|
||||
/* This sleep *CAN BE* interrupted. */
|
||||
{
|
||||
if( secs <= 0.0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
/* BeOS snooze() is in microseconds... */
|
||||
if( snooze( (bigtime_t)( secs * 1000.0 * 1000.0 ) ) == B_INTERRUPTED ) {
|
||||
Py_BLOCK_THREADS
|
||||
PyErr_SetFromErrno( PyExc_IOError );
|
||||
return -1;
|
||||
}
|
||||
Py_END_ALLOW_THREADS
|
||||
}
|
||||
#elif defined(PLAN9)
|
||||
{
|
||||
double millisecs = secs * 1000.0;
|
||||
|
|
|
@ -1,254 +0,0 @@
|
|||
|
||||
/* Support for dynamic loading of extension modules */
|
||||
|
||||
#include <kernel/image.h>
|
||||
#include <kernel/OS.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "Python.h"
|
||||
#include "importdl.h"
|
||||
|
||||
const struct filedescr _PyImport_DynLoadFiletab[] = {
|
||||
{".so", "rb", C_EXTENSION},
|
||||
{"module.so", "rb", C_EXTENSION},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
#if defined(MAXPATHLEN) && !defined(_SYS_PARAM_H)
|
||||
#undef MAXPATHLEN
|
||||
#endif
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
#include "pythread.h"
|
||||
static PyThread_type_lock beos_dyn_lock;
|
||||
#endif
|
||||
|
||||
static PyObject *beos_dyn_images = NULL;
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* BeOS dynamic loading support
|
||||
*
|
||||
* This uses shared libraries, but BeOS has its own way of doing things
|
||||
* (much easier than dlfnc.h, from the look of things). We'll use a
|
||||
* Python Dictionary object to store the images_ids so we can be very
|
||||
* nice and unload them when we exit.
|
||||
*
|
||||
* Note that this is thread-safe. Probably irrelevent, because of losing
|
||||
* systems... Python probably disables threads while loading modules.
|
||||
* Note the use of "probably"! Better to be safe than sorry. [chrish]
|
||||
*
|
||||
* As of 1.5.1 this should also work properly when you've configured
|
||||
* Python without thread support; the 1.5 version required it, which wasn't
|
||||
* very friendly. Note that I haven't tested it without threading... why
|
||||
* would you want to avoid threads on BeOS? [chrish]
|
||||
*
|
||||
* As of 1.5.2, the PyImport_BeImageID() function has been removed; Donn
|
||||
* tells me it's not necessary anymore because of PyCObject_Import().
|
||||
* [chrish]
|
||||
*/
|
||||
|
||||
/* Whack an item; the item is an image_id in disguise, so we'll call
|
||||
* unload_add_on() for it.
|
||||
*/
|
||||
static void beos_nuke_dyn( PyObject *item )
|
||||
{
|
||||
status_t retval;
|
||||
|
||||
if( item ) {
|
||||
image_id id = (image_id)PyInt_AsLong( item );
|
||||
|
||||
retval = unload_add_on( id );
|
||||
}
|
||||
}
|
||||
|
||||
/* atexit() handler that'll call unload_add_on() for every item in the
|
||||
* dictionary.
|
||||
*/
|
||||
static void beos_cleanup_dyn( void )
|
||||
{
|
||||
if( beos_dyn_images ) {
|
||||
int idx;
|
||||
int list_size;
|
||||
PyObject *id_list;
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
PyThread_acquire_lock( beos_dyn_lock, 1 );
|
||||
#endif
|
||||
|
||||
id_list = PyDict_Values( beos_dyn_images );
|
||||
|
||||
list_size = PyList_Size( id_list );
|
||||
for( idx = 0; idx < list_size; idx++ ) {
|
||||
PyObject *the_item;
|
||||
|
||||
the_item = PyList_GetItem( id_list, idx );
|
||||
beos_nuke_dyn( the_item );
|
||||
}
|
||||
|
||||
PyDict_Clear( beos_dyn_images );
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
PyThread_free_lock( beos_dyn_lock );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize our dictionary, and the dictionary mutex.
|
||||
*/
|
||||
static void beos_init_dyn( void )
|
||||
{
|
||||
/* We're protected from a race condition here by the atomic init_count
|
||||
* variable.
|
||||
*/
|
||||
static int32 init_count = 0;
|
||||
int32 val;
|
||||
|
||||
val = atomic_add( &init_count, 1 );
|
||||
if( beos_dyn_images == NULL && val == 0 ) {
|
||||
beos_dyn_images = PyDict_New();
|
||||
#ifdef WITH_THREAD
|
||||
beos_dyn_lock = PyThread_allocate_lock();
|
||||
#endif
|
||||
atexit( beos_cleanup_dyn );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add an image_id to the dictionary; the module name of the loaded image
|
||||
* is the key. Note that if the key is already in the dict, we unload
|
||||
* that image; this should allow reload() to work on dynamically loaded
|
||||
* modules (super-keen!).
|
||||
*/
|
||||
static void beos_add_dyn( char *name, image_id id )
|
||||
{
|
||||
int retval;
|
||||
PyObject *py_id;
|
||||
|
||||
if( beos_dyn_images == NULL ) {
|
||||
beos_init_dyn();
|
||||
}
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
retval = PyThread_acquire_lock( beos_dyn_lock, 1 );
|
||||
#endif
|
||||
|
||||
/* If there's already an object with this key in the dictionary,
|
||||
* we're doing a reload(), so let's nuke it.
|
||||
*/
|
||||
py_id = PyDict_GetItemString( beos_dyn_images, name );
|
||||
if( py_id ) {
|
||||
beos_nuke_dyn( py_id );
|
||||
retval = PyDict_DelItemString( beos_dyn_images, name );
|
||||
}
|
||||
|
||||
py_id = PyInt_FromLong( (long)id );
|
||||
if( py_id ) {
|
||||
retval = PyDict_SetItemString( beos_dyn_images, name, py_id );
|
||||
}
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
PyThread_release_lock( beos_dyn_lock );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
|
||||
const char *pathname, FILE *fp)
|
||||
{
|
||||
dl_funcptr p;
|
||||
image_id the_id;
|
||||
status_t retval;
|
||||
char fullpath[PATH_MAX];
|
||||
char funcname[258];
|
||||
|
||||
if( Py_VerboseFlag ) {
|
||||
printf( "load_add_on( %s )\n", pathname );
|
||||
}
|
||||
|
||||
/* Hmm, this old bug appears to have regenerated itself; if the
|
||||
* path isn't absolute, load_add_on() will fail. Reported to Be
|
||||
* April 21, 1998.
|
||||
*/
|
||||
if( pathname[0] != '/' ) {
|
||||
(void)getcwd( fullpath, PATH_MAX );
|
||||
(void)strncat( fullpath, "/", PATH_MAX );
|
||||
(void)strncat( fullpath, pathname, PATH_MAX );
|
||||
|
||||
if( Py_VerboseFlag ) {
|
||||
printf( "load_add_on( %s )\n", fullpath );
|
||||
}
|
||||
} else {
|
||||
(void)strcpy( fullpath, pathname );
|
||||
}
|
||||
|
||||
the_id = load_add_on( fullpath );
|
||||
if( the_id < B_NO_ERROR ) {
|
||||
/* It's too bad load_add_on() doesn't set errno or something...
|
||||
*/
|
||||
char buff[256]; /* hate hard-coded string sizes... */
|
||||
|
||||
if( Py_VerboseFlag ) {
|
||||
printf( "load_add_on( %s ) failed", fullpath );
|
||||
}
|
||||
|
||||
if( the_id == B_ERROR )
|
||||
PyOS_snprintf( buff, sizeof(buff),
|
||||
"BeOS: Failed to load %.200s",
|
||||
fullpath );
|
||||
else
|
||||
PyOS_snprintf( buff, sizeof(buff),
|
||||
"Unknown error loading %.200s",
|
||||
fullpath );
|
||||
|
||||
PyErr_SetString( PyExc_ImportError, buff );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PyOS_snprintf(funcname, sizeof(funcname), "init%.200s", shortname);
|
||||
if( Py_VerboseFlag ) {
|
||||
printf( "get_image_symbol( %s )\n", funcname );
|
||||
}
|
||||
|
||||
retval = get_image_symbol( the_id, funcname, B_SYMBOL_TYPE_TEXT, &p );
|
||||
if( retval != B_NO_ERROR || p == NULL ) {
|
||||
/* That's bad, we can't find that symbol in the module...
|
||||
*/
|
||||
char buff[256]; /* hate hard-coded string sizes... */
|
||||
|
||||
if( Py_VerboseFlag ) {
|
||||
printf( "get_image_symbol( %s ) failed", funcname );
|
||||
}
|
||||
|
||||
switch( retval ) {
|
||||
case B_BAD_IMAGE_ID:
|
||||
PyOS_snprintf( buff, sizeof(buff),
|
||||
"can't load init function for dynamic module: "
|
||||
"Invalid image ID for %.180s", fullpath );
|
||||
break;
|
||||
case B_BAD_INDEX:
|
||||
PyOS_snprintf( buff, sizeof(buff),
|
||||
"can't load init function for dynamic module: "
|
||||
"Bad index for %.180s", funcname );
|
||||
break;
|
||||
default:
|
||||
PyOS_snprintf( buff, sizeof(buff),
|
||||
"can't load init function for dynamic module: "
|
||||
"Unknown error looking up %.180s", funcname );
|
||||
break;
|
||||
}
|
||||
|
||||
retval = unload_add_on( the_id );
|
||||
|
||||
PyErr_SetString( PyExc_ImportError, buff );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Save the module name and image ID for later so we can clean up
|
||||
* gracefully.
|
||||
*/
|
||||
beos_add_dyn( fqname, the_id );
|
||||
|
||||
return p;
|
||||
}
|
|
@ -133,10 +133,6 @@ static size_t _pythread_stacksize = 0;
|
|||
#include "thread_os2.h"
|
||||
#endif
|
||||
|
||||
#ifdef BEOS_THREADS
|
||||
#include "thread_beos.h"
|
||||
#endif
|
||||
|
||||
#ifdef WINCE_THREADS
|
||||
#include "thread_wince.h"
|
||||
#endif
|
||||
|
|
|
@ -1,287 +0,0 @@
|
|||
#include <kernel/OS.h>
|
||||
#include <support/SupportDefs.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Fast locking mechanism described by Benoit Schillings (benoit@be.com)
|
||||
* in the Be Developer's Newsletter, Issue #26 (http://www.be.com/).
|
||||
*/
|
||||
typedef struct benaphore {
|
||||
sem_id _sem;
|
||||
int32 _atom;
|
||||
} benaphore_t;
|
||||
|
||||
static status_t benaphore_create( const char *name, benaphore_t *ben );
|
||||
static status_t benaphore_destroy( benaphore_t *ben );
|
||||
static status_t benaphore_lock( benaphore_t *ben );
|
||||
static status_t benaphore_timedlock( benaphore_t *ben, bigtime_t micros );
|
||||
static status_t benaphore_unlock( benaphore_t *ben );
|
||||
|
||||
static status_t benaphore_create( const char *name, benaphore_t *ben )
|
||||
{
|
||||
if( ben != NULL ) {
|
||||
ben->_atom = 0;
|
||||
ben->_sem = create_sem( 0, name );
|
||||
|
||||
if( ben->_sem < B_NO_ERROR ) {
|
||||
return B_BAD_SEM_ID;
|
||||
}
|
||||
} else {
|
||||
return EFAULT;
|
||||
}
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
static status_t benaphore_destroy( benaphore_t *ben )
|
||||
{
|
||||
if( ben->_sem >= B_NO_ERROR ) {
|
||||
status_t retval = benaphore_timedlock( ben, 0 );
|
||||
|
||||
if( retval == EOK || retval == EWOULDBLOCK ) {
|
||||
status_t del_retval = delete_sem( ben->_sem );
|
||||
|
||||
return del_retval;
|
||||
}
|
||||
}
|
||||
|
||||
return B_BAD_SEM_ID;
|
||||
}
|
||||
|
||||
static status_t benaphore_lock( benaphore_t *ben )
|
||||
{
|
||||
int32 prev = atomic_add( &(ben->_atom), 1 );
|
||||
|
||||
if( prev > 0 ) {
|
||||
return acquire_sem( ben->_sem );
|
||||
}
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
static status_t benaphore_timedlock( benaphore_t *ben, bigtime_t micros )
|
||||
{
|
||||
int32 prev = atomic_add( &(ben->_atom), 1 );
|
||||
|
||||
if( prev > 0 ) {
|
||||
status_t retval = acquire_sem_etc( ben->_sem, 1, B_TIMEOUT, micros );
|
||||
|
||||
switch( retval ) {
|
||||
case B_WOULD_BLOCK: /* Fall through... */
|
||||
case B_TIMED_OUT:
|
||||
return EWOULDBLOCK;
|
||||
break;
|
||||
case B_OK:
|
||||
return EOK;
|
||||
break;
|
||||
default:
|
||||
return retval;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
static status_t benaphore_unlock( benaphore_t *ben )
|
||||
{
|
||||
int32 prev = atomic_add( &(ben->_atom), -1 );
|
||||
|
||||
if( prev > 1 ) {
|
||||
return release_sem( ben->_sem );
|
||||
}
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Initialization.
|
||||
*/
|
||||
static void PyThread__init_thread( void )
|
||||
{
|
||||
/* Do nothing. */
|
||||
return;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Thread support.
|
||||
*
|
||||
* Only ANSI C, renamed functions here; you can't use K&R on BeOS,
|
||||
* and there's no legacy thread module to support.
|
||||
*/
|
||||
|
||||
static int32 thread_count = 0;
|
||||
|
||||
long PyThread_start_new_thread( void (*func)(void *), void *arg )
|
||||
{
|
||||
status_t success = 0;
|
||||
thread_id tid;
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
int32 this_thread;
|
||||
|
||||
dprintf(("PyThread_start_new_thread called\n"));
|
||||
|
||||
/* We are so very thread-safe... */
|
||||
this_thread = atomic_add( &thread_count, 1 );
|
||||
PyOS_snprintf(name, sizeof(name),
|
||||
"python thread (%d)", this_thread );
|
||||
|
||||
tid = spawn_thread( (thread_func)func, name,
|
||||
B_NORMAL_PRIORITY, arg );
|
||||
if( tid > B_NO_ERROR ) {
|
||||
success = resume_thread( tid );
|
||||
}
|
||||
|
||||
return ( success == B_NO_ERROR ? tid : -1 );
|
||||
}
|
||||
|
||||
long PyThread_get_thread_ident( void )
|
||||
{
|
||||
/* Presumed to return the current thread's ID... */
|
||||
thread_id tid;
|
||||
tid = find_thread( NULL );
|
||||
|
||||
return ( tid != B_NAME_NOT_FOUND ? tid : -1 );
|
||||
}
|
||||
|
||||
static void do_PyThread_exit_thread( int no_cleanup )
|
||||
{
|
||||
int32 threads;
|
||||
|
||||
dprintf(("PyThread_exit_thread called\n"));
|
||||
|
||||
/* Thread-safe way to read a variable without a mutex: */
|
||||
threads = atomic_add( &thread_count, 0 );
|
||||
|
||||
if( threads == 0 ) {
|
||||
/* No threads around, so exit main(). */
|
||||
if( no_cleanup ) {
|
||||
_exit(0);
|
||||
} else {
|
||||
exit(0);
|
||||
}
|
||||
} else {
|
||||
/* Oh, we're a thread, let's try to exit gracefully... */
|
||||
exit_thread( B_NO_ERROR );
|
||||
}
|
||||
}
|
||||
|
||||
void PyThread_exit_thread( void )
|
||||
{
|
||||
do_PyThread_exit_thread(0);
|
||||
}
|
||||
|
||||
void PyThread__exit_thread( void )
|
||||
{
|
||||
do_PyThread_exit_thread(1);
|
||||
}
|
||||
|
||||
#ifndef NO_EXIT_PROG
|
||||
static void do_PyThread_exit_prog( int status, int no_cleanup )
|
||||
{
|
||||
dprintf(("PyThread_exit_prog(%d) called\n", status));
|
||||
|
||||
/* No need to do anything, the threads get torn down if main() exits. */
|
||||
|
||||
if (no_cleanup) {
|
||||
_exit(status);
|
||||
} else {
|
||||
exit(status);
|
||||
}
|
||||
}
|
||||
|
||||
void PyThread_exit_prog( int status )
|
||||
{
|
||||
do_PyThread_exit_prog(status, 0);
|
||||
}
|
||||
|
||||
void PyThread__exit_prog( int status )
|
||||
{
|
||||
do_PyThread_exit_prog(status, 1);
|
||||
}
|
||||
#endif /* NO_EXIT_PROG */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Lock support.
|
||||
*/
|
||||
|
||||
static int32 lock_count = 0;
|
||||
|
||||
PyThread_type_lock PyThread_allocate_lock( void )
|
||||
{
|
||||
benaphore_t *lock;
|
||||
status_t retval;
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
int32 this_lock;
|
||||
|
||||
dprintf(("PyThread_allocate_lock called\n"));
|
||||
|
||||
lock = (benaphore_t *)malloc( sizeof( benaphore_t ) );
|
||||
if( lock == NULL ) {
|
||||
/* TODO: that's bad, raise MemoryError */
|
||||
return (PyThread_type_lock)NULL;
|
||||
}
|
||||
|
||||
this_lock = atomic_add( &lock_count, 1 );
|
||||
PyOS_snprintf(name, sizeof(name), "python lock (%d)", this_lock);
|
||||
|
||||
retval = benaphore_create( name, lock );
|
||||
if( retval != EOK ) {
|
||||
/* TODO: that's bad, raise an exception */
|
||||
return (PyThread_type_lock)NULL;
|
||||
}
|
||||
|
||||
dprintf(("PyThread_allocate_lock() -> %p\n", lock));
|
||||
return (PyThread_type_lock) lock;
|
||||
}
|
||||
|
||||
void PyThread_free_lock( PyThread_type_lock lock )
|
||||
{
|
||||
status_t retval;
|
||||
|
||||
dprintf(("PyThread_free_lock(%p) called\n", lock));
|
||||
|
||||
retval = benaphore_destroy( (benaphore_t *)lock );
|
||||
if( retval != EOK ) {
|
||||
/* TODO: that's bad, raise an exception */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int PyThread_acquire_lock( PyThread_type_lock lock, int waitflag )
|
||||
{
|
||||
int success;
|
||||
status_t retval;
|
||||
|
||||
dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
|
||||
|
||||
if( waitflag ) {
|
||||
retval = benaphore_lock( (benaphore_t *)lock );
|
||||
} else {
|
||||
retval = benaphore_timedlock( (benaphore_t *)lock, 0 );
|
||||
}
|
||||
|
||||
if( retval == EOK ) {
|
||||
success = 1;
|
||||
} else {
|
||||
success = 0;
|
||||
|
||||
/* TODO: that's bad, raise an exception */
|
||||
}
|
||||
|
||||
dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
|
||||
return success;
|
||||
}
|
||||
|
||||
void PyThread_release_lock( PyThread_type_lock lock )
|
||||
{
|
||||
status_t retval;
|
||||
|
||||
dprintf(("PyThread_release_lock(%p) called\n", lock));
|
||||
|
||||
retval = benaphore_unlock( (benaphore_t *)lock );
|
||||
if( retval != EOK ) {
|
||||
/* TODO: that's bad, raise an exception */
|
||||
return;
|
||||
}
|
||||
}
|
5
README
5
README
|
@ -487,11 +487,6 @@ QNX: Chris Herborth (chrish@qnx.com) writes:
|
|||
little tight. To increase the stack size, edit the Makefile
|
||||
to read: LDFLAGS = -N 48k
|
||||
|
||||
BeOS: See Misc/BeOS-NOTES for notes about compiling/installing
|
||||
Python on BeOS R3 or later. Note that only the PowerPC
|
||||
platform is supported for R3; both PowerPC and x86 are
|
||||
supported for R4.
|
||||
|
||||
Cray T3E: Mark Hadfield (m.hadfield@niwa.co.nz) writes:
|
||||
Python can be built satisfactorily on a Cray T3E but based on
|
||||
my experience with the NIWA T3E (2002-05-22, version 2.2.1)
|
||||
|
|
|
@ -50,9 +50,7 @@ except KeyError:
|
|||
searchdirs=os.environ['INCLUDE'].split(';')
|
||||
except KeyError:
|
||||
try:
|
||||
if sys.platform.find("beos") == 0:
|
||||
searchdirs=os.environ['BEINCLUDES'].split(';')
|
||||
elif sys.platform.startswith("atheos"):
|
||||
if sys.platform.startswith("atheos"):
|
||||
searchdirs=os.environ['C_INCLUDE_PATH'].split(':')
|
||||
else:
|
||||
raise KeyError
|
||||
|
|
44
configure.in
44
configure.in
|
@ -357,27 +357,6 @@ AC_ARG_WITH(gcc,
|
|||
case $ac_sys_system in
|
||||
AIX*) CC=cc_r
|
||||
without_gcc=;;
|
||||
BeOS*)
|
||||
case $BE_HOST_CPU in
|
||||
ppc)
|
||||
CC=mwcc
|
||||
without_gcc=yes
|
||||
BASECFLAGS="$BASECFLAGS -export pragma"
|
||||
OPT="$OPT -O"
|
||||
LDFLAGS="$LDFLAGS -nodup"
|
||||
;;
|
||||
x86)
|
||||
CC=gcc
|
||||
without_gcc=no
|
||||
OPT="$OPT -O"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
|
||||
;;
|
||||
esac
|
||||
AR="\$(srcdir)/Modules/ar_beos"
|
||||
RANLIB=:
|
||||
;;
|
||||
Monterey*)
|
||||
RANLIB=:
|
||||
without_gcc=;;
|
||||
|
@ -627,9 +606,6 @@ fi
|
|||
if test $enable_shared = "yes"; then
|
||||
AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
|
||||
case $ac_sys_system in
|
||||
BeOS*)
|
||||
LDLIBRARY='libpython$(VERSION).so'
|
||||
;;
|
||||
CYGWIN*)
|
||||
LDLIBRARY='libpython$(VERSION).dll.a'
|
||||
DLLLIBRARY='libpython$(VERSION).dll'
|
||||
|
@ -712,7 +688,6 @@ AC_PROG_INSTALL
|
|||
AC_SUBST(LN)
|
||||
if test -z "$LN" ; then
|
||||
case $ac_sys_system in
|
||||
BeOS*) LN="ln -s";;
|
||||
CYGWIN*) LN="ln -s";;
|
||||
atheos*) LN="ln -s";;
|
||||
*) LN=ln;;
|
||||
|
@ -1467,10 +1442,6 @@ then
|
|||
BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
|
||||
LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
|
||||
;;
|
||||
BeOS*)
|
||||
BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
|
||||
LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
|
||||
;;
|
||||
IRIX/5*) LDSHARED="ld -shared";;
|
||||
IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
|
||||
SunOS/5*)
|
||||
|
@ -1720,16 +1691,9 @@ case "$ac_sys_system" in
|
|||
esac
|
||||
|
||||
# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
|
||||
# BeOS' sockets are stashed in libnet.
|
||||
AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
|
||||
AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
|
||||
|
||||
case "$ac_sys_system" in
|
||||
BeOS*)
|
||||
AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_MSG_CHECKING(for --with-libs)
|
||||
AC_ARG_WITH(libs,
|
||||
AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
|
||||
|
@ -1913,10 +1877,6 @@ pthread_create (NULL, NULL, start_routine, NULL)], [
|
|||
AC_DEFINE(ATHEOS_THREADS, 1,
|
||||
[Define this if you have AtheOS threads.])
|
||||
THREADOBJ="Python/thread.o"],[
|
||||
AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
|
||||
AC_DEFINE(BEOS_THREADS, 1,
|
||||
[Define this if you have BeOS threads.])
|
||||
THREADOBJ="Python/thread.o"],[
|
||||
AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
|
||||
posix_threads=yes
|
||||
LIBS="$LIBS -lpthreads"
|
||||
|
@ -1934,7 +1894,7 @@ pthread_create (NULL, NULL, start_routine, NULL)], [
|
|||
LIBS="$LIBS -lcma"
|
||||
THREADOBJ="Python/thread.o"],[
|
||||
USE_THREAD_MODULE="#"])
|
||||
])])])])])])])])])])
|
||||
])])])])])])])])])
|
||||
|
||||
AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
|
||||
LIBS="$LIBS -lmpc"
|
||||
|
@ -2253,7 +2213,6 @@ then
|
|||
else DYNLOADFILE="dynload_aix.o"
|
||||
fi
|
||||
;;
|
||||
BeOS*) DYNLOADFILE="dynload_beos.o";;
|
||||
hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
|
||||
# Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
|
||||
Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
|
||||
|
@ -2890,7 +2849,6 @@ fi],
|
|||
AC_SUBST(LIBM)
|
||||
case $ac_sys_system in
|
||||
Darwin) ;;
|
||||
BeOS) ;;
|
||||
*) LIBM=-lm
|
||||
esac
|
||||
AC_MSG_CHECKING(for --with-libm=STRING)
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
/* Define this if you have AtheOS threads. */
|
||||
#undef ATHEOS_THREADS
|
||||
|
||||
/* Define this if you have BeOS threads. */
|
||||
#undef BEOS_THREADS
|
||||
|
||||
/* Define if you have the Mach cthreads package */
|
||||
#undef C_THREADS
|
||||
|
||||
|
|
4
setup.py
4
setup.py
|
@ -269,7 +269,7 @@ class PyBuildExt(build_ext):
|
|||
|
||||
def get_platform(self):
|
||||
# Get value of sys.platform
|
||||
for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
|
||||
for platform in ['cygwin', 'darwin', 'atheos', 'osf1']:
|
||||
if sys.platform.startswith(platform):
|
||||
return platform
|
||||
return sys.platform
|
||||
|
@ -364,7 +364,7 @@ class PyBuildExt(build_ext):
|
|||
|
||||
# Check for MacOS X, which doesn't need libm.a at all
|
||||
math_libs = ['m']
|
||||
if platform in ['darwin', 'beos', 'mac']:
|
||||
if platform in ['darwin', 'mac']:
|
||||
math_libs = []
|
||||
|
||||
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
|
||||
|
|
Loading…
Reference in New Issue