Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 56221a7

Browse files
committed
Chris Herborth <[email protected]>:
Minor updates for BeOS R5. Use of OSError in test.test_fork1 changed to TestSkipped, with corresponding change in BeOS/README (by Fred). This closes SourceForge patch #100978.
1 parent d341579 commit 56221a7

6 files changed

Lines changed: 59 additions & 40 deletions

File tree

BeOS/README

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Python 1.5.x (x > 1) for BeOS
1+
Python for BeOS R5
22

33
This directory contains several useful things to help you build your own
44
version of Python for BeOS.
@@ -45,23 +45,25 @@ Python 1.5.2 and later will compile "out of the box" on BeOS), try this:
4545
4) Edit Modules/Setup to turn on all the modules you want built.
4646

4747
Make sure you use _socket instead of socket for the name of the
48-
socketmodule on BeOS.
48+
socketmodule on BeOS (at least, until we get the new BONE networking).
4949

5050
If you want the modules to be built as shared libraries, instead of as
5151
part of the Python shared library, be sure to uncomment the #*shared*
52-
line.
52+
line. I haven't done much testing with static linking, it's not as
53+
interesting.
5354

5455
I've tried the following modules:
5556

56-
regex pcre posix signal readline array cmath math strop struct time
57-
operator _locale fcntl pwd grp select _socket errno crypt termios
58-
audioop imageop rgbimg md5 timing rotor syslog curses new gdbm soundex
59-
binascii parser cStringIO cPickle zlib
57+
array audioop binascii cmath _codecs cPickle crypt cStringIO _curses
58+
errno fcntl gdbm grp imageop _locale math md5 new operator parser
59+
pcre posix pwd pyexpat readline regex rgbimg rotor select sha signal
60+
_socket soundex _sre strop struct syslog termios time timing ucnhash
61+
unicodedata zlib
6062

61-
Note that some of these (readline, curses, gdbm, and zlib) require extra
62-
libraries that aren't supplied with Python. If you don't have the extra
63-
libs (you can probably get them from GeekGadgets), don't try to use
64-
these modules; they won't compile.
63+
Note that some of these require extra libraries that aren't supplied
64+
with Python. If you don't have the extra libs (you can probably get
65+
them from GeekGadgets), don't try to use these modules; they won't
66+
compile.
6567

6668
5) Make:
6769

@@ -71,23 +73,51 @@ Python 1.5.2 and later will compile "out of the box" on BeOS), try this:
7173

7274
make test
7375

76+
test_popen2 will probably hang; it's deadlocked on a semaphore. I should
77+
probably disable popen2 support... it uses fork(), and fork() doesn't mix
78+
with threads on BeOS. In *THEORY* you could use it in a single-threaded
79+
program, but I haven't tried.
80+
81+
If test_popen2 does hang, you can find the semaphore it's hung on via the
82+
"ps" command. Look for python and you'll find something like this:
83+
84+
./python -tt ../src/Lib/test/regrtest.py (team 26922) (uid 0) (gid 0)
85+
39472 python sem 10 3785 1500 piperd(360526)
86+
./python -tt ../src/Lib/test/regrtest.py (team 26923) (uid 0) (gid 0)
87+
39477 python sem 10 25 4 python lock (1)(360022)
88+
^^^^^^
89+
That last number is the semaphore the fork()'d python is stuck on
90+
(see how it's helpfully called "python lock (1)"? :-). You can unblock
91+
that semaphore to let the tests continue using the "release" command
92+
with that semaphore number. Be _very_ careful with "release" though,
93+
releasing the wrong semaphore can be hazardous.
94+
7495
Expect the following errors:
7596

76-
test_grp crashed -- exceptions.KeyError : getgrnam(): name not found
77-
test_pwd failed -- Writing: 'fakename', expected: 'caught e'
78-
test_socket crashed -- exceptions.AttributeError : SOCK_RAW
97+
test * skipped -- an optional feature could not be imported (you'll see
98+
quite a few of these, based on what optional modules
99+
you've included)
100+
101+
test test_fork1 skipped -- can't mix os.fork with threads on BeOS
102+
103+
test test_re failed -- Writing: '=== Failed incorrectly', expected:
104+
"('abc', 'abc', 0, 'fou"
105+
106+
test test_select crashed -- select.error : (-2147459072, 'Bad file
107+
descriptor')
108+
109+
test test_socket crashed -- exceptions.AttributeError : SOCK_RAW
79110

80111
These are all due to either partial support for certain things (like
81112
sockets), or valid differences between systems.
82113

83-
NOTE: On R4/x86, the pause() function is broken; expect the signal
84-
module test to crash Python!
114+
That test_re failure is a little worrysome though.
85115

86116
7) Install:
87117

88118
make install
89119

90120
8) Enjoy!
91121

92-
- Chris Herborth (chrish@beoscentral.com)
93-
January 12, 1999
122+
- Chris Herborth (chrish@pobox.com)
123+
July 21, 2000

BeOS/linkmodule

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fi
4646
# The shared libraries and glue objects we need to link against; these
4747
# libs are overkill for most of the standard modules, but it makes life
4848
# in this shell script easier.
49-
LIBS="-L.. -lpython1.5 -lbe -lnet -lroot"
49+
LIBS="-L.. -lpython$VERSION -lbe -lnet -lroot"
5050

5151
case $BE_HOST_CPU in
5252
ppc)

Lib/test/test_fork1.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,20 @@
66
On some systems (e.g. Solaris without posix threads) we find that all
77
active threads survive in the child after a fork(); this is an error.
88
9+
On BeOS, you CANNOT mix threads and fork(), the behaviour is undefined.
10+
That's OK, fork() is a grotesque hack anyway. ;-) [cjh]
11+
912
"""
1013

1114
import os, sys, time, thread
1215
from test_support import TestSkipped
1316

17+
try:
18+
if os.uname()[0] == "BeOS":
19+
raise TestSkipped, "can't mix os.fork with threads on BeOS"
20+
except AttributeError:
21+
pass
22+
1423
try:
1524
os.fork
1625
except AttributeError:

Modules/posixmodule.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3620,11 +3620,6 @@ static char posix_putenv__doc__[] =
36203620
"putenv(key, value) -> None\n\
36213621
Change or add an environment variable.";
36223622

3623-
#ifdef __BEOS__
3624-
/* We have putenv(), but not in the headers (as of PR2). - [cjh] */
3625-
int putenv( const char *str );
3626-
#endif
3627-
36283623
/* Save putenv() parameters as values here, so we can collect them when they
36293624
* get re-set with another call for the same key. */
36303625
static PyObject *posix_putenv_garbage;

Modules/pwdmodule.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ exception is raised if the entry asked for cannot be found.";
2929
static PyObject *
3030
mkpwent(struct passwd *p)
3131
{
32-
#ifdef __BEOS__
33-
/* For faking the GECOS field. - [cjh] */
34-
char *be_user = NULL;
35-
36-
be_user = getenv( "USER" );
37-
#endif
38-
3932
return Py_BuildValue(
4033
"(ssllsss)",
4134
p->pw_name,
@@ -49,12 +42,7 @@ mkpwent(struct passwd *p)
4942
(long)p->pw_uid,
5043
(long)p->pw_gid,
5144
#endif
52-
#ifdef __BEOS__
53-
/* BeOS doesn't have a GECOS field, oddly enough. - [cjh] */
54-
be_user ? be_user : "baron",
55-
#else
5645
p->pw_gecos,
57-
#endif
5846
p->pw_dir,
5947
p->pw_shell);
6048
}

Modules/timemodule.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,10 @@ extern int ftime(struct timeb *);
7070
#endif
7171

7272
#ifdef __BEOS__
73+
#include <time.h>
7374
/* For bigtime_t, snooze(). - [cjh] */
7475
#include <support/SupportDefs.h>
7576
#include <kernel/OS.h>
76-
#ifndef CLOCKS_PER_SEC
77-
/* C'mon, fix the bloody headers... - [cjh] */
78-
#define CLOCKS_PER_SEC 1000
79-
#endif
8077
#endif
8178

8279
/* Forward declarations */

0 commit comments

Comments
 (0)