[Python-checkins] CVS: python/dist/src/Lib site.py,1.24,1.25 socket.py,1.7,1.8 urllib.py,1.120,1.121 dumbdbm.py,1.9,1.10 os.py,1.42,1.43 whichdb.py,1.9,1.10
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 01 Mar 2001 22:43:51 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv14767
Modified Files:
site.py socket.py urllib.py dumbdbm.py os.py whichdb.py
Log Message:
RISCOS changes by dschwertberger.
Index: site.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** site.py 2001/01/19 21:54:59 1.24
--- site.py 2001/03/02 06:43:49 1.25
***************
*** 60,63 ****
--- 60,69 ----
import sys, os
+ if os.sep==".":
+ endsep = "/"
+ else:
+ endsep = "."
+
+
def makepath(*paths):
dir = os.path.join(*paths)
***************
*** 100,104 ****
names.sort()
for name in names:
! if name[-4:] == ".pth":
addpackage(sitedir, name)
--- 106,110 ----
names.sort()
for name in names:
! if name[-4:] == endsep + "pth":
addpackage(sitedir, name)
Index: socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** socket.py 2001/02/15 22:15:13 1.7
--- socket.py 2001/03/02 06:43:49 1.8
***************
*** 49,53 ****
if (sys.platform.lower().startswith("win")
! or (hasattr(os, 'uname') and os.uname()[0] == "BeOS")):
# be sure this happens only once, even in the face of reload():
--- 49,54 ----
if (sys.platform.lower().startswith("win")
! or (hasattr(os, 'uname') and os.uname()[0] == "BeOS")
! or (sys.platform=="RISCOS")):
# be sure this happens only once, even in the face of reload():
Index: urllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v
retrieving revision 1.120
retrieving revision 1.121
diff -C2 -r1.120 -r1.121
*** urllib.py 2001/03/01 04:27:19 1.120
--- urllib.py 2001/03/02 06:43:49 1.121
***************
*** 42,45 ****
--- 42,47 ----
elif os.name == 'nt':
from nturl2path import url2pathname, pathname2url
+ elif os.name == 'riscos':
+ from rourl2path import url2pathname, pathname2url
else:
def url2pathname(pathname):
Index: dumbdbm.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dumbdbm.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** dumbdbm.py 2001/02/18 03:30:53 1.9
--- dumbdbm.py 2001/03/02 06:43:49 1.10
***************
*** 34,40 ****
def __init__(self, file):
! self._dirfile = file + '.dir'
! self._datfile = file + '.dat'
! self._bakfile = file + '.bak'
# Mod by Jack: create data file if needed
try:
--- 34,44 ----
def __init__(self, file):
! if _os.sep == '.':
! endsep = '/'
! else:
! endsep = '.'
! self._dirfile = file + endsep + 'dir'
! self._datfile = file + endsep + 'dat'
! self._bakfile = file + endsep + 'bak'
# Mod by Jack: create data file if needed
try:
Index: os.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -r1.42 -r1.43
*** os.py 2001/02/28 01:00:58 1.42
--- os.py 2001/03/02 06:43:49 1.43
***************
*** 4,8 ****
- all functions from posix, nt, dos, os2, mac, or ce, e.g. unlink, stat, etc.
- os.path is one of the modules posixpath, ntpath, macpath, or dospath
! - os.name is 'posix', 'nt', 'dos', 'os2', 'mac', or 'ce'
- os.curdir is a string representing the current directory ('.' or ':')
- os.pardir is a string representing the parent directory ('..' or '::')
--- 4,8 ----
- all functions from posix, nt, dos, os2, mac, or ce, e.g. unlink, stat, etc.
- os.path is one of the modules posixpath, ntpath, macpath, or dospath
! - os.name is 'posix', 'nt', 'dos', 'os2', 'mac', 'ce' or 'riscos'
- os.curdir is a string representing the current directory ('.' or ':')
- os.pardir is a string representing the parent directory ('..' or '::')
***************
*** 148,151 ****
--- 148,170 ----
del ce
+ elif 'riscos' in _names:
+ name = 'riscos'
+ linesep = '\n'
+ curdir = '@'; pardir = '^'; sep = '.'; pathsep = ','
+ defpath = '<Run$Dir>'
+ from riscos import *
+ try:
+ from riscos import _exit
+ except ImportError:
+ pass
+ import riscospath
+ path = riscospath
+ del riscospath
+ from riscosenviron import environ
+
+ import riscos
+ __all__.extend(_get_exports_list(riscos))
+ del ce
+
else:
raise ImportError, 'no os specific module found'
***************
*** 318,330 ****
raise exc, arg
- # Change environ to automatically call putenv() if it exists
- try:
- # This will fail if there's no putenv
- putenv
- except NameError:
- pass
- else:
- import UserDict
if name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE
# But we store them as upper case
--- 337,351 ----
raise exc, arg
+ if name != "riscos":
+ # Change environ to automatically call putenv() if it exists
+ try:
+ # This will fail if there's no putenv
+ putenv
+ except NameError:
+ pass
+ else:
+ import UserDict
+
if name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE
# But we store them as upper case
***************
*** 363,373 ****
environ = _Environ(environ)
-
- def getenv(key, default=None):
- """Get an environment variable, return None if it doesn't exist.
! The optional second argument can specify an alternate default."""
! return environ.get(key, default)
! __all__.append("getenv")
def _exists(name):
--- 384,393 ----
environ = _Environ(environ)
! def getenv(key, default=None):
! """Get an environment variable, return None if it doesn't exist.
! The optional second argument can specify an alternate default."""
! return environ.get(key, default)
! __all__.append("getenv")
def _exists(name):
Index: whichdb.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/whichdb.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** whichdb.py 2001/03/01 04:13:51 1.9
--- whichdb.py 2001/03/02 06:43:49 1.10
***************
*** 1,4 ****
--- 1,11 ----
"""Guess which db package to use to open a db file."""
+ import os
+
+ if os.sep==".":
+ endsep = "/"
+ else:
+ endsep = "."
+
def whichdb(filename):
"""Guess which db package to use to open a db file.
***************
*** 18,24 ****
# Check for dbm first -- this has a .pag and a .dir file
try:
! f = open(filename + ".pag", "rb")
f.close()
! f = open(filename + ".dir", "rb")
f.close()
return "dbm"
--- 25,31 ----
# Check for dbm first -- this has a .pag and a .dir file
try:
! f = open(filename + endsep + "pag", "rb")
f.close()
! f = open(filename + endsep + "dir", "rb")
f.close()
return "dbm"
***************
*** 28,34 ****
# Check for dumbdbm next -- this has a .dir and and a .dat file
try:
! f = open(filename + ".dat", "rb")
f.close()
! f = open(filename + ".dir", "rb")
try:
if f.read(1) in ["'", '"']:
--- 35,41 ----
# Check for dumbdbm next -- this has a .dir and and a .dat file
try:
! f = open(filename + endsep + "dat", "rb")
f.close()
! f = open(filename + endsep + "dir", "rb")
try:
if f.read(1) in ["'", '"']: