#16135: Removal of OS/2 support (Remove OS2 and OS/2 references)

This commit is contained in:
Jesus Cea 2012-10-05 02:48:46 +02:00
parent 080a2c087e
commit f1af705720
18 changed files with 14 additions and 878 deletions

View File

@ -106,8 +106,6 @@ def whichdb(filename):
try: try:
f = io.open(filename + ".pag", "rb") f = io.open(filename + ".pag", "rb")
f.close() f.close()
# dbm linked with gdbm on OS/2 doesn't have .dir file
if not (ndbm.library == "GNU gdbm" and sys.platform == "os2emx"):
f = io.open(filename + ".dir", "rb") f = io.open(filename + ".dir", "rb")
f.close() f.close()
return "dbm.ndbm" return "dbm.ndbm"

View File

@ -22,9 +22,6 @@ import email.generator
import io import io
import contextlib import contextlib
try: try:
if sys.platform == 'os2emx':
# OS/2 EMX fcntl() not adequate
raise ImportError
import fcntl import fcntl
except ImportError: except ImportError:
fcntl = None fcntl = None

View File

@ -30,9 +30,6 @@ altsep = '/'
defpath = '.;C:\\bin' defpath = '.;C:\\bin'
if 'ce' in sys.builtin_module_names: if 'ce' in sys.builtin_module_names:
defpath = '\\Windows' defpath = '\\Windows'
elif 'os2' in sys.builtin_module_names:
# OS/2 w/ VACPP
altsep = '/'
devnull = 'nul' devnull = 'nul'
def _get_empty(path): def _get_empty(path):
@ -320,8 +317,7 @@ def dirname(p):
def islink(path): def islink(path):
"""Test whether a path is a symbolic link. """Test whether a path is a symbolic link.
This will always return false for Windows prior to 6.0 This will always return false for Windows prior to 6.0.
and for OS/2.
""" """
try: try:
st = os.lstat(path) st = os.lstat(path)

View File

@ -1,158 +0,0 @@
# Module 'os2emxpath' -- common operations on OS/2 pathnames
"""Common pathname manipulations, OS/2 EMX version.
Instead of importing this module directly, import os and refer to this
module as os.path.
"""
import os
import stat
from genericpath import *
from ntpath import (expanduser, expandvars, isabs, islink, splitdrive,
splitext, split)
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"basename","dirname","commonprefix","getsize","getmtime",
"getatime","getctime", "islink","exists","lexists","isdir","isfile",
"ismount","expanduser","expandvars","normpath","abspath",
"splitunc","curdir","pardir","sep","pathsep","defpath","altsep",
"extsep","devnull","realpath","supports_unicode_filenames"]
# strings representing various path-related bits and pieces
curdir = '.'
pardir = '..'
extsep = '.'
sep = '/'
altsep = '\\'
pathsep = ';'
defpath = '.;C:\\bin'
devnull = 'nul'
# Normalize the case of a pathname and map slashes to backslashes.
# Other normalizations (such as optimizing '../' away) are not done
# (this is done by normpath).
def normcase(s):
"""Normalize case of pathname.
Makes all characters lowercase and all altseps into seps."""
if not isinstance(s, (bytes, str)):
raise TypeError("normcase() argument must be str or bytes, "
"not '{}'".format(s.__class__.__name__))
return s.replace('\\', '/').lower()
# Join two (or more) paths.
def join(a, *p):
"""Join two or more pathname components, inserting sep as needed"""
path = a
for b in p:
if isabs(b):
path = b
elif path == '' or path[-1:] in '/\\:':
path = path + b
else:
path = path + '/' + b
return path
# Parse UNC paths
def splitunc(p):
"""Split a pathname into UNC mount point and relative path specifiers.
Return a 2-tuple (unc, rest); either part may be empty.
If unc is not empty, it has the form '//host/mount' (or similar
using backslashes). unc+rest is always the input path.
Paths containing drive letters never have an UNC part.
"""
if p[1:2] == ':':
return '', p # Drive letter present
firstTwo = p[0:2]
if firstTwo == '/' * 2 or firstTwo == '\\' * 2:
# is a UNC path:
# vvvvvvvvvvvvvvvvvvvv equivalent to drive letter
# \\machine\mountpoint\directories...
# directory ^^^^^^^^^^^^^^^
normp = normcase(p)
index = normp.find('/', 2)
if index == -1:
##raise RuntimeError, 'illegal UNC path: "' + p + '"'
return ("", p)
index = normp.find('/', index + 1)
if index == -1:
index = len(p)
return p[:index], p[index:]
return '', p
# Return the tail (basename) part of a path.
def basename(p):
"""Returns the final component of a pathname"""
return split(p)[1]
# Return the head (dirname) part of a path.
def dirname(p):
"""Returns the directory component of a pathname"""
return split(p)[0]
# alias exists to lexists
lexists = exists
# Is a path a directory?
# Is a path a mount point? Either a root (with or without drive letter)
# or an UNC path with at most a / or \ after the mount point.
def ismount(path):
"""Test whether a path is a mount point (defined as root of drive)"""
unc, rest = splitunc(path)
if unc:
return rest in ("", "/", "\\")
p = splitdrive(path)[1]
return len(p) == 1 and p[0] in '/\\'
# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
def normpath(path):
"""Normalize path, eliminating double slashes, etc."""
path = path.replace('\\', '/')
prefix, path = splitdrive(path)
while path[:1] == '/':
prefix = prefix + '/'
path = path[1:]
comps = path.split('/')
i = 0
while i < len(comps):
if comps[i] == '.':
del comps[i]
elif comps[i] == '..' and i > 0 and comps[i-1] not in ('', '..'):
del comps[i-1:i+1]
i = i - 1
elif comps[i] == '' and i > 0 and comps[i-1] != '':
del comps[i]
else:
i = i + 1
# If the path is now empty, substitute '.'
if not prefix and not comps:
comps.append('.')
return prefix + '/'.join(comps)
# Return an absolute path.
def abspath(path):
"""Return the absolute version of a path"""
if not isabs(path):
path = join(os.getcwd(), path)
return normpath(path)
# realpath is a no-op on systems without islink support
realpath = abspath
supports_unicode_filenames = False

View File

@ -1,82 +0,0 @@
# Generated by h2py from f:/emx/include/netinet/in.h
# Included from sys/param.h
PAGE_SIZE = 0x1000
HZ = 100
MAXNAMLEN = 260
MAXPATHLEN = 260
def htonl(X): return _swapl(X)
def ntohl(X): return _swapl(X)
def htons(X): return _swaps(X)
def ntohs(X): return _swaps(X)
IPPROTO_IP = 0
IPPROTO_ICMP = 1
IPPROTO_IGMP = 2
IPPROTO_GGP = 3
IPPROTO_TCP = 6
IPPROTO_EGP = 8
IPPROTO_PUP = 12
IPPROTO_UDP = 17
IPPROTO_IDP = 22
IPPROTO_TP = 29
IPPROTO_EON = 80
IPPROTO_RAW = 255
IPPROTO_MAX = 256
IPPORT_RESERVED = 1024
IPPORT_USERRESERVED = 5000
def IN_CLASSA(i): return (((int)(i) & 0x80000000) == 0)
IN_CLASSA_NET = 0xff000000
IN_CLASSA_NSHIFT = 24
IN_CLASSA_HOST = 0x00ffffff
IN_CLASSA_MAX = 128
def IN_CLASSB(i): return (((int)(i) & 0xc0000000) == 0x80000000)
IN_CLASSB_NET = 0xffff0000
IN_CLASSB_NSHIFT = 16
IN_CLASSB_HOST = 0x0000ffff
IN_CLASSB_MAX = 65536
def IN_CLASSC(i): return (((int)(i) & 0xe0000000) == 0xc0000000)
IN_CLASSC_NET = 0xffffff00
IN_CLASSC_NSHIFT = 8
IN_CLASSC_HOST = 0x000000ff
def IN_CLASSD(i): return (((int)(i) & 0xf0000000) == 0xe0000000)
IN_CLASSD_NET = 0xf0000000
IN_CLASSD_NSHIFT = 28
IN_CLASSD_HOST = 0x0fffffff
def IN_MULTICAST(i): return IN_CLASSD(i)
def IN_EXPERIMENTAL(i): return (((int)(i) & 0xe0000000) == 0xe0000000)
def IN_BADCLASS(i): return (((int)(i) & 0xf0000000) == 0xf0000000)
INADDR_ANY = 0x00000000
INADDR_LOOPBACK = 0x7f000001
INADDR_BROADCAST = 0xffffffff
INADDR_NONE = 0xffffffff
INADDR_UNSPEC_GROUP = 0xe0000000
INADDR_ALLHOSTS_GROUP = 0xe0000001
INADDR_MAX_LOCAL_GROUP = 0xe00000ff
IN_LOOPBACKNET = 127
IP_OPTIONS = 1
IP_MULTICAST_IF = 2
IP_MULTICAST_TTL = 3
IP_MULTICAST_LOOP = 4
IP_ADD_MEMBERSHIP = 5
IP_DROP_MEMBERSHIP = 6
IP_HDRINCL = 2
IP_TOS = 3
IP_TTL = 4
IP_RECVOPTS = 5
IP_RECVRETOPTS = 6
IP_RECVDSTADDR = 7
IP_RETOPTS = 8
IP_DEFAULT_MULTICAST_TTL = 1
IP_DEFAULT_MULTICAST_LOOP = 1
IP_MAX_MEMBERSHIPS = 20

View File

@ -1,106 +0,0 @@
# Generated by h2py from f:/emx/include/sys/socket.h
# Included from sys/types.h
FD_SETSIZE = 256
# Included from sys/uio.h
FREAD = 1
FWRITE = 2
SOCK_STREAM = 1
SOCK_DGRAM = 2
SOCK_RAW = 3
SOCK_RDM = 4
SOCK_SEQPACKET = 5
SO_DEBUG = 0x0001
SO_ACCEPTCONN = 0x0002
SO_REUSEADDR = 0x0004
SO_KEEPALIVE = 0x0008
SO_DONTROUTE = 0x0010
SO_BROADCAST = 0x0020
SO_USELOOPBACK = 0x0040
SO_LINGER = 0x0080
SO_OOBINLINE = 0x0100
SO_L_BROADCAST = 0x0200
SO_RCV_SHUTDOWN = 0x0400
SO_SND_SHUTDOWN = 0x0800
SO_SNDBUF = 0x1001
SO_RCVBUF = 0x1002
SO_SNDLOWAT = 0x1003
SO_RCVLOWAT = 0x1004
SO_SNDTIMEO = 0x1005
SO_RCVTIMEO = 0x1006
SO_ERROR = 0x1007
SO_TYPE = 0x1008
SO_OPTIONS = 0x1010
SOL_SOCKET = 0xffff
AF_UNSPEC = 0
AF_UNIX = 1
AF_INET = 2
AF_IMPLINK = 3
AF_PUP = 4
AF_CHAOS = 5
AF_NS = 6
AF_NBS = 7
AF_ISO = 7
AF_OSI = AF_ISO
AF_ECMA = 8
AF_DATAKIT = 9
AF_CCITT = 10
AF_SNA = 11
AF_DECnet = 12
AF_DLI = 13
AF_LAT = 14
AF_HYLINK = 15
AF_APPLETALK = 16
AF_NB = 17
AF_NETBIOS = AF_NB
AF_OS2 = AF_UNIX
AF_MAX = 18
PF_UNSPEC = AF_UNSPEC
PF_UNIX = AF_UNIX
PF_INET = AF_INET
PF_IMPLINK = AF_IMPLINK
PF_PUP = AF_PUP
PF_CHAOS = AF_CHAOS
PF_NS = AF_NS
PF_NBS = AF_NBS
PF_ISO = AF_ISO
PF_OSI = AF_ISO
PF_ECMA = AF_ECMA
PF_DATAKIT = AF_DATAKIT
PF_CCITT = AF_CCITT
PF_SNA = AF_SNA
PF_DECnet = AF_DECnet
PF_DLI = AF_DLI
PF_LAT = AF_LAT
PF_HYLINK = AF_HYLINK
PF_APPLETALK = AF_APPLETALK
PF_NB = AF_NB
PF_NETBIOS = AF_NB
PF_OS2 = AF_UNIX
PF_MAX = AF_MAX
SOMAXCONN = 5
MSG_OOB = 0x1
MSG_PEEK = 0x2
MSG_DONTROUTE = 0x4
MSG_EOR = 0x8
MSG_TRUNC = 0x10
MSG_CTRUNC = 0x20
MSG_WAITALL = 0x40
MSG_MAXIOVLEN = 16
SCM_RIGHTS = 0x01
MT_FREE = 0
MT_DATA = 1
MT_HEADER = 2
MT_SOCKET = 3
MT_PCB = 4
MT_RTABLE = 5
MT_HTABLE = 6
MT_ATABLE = 7
MT_SONAME = 8
MT_ZOMBIE = 9
MT_SOOPTS = 10
MT_FTABLE = 11
MT_RIGHTS = 12
MT_IFADDR = 13
MAXSOCKETS = 2048

View File

@ -1,79 +0,0 @@
# _emx_link.py
# Written by Andrew I MacIntyre, December 2002.
"""_emx_link.py is a simplistic emulation of the Unix link(2) library routine
for creating so-called hard links. It is intended to be imported into
the os module in place of the unimplemented (on OS/2) Posix link()
function (os.link()).
We do this on OS/2 by implementing a file copy, with link(2) semantics:-
- the target cannot already exist;
- we hope that the actual file open (if successful) is actually
atomic...
Limitations of this approach/implementation include:-
- no support for correct link counts (EMX stat(target).st_nlink
is always 1);
- thread safety undefined;
- default file permissions (r+w) used, can't be over-ridden;
- implemented in Python so comparatively slow, especially for large
source files;
- need sufficient free disk space to store the copy.
Behaviour:-
- any exception should propagate to the caller;
- want target to be an exact copy of the source, so use binary mode;
- returns None, same as os.link() which is implemented in posixmodule.c;
- target removed in the event of a failure where possible;
- given the motivation to write this emulation came from trying to
support a Unix resource lock implementation, where minimal overhead
during creation of the target is desirable and the files are small,
we read a source block before attempting to create the target so that
we're ready to immediately write some data into it.
"""
import os
import errno
__all__ = ['link']
def link(source, target):
"""link(source, target) -> None
Attempt to hard link the source file to the target file name.
On OS/2, this creates a complete copy of the source file.
"""
s = os.open(source, os.O_RDONLY | os.O_BINARY)
if os.isatty(s):
raise OSError(errno.EXDEV, 'Cross-device link')
data = os.read(s, 1024)
try:
t = os.open(target, os.O_WRONLY | os.O_BINARY | os.O_CREAT | os.O_EXCL)
except OSError:
os.close(s)
raise
try:
while data:
os.write(t, data)
data = os.read(s, 1024)
except OSError:
os.close(s)
os.close(t)
os.unlink(target)
raise
os.close(s)
os.close(t)
if __name__ == '__main__':
import sys
try:
link(sys.argv[1], sys.argv[2])
except IndexError:
print('Usage: emx_link <source> <target>')
except OSError:
print('emx_link: %s' % str(sys.exc_info()[1]))

View File

@ -1,182 +0,0 @@
# this module is an OS/2 oriented replacement for the grp standard
# extension module.
# written by Andrew MacIntyre, April 2001.
# updated July 2003, adding field accessor support
# note that this implementation checks whether ":" or ";" as used as
# the field separator character.
"""Replacement for grp standard extension module, intended for use on
OS/2 and similar systems which don't normally have an /etc/group file.
The standard Unix group database is an ASCII text file with 4 fields per
record (line), separated by a colon:
- group name (string)
- group password (optional encrypted string)
- group id (integer)
- group members (comma delimited list of userids, with no spaces)
Note that members are only included in the group file for groups that
aren't their primary groups.
(see the section 8.2 of the Python Library Reference)
This implementation differs from the standard Unix implementation by
allowing use of the platform's native path separator character - ';' on OS/2,
DOS and MS-Windows - as the field separator in addition to the Unix
standard ":".
The module looks for the group database at the following locations
(in order first to last):
- ${ETC_GROUP} (or %ETC_GROUP%)
- ${ETC}/group (or %ETC%/group)
- ${PYTHONHOME}/Etc/group (or %PYTHONHOME%/Etc/group)
Classes
-------
None
Functions
---------
getgrgid(gid) - return the record for group-id gid as a 4-tuple
getgrnam(name) - return the record for group 'name' as a 4-tuple
getgrall() - return a list of 4-tuples, each tuple being one record
(NOTE: the order is arbitrary)
Attributes
----------
group_file - the path of the group database file
"""
import os
# try and find the group file
__group_path = []
if 'ETC_GROUP' in os.environ:
__group_path.append(os.environ['ETC_GROUP'])
if 'ETC' in os.environ:
__group_path.append('%s/group' % os.environ['ETC'])
if 'PYTHONHOME' in os.environ:
__group_path.append('%s/Etc/group' % os.environ['PYTHONHOME'])
group_file = None
for __i in __group_path:
try:
__f = open(__i, 'r')
__f.close()
group_file = __i
break
except:
pass
# decide what field separator we can try to use - Unix standard, with
# the platform's path separator as an option. No special field conversion
# handlers are required for the group file.
__field_sep = [':']
if os.pathsep:
if os.pathsep != ':':
__field_sep.append(os.pathsep)
# helper routine to identify which separator character is in use
def __get_field_sep(record):
fs = None
for c in __field_sep:
# there should be 3 delimiter characters (for 4 fields)
if record.count(c) == 3:
fs = c
break
if fs:
return fs
else:
raise KeyError('>> group database fields not delimited <<')
# class to match the new record field name accessors.
# the resulting object is intended to behave like a read-only tuple,
# with each member also accessible by a field name.
class Group:
def __init__(self, name, passwd, gid, mem):
self.__dict__['gr_name'] = name
self.__dict__['gr_passwd'] = passwd
self.__dict__['gr_gid'] = gid
self.__dict__['gr_mem'] = mem
self.__dict__['_record'] = (self.gr_name, self.gr_passwd,
self.gr_gid, self.gr_mem)
def __len__(self):
return 4
def __getitem__(self, key):
return self._record[key]
def __setattr__(self, name, value):
raise AttributeError('attribute read-only: %s' % name)
def __repr__(self):
return str(self._record)
def __cmp__(self, other):
this = str(self._record)
if this == other:
return 0
elif this < other:
return -1
else:
return 1
# read the whole file, parsing each entry into tuple form
# with dictionaries to speed recall by GID or group name
def __read_group_file():
if group_file:
group = open(group_file, 'r')
else:
raise KeyError('>> no group database <<')
gidx = {}
namx = {}
sep = None
while 1:
entry = group.readline().strip()
if len(entry) > 3:
if sep is None:
sep = __get_field_sep(entry)
fields = entry.split(sep)
fields[2] = int(fields[2])
fields[3] = [f.strip() for f in fields[3].split(',')]
record = Group(*fields)
if fields[2] not in gidx:
gidx[fields[2]] = record
if fields[0] not in namx:
namx[fields[0]] = record
elif len(entry) > 0:
pass # skip empty or malformed records
else:
break
group.close()
if len(gidx) == 0:
raise KeyError
return (gidx, namx)
# return the group database entry by GID
def getgrgid(gid):
g, n = __read_group_file()
return g[gid]
# return the group database entry by group name
def getgrnam(name):
g, n = __read_group_file()
return n[name]
# return all the group database entries
def getgrall():
g, n = __read_group_file()
return g.values()
# test harness
if __name__ == '__main__':
getgrall()

View File

@ -1,208 +0,0 @@
# this module is an OS/2 oriented replacement for the pwd standard
# extension module.
# written by Andrew MacIntyre, April 2001.
# updated July 2003, adding field accessor support
# note that this implementation checks whether ":" or ";" as used as
# the field separator character. Path conversions are are applied when
# the database uses ":" as the field separator character.
"""Replacement for pwd standard extension module, intended for use on
OS/2 and similar systems which don't normally have an /etc/passwd file.
The standard Unix password database is an ASCII text file with 7 fields
per record (line), separated by a colon:
- user name (string)
- password (encrypted string, or "*" or "")
- user id (integer)
- group id (integer)
- description (usually user's name)
- home directory (path to user's home directory)
- shell (path to the user's login shell)
(see the section 8.1 of the Python Library Reference)
This implementation differs from the standard Unix implementation by
allowing use of the platform's native path separator character - ';' on OS/2,
DOS and MS-Windows - as the field separator in addition to the Unix
standard ":". Additionally, when ":" is the separator path conversions
are applied to deal with any munging of the drive letter reference.
The module looks for the password database at the following locations
(in order first to last):
- ${ETC_PASSWD} (or %ETC_PASSWD%)
- ${ETC}/passwd (or %ETC%/passwd)
- ${PYTHONHOME}/Etc/passwd (or %PYTHONHOME%/Etc/passwd)
Classes
-------
None
Functions
---------
getpwuid(uid) - return the record for user-id uid as a 7-tuple
getpwnam(name) - return the record for user 'name' as a 7-tuple
getpwall() - return a list of 7-tuples, each tuple being one record
(NOTE: the order is arbitrary)
Attributes
----------
passwd_file - the path of the password database file
"""
import os
# try and find the passwd file
__passwd_path = []
if 'ETC_PASSWD' in os.environ:
__passwd_path.append(os.environ['ETC_PASSWD'])
if 'ETC' in os.environ:
__passwd_path.append('%s/passwd' % os.environ['ETC'])
if 'PYTHONHOME' in os.environ:
__passwd_path.append('%s/Etc/passwd' % os.environ['PYTHONHOME'])
passwd_file = None
for __i in __passwd_path:
try:
__f = open(__i, 'r')
__f.close()
passwd_file = __i
break
except:
pass
# path conversion handlers
def __nullpathconv(path):
return path.replace(os.altsep, os.sep)
def __unixpathconv(path):
# two known drive letter variations: "x;" and "$x"
if path[0] == '$':
conv = path[1] + ':' + path[2:]
elif path[1] == ';':
conv = path[0] + ':' + path[2:]
else:
conv = path
return conv.replace(os.altsep, os.sep)
# decide what field separator we can try to use - Unix standard, with
# the platform's path separator as an option. No special field conversion
# handler is required when using the platform's path separator as field
# separator, but are required for the home directory and shell fields when
# using the standard Unix (":") field separator.
__field_sep = {':': __unixpathconv}
if os.pathsep:
if os.pathsep != ':':
__field_sep[os.pathsep] = __nullpathconv
# helper routine to identify which separator character is in use
def __get_field_sep(record):
fs = None
for c in __field_sep.keys():
# there should be 6 delimiter characters (for 7 fields)
if record.count(c) == 6:
fs = c
break
if fs:
return fs
else:
raise KeyError('>> passwd database fields not delimited <<')
# class to match the new record field name accessors.
# the resulting object is intended to behave like a read-only tuple,
# with each member also accessible by a field name.
class Passwd:
def __init__(self, name, passwd, uid, gid, gecos, dir, shell):
self.__dict__['pw_name'] = name
self.__dict__['pw_passwd'] = passwd
self.__dict__['pw_uid'] = uid
self.__dict__['pw_gid'] = gid
self.__dict__['pw_gecos'] = gecos
self.__dict__['pw_dir'] = dir
self.__dict__['pw_shell'] = shell
self.__dict__['_record'] = (self.pw_name, self.pw_passwd,
self.pw_uid, self.pw_gid,
self.pw_gecos, self.pw_dir,
self.pw_shell)
def __len__(self):
return 7
def __getitem__(self, key):
return self._record[key]
def __setattr__(self, name, value):
raise AttributeError('attribute read-only: %s' % name)
def __repr__(self):
return str(self._record)
def __cmp__(self, other):
this = str(self._record)
if this == other:
return 0
elif this < other:
return -1
else:
return 1
# read the whole file, parsing each entry into tuple form
# with dictionaries to speed recall by UID or passwd name
def __read_passwd_file():
if passwd_file:
passwd = open(passwd_file, 'r')
else:
raise KeyError('>> no password database <<')
uidx = {}
namx = {}
sep = None
while True:
entry = passwd.readline().strip()
if len(entry) > 6:
if sep is None:
sep = __get_field_sep(entry)
fields = entry.split(sep)
for i in (2, 3):
fields[i] = int(fields[i])
for i in (5, 6):
fields[i] = __field_sep[sep](fields[i])
record = Passwd(*fields)
if fields[2] not in uidx:
uidx[fields[2]] = record
if fields[0] not in namx:
namx[fields[0]] = record
elif len(entry) > 0:
pass # skip empty or malformed records
else:
break
passwd.close()
if len(uidx) == 0:
raise KeyError
return (uidx, namx)
# return the passwd database entry by UID
def getpwuid(uid):
u, n = __read_passwd_file()
return u[uid]
# return the passwd database entry by passwd name
def getpwnam(name):
u, n = __read_passwd_file()
return n[name]
# return all the passwd database entries
def getpwall():
u, n = __read_passwd_file()
return n.values()
# test harness
if __name__ == '__main__':
getpwall()

View File

@ -1,7 +0,0 @@
#! /bin/sh
export INCLUDE=$C_INCLUDE_PATH
set -v
python.exe ../../Tools/scripts/h2py.py $C_INCLUDE_PATH/fcntl.h
python.exe ../../Tools/scripts/h2py.py $C_INCLUDE_PATH/sys/socket.h
python.exe ../../Tools/scripts/h2py.py -i '(u_long)' $C_INCLUDE_PATH/netinet/in.h
#python.exe ../../Tools/scripts/h2py.py $C_INCLUDE_PATH/termios.h

View File

@ -403,13 +403,13 @@ _ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) '
def _syscmd_ver(system='', release='', version='', def _syscmd_ver(system='', release='', version='',
supported_platforms=('win32','win16','dos','os2')): supported_platforms=('win32','win16','dos')):
""" Tries to figure out the OS version used and returns """ Tries to figure out the OS version used and returns
a tuple (system,release,version). a tuple (system,release,version).
It uses the "ver" shell command for this which is known It uses the "ver" shell command for this which is known
to exists on Windows, DOS and OS/2. XXX Others too ? to exists on Windows, DOS. XXX Others too ?
In case this fails, the given parameters are used as In case this fails, the given parameters are used as
defaults. defaults.

View File

@ -1,7 +1,4 @@
"""Test program for the fcntl C module. """Test program for the fcntl C module.
OS/2+EMX doesn't support the file locking operations.
""" """
import os import os
import struct import struct
@ -35,8 +32,6 @@ def get_lockdata():
fcntl.F_WRLCK, 0) fcntl.F_WRLCK, 0)
elif sys.platform in ['aix3', 'aix4', 'hp-uxB', 'unixware7']: elif sys.platform in ['aix3', 'aix4', 'hp-uxB', 'unixware7']:
lockdata = struct.pack('hhlllii', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) lockdata = struct.pack('hhlllii', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
elif sys.platform in ['os2emx']:
lockdata = None
else: else:
lockdata = struct.pack('hh'+start_len+'hh', fcntl.F_WRLCK, 0, 0, 0, 0, 0) lockdata = struct.pack('hh'+start_len+'hh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)
if lockdata: if lockdata:
@ -62,7 +57,6 @@ class TestFcntl(unittest.TestCase):
rv = fcntl.fcntl(self.f.fileno(), fcntl.F_SETFL, os.O_NONBLOCK) rv = fcntl.fcntl(self.f.fileno(), fcntl.F_SETFL, os.O_NONBLOCK)
if verbose: if verbose:
print('Status from fcntl with O_NONBLOCK: ', rv) print('Status from fcntl with O_NONBLOCK: ', rv)
if sys.platform not in ['os2emx']:
rv = fcntl.fcntl(self.f.fileno(), fcntl.F_SETLKW, lockdata) rv = fcntl.fcntl(self.f.fileno(), fcntl.F_SETLKW, lockdata)
if verbose: if verbose:
print('String from fcntl with F_SETLKW: ', repr(rv)) print('String from fcntl with F_SETLKW: ', repr(rv))
@ -72,7 +66,6 @@ class TestFcntl(unittest.TestCase):
# again, but pass the file rather than numeric descriptor # again, but pass the file rather than numeric descriptor
self.f = open(TESTFN, 'wb') self.f = open(TESTFN, 'wb')
rv = fcntl.fcntl(self.f, fcntl.F_SETFL, os.O_NONBLOCK) rv = fcntl.fcntl(self.f, fcntl.F_SETFL, os.O_NONBLOCK)
if sys.platform not in ['os2emx']:
rv = fcntl.fcntl(self.f, fcntl.F_SETLKW, lockdata) rv = fcntl.fcntl(self.f, fcntl.F_SETLKW, lockdata)
self.f.close() self.f.close()

View File

@ -27,7 +27,7 @@ TEST_STR = b"hello world\n"
HOST = test.support.HOST HOST = test.support.HOST
HAVE_UNIX_SOCKETS = hasattr(socket, "AF_UNIX") HAVE_UNIX_SOCKETS = hasattr(socket, "AF_UNIX")
HAVE_FORKING = hasattr(os, "fork") and os.name != "os2" HAVE_FORKING = hasattr(os, "fork")
def signal_alarm(n): def signal_alarm(n):
"""Call signal.alarm when it exists (i.e. not on Windows).""" """Call signal.alarm when it exists (i.e. not on Windows)."""
@ -93,21 +93,7 @@ class SocketServerTest(unittest.TestCase):
# XXX: We need a way to tell AF_UNIX to pick its own name # XXX: We need a way to tell AF_UNIX to pick its own name
# like AF_INET provides port==0. # like AF_INET provides port==0.
dir = None dir = None
if os.name == 'os2':
dir = '\socket'
fn = tempfile.mktemp(prefix='unix_socket.', dir=dir) fn = tempfile.mktemp(prefix='unix_socket.', dir=dir)
if os.name == 'os2':
# AF_UNIX socket names on OS/2 require a specific prefix
# which can't include a drive letter and must also use
# backslashes as directory separators
if fn[1] == ':':
fn = fn[2:]
if fn[0] in (os.sep, os.altsep):
fn = fn[1:]
if os.sep == '/':
fn = fn.replace(os.sep, os.altsep)
else:
fn = fn.replace(os.altsep, os.sep)
self.test_files.append(fn) self.test_files.append(fn)
return fn return fn

View File

@ -638,17 +638,6 @@ if sys.platform == 'darwin':
register("MacOSX", None, MacOSXOSAScript('default'), -1) register("MacOSX", None, MacOSXOSAScript('default'), -1)
#
# Platform support for OS/2
#
if sys.platform[:3] == "os2" and _iscommand("netscape"):
_tryorder = []
_browsers = {}
register("os2netscape", None,
GenericBrowser(["start", "netscape", "%s"]), -1)
# OK, now that we know what the default preference orders for each # OK, now that we know what the default preference orders for each
# platform are, allow user to override them with the BROWSER variable. # platform are, allow user to override them with the BROWSER variable.
if "BROWSER" in os.environ: if "BROWSER" in os.environ:

View File

@ -83,8 +83,7 @@ with very clear syntax. It has interfaces to many system calls and
libraries, as well as to various window systems, and is extensible in C or libraries, as well as to various window systems, and is extensible in C or
C++. It is also usable as an extension language for applications that need C++. It is also usable as an extension language for applications that need
a programmable interface. Finally, Python is portable: it runs on many a programmable interface. Finally, Python is portable: it runs on many
brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the brands of UNIX, on PCs under Windows, MS-DOS, and on the Mac.
Mac.
%package devel %package devel
Summary: The libraries and header files needed for Python extension development. Summary: The libraries and header files needed for Python extension development.

View File

@ -1,6 +1,6 @@
/* Return the initial module search path. */ /* Return the initial module search path. */
/* Used by DOS, OS/2, Windows 3.1, Windows 95/98, Windows NT. */ /* Used by DOS, Windows 3.1, Windows 95/98, Windows NT. */
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
PATH RULES FOR WINDOWS: PATH RULES FOR WINDOWS:

View File

@ -808,7 +808,7 @@ standard libraries, and can be learned in a few days. Many Python
programmers report substantial productivity gains and feel the language programmers report substantial productivity gains and feel the language
encourages the development of higher quality, more maintainable code. encourages the development of higher quality, more maintainable code.
Python runs on Windows, Linux/Unix, Mac OS X, OS/2, Amiga, Palm Python runs on Windows, Linux/Unix, Mac OS X, Amiga, Palm
Handhelds, and Nokia mobile phones. Python has also been ported to the Handhelds, and Nokia mobile phones. Python has also been ported to the
Java and .NET virtual machines. Java and .NET virtual machines.

View File

@ -2103,7 +2103,7 @@ is also usable as an extension language for applications that need a
programmable interface. programmable interface.
The Python implementation is portable: it runs on many brands of UNIX, The Python implementation is portable: it runs on many brands of UNIX,
on Windows, DOS, OS/2, Mac, Amiga... If your favorite system isn't on Windows, DOS, Mac, Amiga... If your favorite system isn't
listed here, it may still be supported, if there's a C compiler for listed here, it may still be supported, if there's a C compiler for
it. Ask around on comp.lang.python -- or just try compiling Python it. Ask around on comp.lang.python -- or just try compiling Python
yourself. yourself.