Commit 7a98be2e authored by Skip Montanaro's avatar Skip Montanaro

Remove RISCOS support

parent c5aba174
......@@ -64,7 +64,7 @@ module.
The name of the operating system dependent module imported. The following names
have currently been registered: ``'posix'``, ``'nt'``, ``'mac'``, ``'os2'``,
``'ce'``, ``'java'``, ``'riscos'``.
``'ce'``, ``'java'``.
.. data:: path
......@@ -1058,9 +1058,6 @@ Files and Directories
On Mac OS systems, the following attributes may also be available:
:attr:`st_rsize`, :attr:`st_creator`, :attr:`st_type`.
On RISCOS systems, the following attributes are also available: :attr:`st_ftype`
(file type), :attr:`st_attrs` (attributes), :attr:`st_obtype` (object type).
.. index:: module: stat
For backward compatibility, the return value of :func:`stat` is also accessible
......
......@@ -23,13 +23,6 @@ extern "C" {
#endif
#endif
#ifdef RISCOS
#define SEP '.'
#define MAXPATHLEN 256
#define DELIM ','
#endif
/* Filename separator */
#ifndef SEP
#define SEP '/'
......
......@@ -261,11 +261,6 @@ typedef Py_intptr_t Py_ssize_t;
#define HAVE_FSTAT
#endif
#ifdef RISCOS
#include <sys/types.h>
#include "unixstuff.h"
#endif
#ifdef HAVE_SYS_STAT_H
#if defined(PYOS_OS2) && defined(PYCC_GCC)
#include <sys/types.h>
......@@ -677,8 +672,7 @@ extern double hypot(double, double);
* Hide GCC attributes from compilers that don't support them.
*/
#if (!defined(__GNUC__) || __GNUC__ < 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) && \
!defined(RISCOS)
(__GNUC__ == 2 && __GNUC_MINOR__ < 7) )
#define Py_GCC_ATTRIBUTE(x)
#else
#define Py_GCC_ATTRIBUTE(x) __attribute__(x)
......
......@@ -9,10 +9,7 @@ from distutils.errors import DistutilsOptionError
# Extension for Python source files.
if hasattr(os, 'extsep'):
PYTHON_SOURCE_EXTENSION = os.extsep + "py"
else:
PYTHON_SOURCE_EXTENSION = ".py"
PYTHON_SOURCE_EXTENSION = ".py"
class install_lib (Command):
......
......@@ -51,14 +51,14 @@ class _Database(UserDict.DictMixin):
# where key is the string key, pos is the offset into the dat
# file of the associated value's first byte, and siz is the number
# of bytes in the associated value.
self._dirfile = filebasename + _os.extsep + 'dir'
self._dirfile = filebasename + '.dir'
# The data file is a binary file pointed into by the directory
# file, and holds the values associated with keys. Each value
# begins at a _BLOCKSIZE-aligned byte offset, and is a raw
# binary 8-bit string value.
self._datfile = filebasename + _os.extsep + 'dat'
self._bakfile = filebasename + _os.extsep + 'bak'
self._datfile = filebasename + '.dat'
self._bakfile = filebasename + '.bak'
# The index is an in-memory dict, mirroring the directory file.
self._index = None # maps keys to (pos, siz) pairs
......
......@@ -315,7 +315,7 @@ class FileInput:
else:
if self._inplace:
self._backupfilename = (
self._filename + (self._backup or os.extsep+"bak"))
self._filename + (self._backup or ".bak"))
try: os.unlink(self._backupfilename)
except os.error: pass
# The next few lines may raise IOError
......
......@@ -7,7 +7,6 @@ This exports:
- os.curdir is a string representing the current directory ('.' or ':')
- os.pardir is a string representing the parent directory ('..' or '::')
- os.sep is the (or a most common) pathname separator ('/' or ':' or '\\')
- os.extsep is the extension separator ('.' or '/')
- os.altsep is the alternate pathname separator (None or '/')
- os.pathsep is the component separator used in $PATH etc
- os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
......@@ -131,8 +130,7 @@ else:
raise ImportError, 'no os specific module found'
sys.modules['os.path'] = path
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
devnull)
from os.path import curdir, pardir, sep, pathsep, defpath, altsep, devnull
del _names
......
......@@ -510,10 +510,8 @@ def extend_path(path, name):
return path
pname = os.path.join(*name.split('.')) # Reconstitute as relative path
# Just in case os.extsep != '.'
sname = os.extsep.join(name.split('.'))
sname_pkg = sname + os.extsep + "pkg"
init_py = "__init__" + os.extsep + "py"
sname_pkg = name + ".pkg"
init_py = "__init__.py"
path = path[:] # Start with a copy of the existing path
......
......@@ -167,7 +167,7 @@ def addsitedir(sitedir, known_paths=None):
return
names.sort()
for name in names:
if name.endswith(os.extsep + "pth"):
if name.endswith(".pth"):
addpackage(sitedir, name, known_paths)
if reset:
known_paths = None
......
......@@ -509,7 +509,7 @@ def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS):
names = os.listdir(testdir)
tests = []
for name in names:
if name[:5] == "test_" and name[-3:] == os.extsep+"py":
if name[:5] == "test_" and name[-3:] == ".py":
modname = name[:-3]
if modname not in stdtests and modname not in nottests:
tests.append(modname)
......@@ -799,7 +799,7 @@ def findtestdir():
return testdir
def removepy(name):
if name.endswith(os.extsep + "py"):
if name.endswith(".py"):
name = name[:-3]
return name
......
......@@ -155,7 +155,7 @@ class ExceptionTests(unittest.TestCase):
exc, err, tb = sys.exc_info()
co = tb.tb_frame.f_code
self.assertEquals(co.co_name, "test_capi1")
self.assert_(co.co_filename.endswith('test_exceptions'+os.extsep+'py'))
self.assert_(co.co_filename.endswith('test_exceptions.py'))
else:
self.fail("Expected exception")
......@@ -167,7 +167,7 @@ class ExceptionTests(unittest.TestCase):
exc, err, tb = sys.exc_info()
co = tb.tb_frame.f_code
self.assertEquals(co.co_name, "__init__")
self.assert_(co.co_filename.endswith('test_exceptions'+os.extsep+'py'))
self.assert_(co.co_filename.endswith('test_exceptions.py'))
co2 = tb.tb_frame.f_back.f_code
self.assertEquals(co2.co_name, "test_capi2")
else:
......
......@@ -10,10 +10,10 @@ from test.test_support import unlink
def remove_files(name):
for f in (name + os.extsep + "py",
name + os.extsep + "pyc",
name + os.extsep + "pyo",
name + os.extsep + "pyw",
for f in (name + ".py",
name + ".pyc",
name + ".pyo",
name + ".pyw",
name + "$py.class"):
if os.path.exists(f):
os.remove(f)
......@@ -39,11 +39,11 @@ class ImportTest(unittest.TestCase):
def test_with_extension(ext):
# ext normally ".py"; perhaps ".pyw"
source = TESTFN + ext
pyo = TESTFN + os.extsep + "pyo"
pyo = TESTFN + ".pyo"
if sys.platform.startswith('java'):
pyc = TESTFN + "$py.class"
else:
pyc = TESTFN + os.extsep + "pyc"
pyc = TESTFN + ".pyc"
f = open(source, "w")
print("# This tests Python's ability to import a", ext, "file.", file=f)
......@@ -71,7 +71,7 @@ class ImportTest(unittest.TestCase):
sys.path.insert(0, os.curdir)
try:
test_with_extension(os.extsep + "py")
test_with_extension(".py")
if sys.platform.startswith("win"):
for ext in ".PY", ".Py", ".pY", ".pyw", ".PYW", ".pYw":
test_with_extension(ext)
......@@ -86,7 +86,7 @@ class ImportTest(unittest.TestCase):
def test_module_with_large_stack(self, module='longlist'):
# create module w/list of 65000 elements to test bug #561858
filename = module + os.extsep + 'py'
filename = module + '.py'
# create a file with a list of 65000 elements
f = open(filename, 'w+')
......@@ -110,13 +110,13 @@ class ImportTest(unittest.TestCase):
# cleanup
del sys.path[-1]
for ext in 'pyc', 'pyo':
fname = module + os.extsep + ext
for ext in '.pyc', '.pyo':
fname = module + ext
if os.path.exists(fname):
os.unlink(fname)
def test_failing_import_sticks(self):
source = TESTFN + os.extsep + "py"
source = TESTFN + ".py"
f = open(source, "w")
print("a = 1/0", file=f)
f.close()
......
......@@ -1687,7 +1687,7 @@ class MaildirTestCase(unittest.TestCase):
t = int(time.time() % 1000000)
pid = self._counter
self._counter += 1
filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain"))
filename = ".".join((str(t), str(pid), "myhostname", "mydomain"))
tmpname = os.path.join(self._dir, "tmp", filename)
newname = os.path.join(self._dir, dir, filename)
fp = open(tmpname, "w")
......
......@@ -20,7 +20,7 @@ if __name__ == "__main__":
base = sys.argv[0]
else:
base = __file__
tstfile = os.path.join(os.path.dirname(base), "test"+os.extsep+"xml")
tstfile = os.path.join(os.path.dirname(base), "test.xml")
del base
# The tests of DocumentType importing use these helpers to construct
......
......@@ -5,7 +5,7 @@ import sys
import os
from unicodedata import normalize
TESTDATAFILE = "NormalizationTest" + os.extsep + "txt"
TESTDATAFILE = "NormalizationTest.txt"
TESTDATAURL = "http://www.unicode.org/Public/4.1.0/ucd/" + TESTDATAFILE
class RangeError(Exception):
......
......@@ -45,7 +45,7 @@ class MaildirTestCase(unittest.TestCase):
t = int(time.time() % 1000000)
pid = self._counter
self._counter += 1
filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain"))
filename = ".".join((str(t), str(pid), "myhostname", "mydomain"))
tmpname = os.path.join(self._dir, "tmp", filename)
newname = os.path.join(self._dir, dir, filename)
fp = open(tmpname, "w")
......
# Test packages (dotted-name import)
import sys, os, tempfile, traceback
from os import mkdir, rmdir, extsep # Can't test if these fail
from os import mkdir, rmdir # Can't test if these fail
del mkdir, rmdir
from test.test_support import verify, verbose, TestFailed
......@@ -77,15 +77,15 @@ def runtest(hier, code):
# Test descriptions
tests = [
("t1", [("t1", None), ("t1 __init__"+os.extsep+"py", "")], "import t1"),
("t1", [("t1", None), ("t1 __init__.py", "")], "import t1"),
("t2", [
("t2", None),
("t2 __init__"+os.extsep+"py", "'doc for t2'; print(__name__, 'loading')"),
("t2 __init__.py", "'doc for t2'; print(__name__, 'loading')"),
("t2 sub", None),
("t2 sub __init__"+os.extsep+"py", ""),
("t2 sub __init__.py", ""),
("t2 sub subsub", None),
("t2 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"),
("t2 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"),
],
"""
import t2
......@@ -111,11 +111,11 @@ print(dir())
("t3", [
("t3", None),
("t3 __init__"+os.extsep+"py", "print(__name__, 'loading')"),
("t3 __init__.py", "print(__name__, 'loading')"),
("t3 sub", None),
("t3 sub __init__"+os.extsep+"py", ""),
("t3 sub __init__.py", ""),
("t3 sub subsub", None),
("t3 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"),
("t3 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"),
],
"""
import t3.sub.subsub
......@@ -123,15 +123,15 @@ print(t3.__name__, t3.sub.__name__, t3.sub.subsub.__name__)
"""),
("t4", [
("t4"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (t4"+os.extsep+"py)')"),
("t4.py", "print('THIS SHOULD NOT BE PRINTED (t4.py)')"),
("t4", None),
("t4 __init__"+os.extsep+"py", "print(__name__, 'loading')"),
("t4 sub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (sub"+os.extsep+"py)')"),
("t4 __init__.py", "print(__name__, 'loading')"),
("t4 sub.py", "print('THIS SHOULD NOT BE PRINTED (sub.py)')"),
("t4 sub", None),
("t4 sub __init__"+os.extsep+"py", ""),
("t4 sub subsub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (subsub"+os.extsep+"py)')"),
("t4 sub __init__.py", ""),
("t4 sub subsub.py", "print('THIS SHOULD NOT BE PRINTED (subsub.py)')"),
("t4 sub subsub", None),
("t4 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"),
("t4 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"),
],
"""
from t4.sub.subsub import *
......@@ -140,9 +140,9 @@ print("t4.sub.subsub.spam =", spam)
("t5", [
("t5", None),
("t5 __init__"+os.extsep+"py", "import t5.foo"),
("t5 string"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"),
("t5 foo"+os.extsep+"py",
("t5 __init__.py", "import t5.foo"),
("t5 string.py", "print(__name__, 'loading'); spam = 1"),
("t5 foo.py",
"print(__name__, 'loading'); from . import string; print(string.spam)"),
],
"""
......@@ -157,10 +157,10 @@ print(fixdir(dir(t5.string)))
("t6", [
("t6", None),
("t6 __init__"+os.extsep+"py", "__all__ = ['spam', 'ham', 'eggs']"),
("t6 spam"+os.extsep+"py", "print(__name__, 'loading')"),
("t6 ham"+os.extsep+"py", "print(__name__, 'loading')"),
("t6 eggs"+os.extsep+"py", "print(__name__, 'loading')"),
("t6 __init__.py", "__all__ = ['spam', 'ham', 'eggs']"),
("t6 spam.py", "print(__name__, 'loading')"),
("t6 ham.py", "print(__name__, 'loading')"),
("t6 eggs.py", "print(__name__, 'loading')"),
],
"""
import t6
......@@ -171,15 +171,15 @@ print(dir())
"""),
("t7", [
("t7"+os.extsep+"py", "print('Importing t7"+os.extsep+"py')"),
("t7.py", "print('Importing t7.py')"),
("t7", None),
("t7 __init__"+os.extsep+"py", "print(__name__, 'loading')"),
("t7 sub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (sub"+os.extsep+"py)')"),
("t7 __init__.py", "print(__name__, 'loading')"),
("t7 sub.py", "print('THIS SHOULD NOT BE PRINTED (sub.py)')"),
("t7 sub", None),
("t7 sub __init__"+os.extsep+"py", ""),
("t7 sub subsub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (subsub"+os.extsep+"py)')"),
("t7 sub __init__.py", ""),
("t7 sub subsub.py", "print('THIS SHOULD NOT BE PRINTED (subsub.py)')"),
("t7 sub subsub", None),
("t7 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"),
("t7 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"),
],
"""
t7, sub, subsub = None, None, None
......
......@@ -22,8 +22,8 @@ class TestImport(unittest.TestCase):
self.package_dir = os.path.join(self.test_dir,
self.package_name)
os.mkdir(self.package_dir)
open(os.path.join(self.package_dir, '__init__'+os.extsep+'py'), 'w')
self.module_path = os.path.join(self.package_dir, 'foo'+os.extsep+'py')
open(os.path.join(self.package_dir, '__init__.py'), 'w')
self.module_path = os.path.join(self.package_dir, 'foo.py')
def tearDown(self):
for file in os.listdir(self.package_dir):
......
......@@ -205,10 +205,10 @@ class LongReprTest(unittest.TestCase):
# Make the package and subpackage
shutil.rmtree(self.pkgname, ignore_errors=True)
os.mkdir(self.pkgname)
touch(os.path.join(self.pkgname, '__init__'+os.extsep+'py'))
touch(os.path.join(self.pkgname, '__init__.py'))
shutil.rmtree(self.subpkgname, ignore_errors=True)
os.mkdir(self.subpkgname)
touch(os.path.join(self.subpkgname, '__init__'+os.extsep+'py'))
touch(os.path.join(self.subpkgname, '__init__.py'))
# Remember where we are
self.here = os.getcwd()
sys.path.insert(0, self.here)
......@@ -228,7 +228,7 @@ class LongReprTest(unittest.TestCase):
def test_module(self):
eq = self.assertEquals
touch(os.path.join(self.subpkgname, self.pkgname + os.extsep + 'py'))
touch(os.path.join(self.subpkgname, self.pkgname + '.py'))
from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import areallylongpackageandmodulenametotestreprtruncation
eq(repr(areallylongpackageandmodulenametotestreprtruncation),
"<module '%s' from '%s'>" % (areallylongpackageandmodulenametotestreprtruncation.__name__, areallylongpackageandmodulenametotestreprtruncation.__file__))
......@@ -236,7 +236,7 @@ class LongReprTest(unittest.TestCase):
def test_type(self):
eq = self.assertEquals
touch(os.path.join(self.subpkgname, 'foo'+os.extsep+'py'), '''\
touch(os.path.join(self.subpkgname, 'foo.py'), '''\
class foo(object):
pass
''')
......@@ -250,7 +250,7 @@ class foo(object):
pass
def test_class(self):
touch(os.path.join(self.subpkgname, 'bar'+os.extsep+'py'), '''\
touch(os.path.join(self.subpkgname, 'bar.py'), '''\
class bar:
pass
''')
......@@ -259,7 +259,7 @@ class bar:
self.assertEquals(repr(bar.bar), "<class '%s.bar'>" % bar.__name__)
def test_instance(self):
touch(os.path.join(self.subpkgname, 'baz'+os.extsep+'py'), '''\
touch(os.path.join(self.subpkgname, 'baz.py'), '''\
class baz:
pass
''')
......@@ -270,7 +270,7 @@ class baz:
def test_method(self):
eq = self.assertEquals
touch(os.path.join(self.subpkgname, 'qux'+os.extsep+'py'), '''\
touch(os.path.join(self.subpkgname, 'qux.py'), '''\
class aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
def amethod(self): pass
''')
......
......@@ -103,14 +103,14 @@ class RunModuleTest(unittest.TestCase):
def _add_pkg_dir(self, pkg_dir):
os.mkdir(pkg_dir)
pkg_fname = os.path.join(pkg_dir, "__init__"+os.extsep+"py")
pkg_fname = os.path.join(pkg_dir, "__init__.py")
pkg_file = open(pkg_fname, "w")
pkg_file.close()
return pkg_fname
def _make_pkg(self, source, depth):
pkg_name = "__runpy_pkg__"
test_fname = "runpy_test"+os.extsep+"py"
test_fname = "runpy_test.py"
pkg_dir = sub_dir = tempfile.mkdtemp()
if verbose: print(" Package tree in:", sub_dir)
sys.path.insert(0, pkg_dir)
......@@ -182,7 +182,7 @@ class RunModuleTest(unittest.TestCase):
parent_dir = module_dir
module_dir = os.path.join(module_dir, pkg_name)
# Add sibling module
sibling_fname = os.path.join(module_dir, "sibling"+os.extsep+"py")
sibling_fname = os.path.join(module_dir, "sibling.py")
sibling_file = open(sibling_fname, "w")
sibling_file.close()
if verbose: print(" Added sibling module:", sibling_fname)
......@@ -193,7 +193,7 @@ class RunModuleTest(unittest.TestCase):
cousin_dir = os.path.join(uncle_dir, "cousin")
self._add_pkg_dir(cousin_dir)
if verbose: print(" Added cousin package:", cousin_dir)
nephew_fname = os.path.join(cousin_dir, "nephew"+os.extsep+"py")
nephew_fname = os.path.join(cousin_dir, "nephew.py")
nephew_file = open(nephew_fname, "w")
nephew_file.close()
if verbose: print(" Added nephew module:", nephew_fname)
......
......@@ -311,7 +311,7 @@ class XMLFilterBaseTest(unittest.TestCase):
#
# ===========================================================================
xml_test_out = open(findfile("test"+os.extsep+"xml"+os.extsep+"out")).read()
xml_test_out = open(findfile("test.xml.out")).read()
class ExpatReaderTest(XmlTestBase):
......@@ -323,7 +323,7 @@ class ExpatReaderTest(XmlTestBase):
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
parser.parse(open(findfile("test"+os.extsep+"xml")))
parser.parse(open(findfile("test.xml")))
self.assertEquals(result.getvalue(), xml_test_out)
......@@ -452,7 +452,7 @@ class ExpatReaderTest(XmlTestBase):
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
parser.parse(findfile("test"+os.extsep+"xml"))
parser.parse(findfile("test.xml"))
self.assertEquals(result.getvalue(), xml_test_out)
......@@ -462,7 +462,7 @@ class ExpatReaderTest(XmlTestBase):
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
parser.parse(InputSource(findfile("test"+os.extsep+"xml")))
parser.parse(InputSource(findfile("test.xml")))
self.assertEquals(result.getvalue(), xml_test_out)
......@@ -473,7 +473,7 @@ class ExpatReaderTest(XmlTestBase):
parser.setContentHandler(xmlgen)
inpsrc = InputSource()
inpsrc.setByteStream(open(findfile("test"+os.extsep+"xml")))
inpsrc.setByteStream(open(findfile("test.xml")))
parser.parse(inpsrc)
self.assertEquals(result.getvalue(), xml_test_out)
......
......@@ -70,11 +70,11 @@ def forget(modname):
deleting any .pyc and .pyo files.'''
unload(modname)
for dirname in sys.path:
unlink(os.path.join(dirname, modname + os.extsep + 'pyc'))
unlink(os.path.join(dirname, modname + '.pyc'))
# Deleting the .pyo file cannot be within the 'try' for the .pyc since
# the chance exists that there is no .pyc (and thus the 'try' statement
# is exited) but there is a .pyo file.
unlink(os.path.join(dirname, modname + os.extsep + 'pyo'))
unlink(os.path.join(dirname, modname + '.pyo'))
def is_resource_enabled(resource):
"""Test whether a resource is enabled. Known resources are set by
......
......@@ -186,14 +186,14 @@ def test_main():
# This displays the tokenization of tokenize_tests.py to stdout, and
# regrtest.py checks that this equals the expected output (in the
# test/output/ directory).
f = open(findfile('tokenize_tests' + os.extsep + 'txt'))
f = open(findfile('tokenize_tests.txt'))
tokenize(f.readline)
f.close()
# Now run test_roundtrip() over tokenize_test.py too, and over all
# (if the "compiler" resource is enabled) or a small random sample (if
# "compiler" is not enabled) of the test*.py files.
f = findfile('tokenize_tests' + os.extsep + 'txt')
f = findfile('tokenize_tests.txt')
test_roundtrip(f)
testdir = os.path.dirname(f) or os.curdir
......
......@@ -29,7 +29,7 @@ class TestsWithSourceFile(unittest.TestCase):
def makeTestArchive(self, f, compression):
# Create the ZIP archive
zipfp = zipfile.ZipFile(f, "w", compression)
zipfp.write(TESTFN, "another"+os.extsep+"name")
zipfp.write(TESTFN, "another.name")
zipfp.write(TESTFN, TESTFN)
zipfp.writestr("strfile", self.data)
zipfp.close()
......@@ -40,7 +40,7 @@ class TestsWithSourceFile(unittest.TestCase):
# Read the ZIP archive
zipfp = zipfile.ZipFile(f, "r", compression)
self.assertEqual(zipfp.read(TESTFN), self.data)
self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data)
self.assertEqual(zipfp.read("another.name"), self.data)
self.assertEqual(zipfp.read("strfile"), self.data)
# Print the ZIP directory
......@@ -64,7 +64,7 @@ class TestsWithSourceFile(unittest.TestCase):
names = zipfp.namelist()
self.assertEquals(len(names), 3)
self.assert_(TESTFN in names)
self.assert_("another"+os.extsep+"name" in names)
self.assert_("another.name" in names)
self.assert_("strfile" in names)
# Check infolist
......@@ -72,13 +72,13 @@ class TestsWithSourceFile(unittest.TestCase):
names = [ i.filename for i in infos ]
self.assertEquals(len(names), 3)
self.assert_(TESTFN in names)
self.assert_("another"+os.extsep+"name" in names)
self.assert_("another.name" in names)
self.assert_("strfile" in names)
for i in infos:
self.assertEquals(i.file_size, len(self.data))
# check getinfo
for nm in (TESTFN, "another"+os.extsep+"name", "strfile"):
for nm in (TESTFN, "another.name", "strfile"):
info = zipfp.getinfo(nm)
self.assertEquals(info.filename, nm)
self.assertEquals(info.file_size, len(self.data))
......@@ -105,7 +105,7 @@ class TestsWithSourceFile(unittest.TestCase):
zipdata1.append(read_data)
zipdata2 = []
zipopen2 = zipfp.open("another"+os.extsep+"name")
zipopen2 = zipfp.open("another.name")
while 1:
read_data = zipopen2.read(256)
if not read_data:
......@@ -313,13 +313,13 @@ class TestZip64InSmallFiles(unittest.TestCase):
def largeFileExceptionTest(self, f, compression):
zipfp = zipfile.ZipFile(f, "w", compression)
self.assertRaises(zipfile.LargeZipFile,
zipfp.write, TESTFN, "another"+os.extsep+"name")
zipfp.write, TESTFN, "another.name")
zipfp.close()
def largeFileExceptionTest2(self, f, compression):
zipfp = zipfile.ZipFile(f, "w", compression)
self.assertRaises(zipfile.LargeZipFile,
zipfp.writestr, "another"+os.extsep+"name", self.data)
zipfp.writestr, "another.name", self.data)
zipfp.close()
def testLargeFileException(self):
......@@ -330,7 +330,7 @@ class TestZip64InSmallFiles(unittest.TestCase):
def zipTest(self, f, compression):
# Create the ZIP archive
zipfp = zipfile.ZipFile(f, "w", compression, allowZip64=True)
zipfp.write(TESTFN, "another"+os.extsep+"name")
zipfp.write(TESTFN, "another.name")
zipfp.write(TESTFN, TESTFN)
zipfp.writestr("strfile", self.data)
zipfp.close()
......@@ -338,7 +338,7 @@ class TestZip64InSmallFiles(unittest.TestCase):
# Read the ZIP archive
zipfp = zipfile.ZipFile(f, "r", compression)
self.assertEqual(zipfp.read(TESTFN), self.data)
self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data)
self.assertEqual(zipfp.read("another.name"), self.data)
self.assertEqual(zipfp.read("strfile"), self.data)
# Print the ZIP directory
......@@ -362,7 +362,7 @@ class TestZip64InSmallFiles(unittest.TestCase):
names = zipfp.namelist()
self.assertEquals(len(names), 3)
self.assert_(TESTFN in names)
self.assert_("another"+os.extsep+"name" in names)
self.assert_("another.name" in names)
self.assert_("strfile" in names)
# Check infolist
......@@ -370,13 +370,13 @@ class TestZip64InSmallFiles(unittest.TestCase):
names = [ i.filename for i in infos ]
self.assertEquals(len(names), 3)
self.assert_(TESTFN in names)
self.assert_("another"+os.extsep+"name" in names)
self.assert_("another.name" in names)
self.assert_("strfile" in names)
for i in infos:
self.assertEquals(i.file_size, len(self.data))
# check getinfo
for nm in (TESTFN, "another"+os.extsep+"name", "strfile"):
for nm in (TESTFN, "another.name", "strfile"):
info = zipfp.getinfo(nm)
self.assertEquals(info.filename, nm)
self.assertEquals(info.file_size, len(self.data))
......@@ -675,7 +675,7 @@ class TestsWithRandomBinaryFiles(unittest.TestCase):
def makeTestArchive(self, f, compression):
# Create the ZIP archive
zipfp = zipfile.ZipFile(f, "w", compression)
zipfp.write(TESTFN, "another"+os.extsep+"name")
zipfp.write(TESTFN, "another.name")
zipfp.write(TESTFN, TESTFN)
zipfp.close()
......@@ -687,7 +687,7 @@ class TestsWithRandomBinaryFiles(unittest.TestCase):
testdata = zipfp.read(TESTFN)
self.assertEqual(len(testdata), len(self.data))
self.assertEqual(testdata, self.data)
self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data)
self.assertEqual(zipfp.read("another.name"), self.data)
zipfp.close()
def testStored(self):
......@@ -708,7 +708,7 @@ class TestsWithRandomBinaryFiles(unittest.TestCase):
zipdata1.append(read_data)
zipdata2 = []
zipopen2 = zipfp.open("another"+os.extsep+"name")
zipopen2 = zipfp.open("another.name")
while 1:
read_data = zipopen2.read(256)
if not read_data:
......
......@@ -51,7 +51,7 @@ else:
TESTMOD = "ziptestmodule"
TESTPACK = "ziptestpackage"
TESTPACK2 = "ziptestpackage2"
TEMP_ZIP = os.path.abspath("junk95142" + os.extsep + "zip")
TEMP_ZIP = os.path.abspath("junk95142.zip")
class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
......
......@@ -30,18 +30,18 @@ def whichdb(filename):
# Check for dbm first -- this has a .pag and a .dir file
try:
f = io.open(filename + os.extsep + "pag", "rb")
f = io.open(filename + ".pag", "rb")
f.close()
# dbm linked with gdbm on OS/2 doesn't have .dir file
if not (dbm.library == "GNU gdbm" and sys.platform == "os2emx"):
f = io.open(filename + os.extsep + "dir", "rb")
f = io.open(filename + ".dir", "rb")
f.close()
return "dbm"
except IOError:
# some dbm emulations based on Berkeley DB generate a .db file
# some do not, but they should be caught by the dbhash checks
try:
f = io.open(filename + os.extsep + "db", "rb")
f = io.open(filename + ".db", "rb")
f.close()
# guarantee we can actually open the file using dbm
# kind of overkill, but since we are dealing with emulations
......@@ -56,12 +56,12 @@ def whichdb(filename):
# Check for dumbdbm next -- this has a .dir and a .dat file
try:
# First check for presence of files
os.stat(filename + os.extsep + "dat")
size = os.stat(filename + os.extsep + "dir").st_size
os.stat(filename + ".dat")
size = os.stat(filename + ".dir").st_size
# dumbdbm files with no keys are empty
if size == 0:
return "dumbdbm"
f = io.open(filename + os.extsep + "dir", "rb")
f = io.open(filename + ".dir", "rb")
try:
if f.read(1) in (b"'", b'"'):
return "dumbdbm"
......
......@@ -2611,7 +2611,7 @@ Library
- The distutils "register" command now uses http://www.python.org/pypi
as the default repository. (See PEP 301.)
- the platform dependent path related variables sep, altsep, extsep,
- the platform dependent path related variables sep, altsep,
pathsep, curdir, pardir and defpath are now defined in the platform
dependent path modules (e.g. ntpath.py) rather than os.py, so these
variables are now available via os.path. They continue to be
......@@ -4196,11 +4196,6 @@ Library
cycles created by casual use of sys.exc_info() no longer cause
permanent memory leaks (provided garbage collection is enabled).
- os.extsep -- a new variable needed by the RISCOS support. It is the
separator used by extensions, and is '.' on all platforms except
RISCOS, where it is '/'. There is no need to use this variable
unless you have a masochistic desire to port your code to RISCOS.
- mimetypes.py has optional support for non-standard, but commonly
found types. guess_type() and guess_extension() now accept an
optional 'strict' flag, defaulting to true, which controls whether
......
......@@ -41,10 +41,6 @@ This software comes with no warranty. Use at your own risk.
#include <windows.h>
#endif
#ifdef RISCOS
char *strdup(const char *);
#endif
PyDoc_STRVAR(locale__doc__, "Support for POSIX locales.");
static PyObject *Error;
......
......@@ -41,15 +41,7 @@ static int orig_argc;
/* command line options */
#define BASE_OPTS "c:dEhim:OStuvVW:xX?"
#ifndef RISCOS
#define PROGRAM_OPTS BASE_OPTS
#else /*RISCOS*/
/* extra option saying that we are running under a special task window
frontend; especially my_readline will behave different */
#define PROGRAM_OPTS BASE_OPTS "w"
/* corresponding flag */
extern int Py_RISCOSWimpFlag;
#endif /*RISCOS*/
/* Short usage message (with %s for argv0) */
static char *usage_line =
......@@ -227,10 +219,6 @@ Py_Main(int argc, char **argv)
orig_argc = argc; /* For Py_GetArgcArgv() */
orig_argv = argv;
#ifdef RISCOS
Py_RISCOSWimpFlag = 0;
#endif
PySys_ResetWarnOptions();
while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) {
......@@ -295,12 +283,6 @@ Py_Main(int argc, char **argv)
Py_VerboseFlag++;
break;
#ifdef RISCOS
case 'w':
Py_RISCOSWimpFlag = 1;
break;
#endif
case 'x':
skipfirstline = 1;
break;
......@@ -513,10 +495,6 @@ Py_Main(int argc, char **argv)
WaitForThreadShutdown();
Py_Finalize();
#ifdef RISCOS
if (Py_RISCOSWimpFlag)
fprintf(stderr, "\x0cq\x0c"); /* make frontend quit */
#endif
#ifdef __INSURE__
/* Insure++ is a memory analysis tool that aids in discovering
......
......@@ -251,15 +251,7 @@ typedef size_t socklen_t;
# include <arpa/inet.h>
# endif
# ifndef RISCOS
# include <fcntl.h>
# else
# include <sys/ioctl.h>
# include <socklib.h>
# define NO_DUP
int h_errno; /* not used */
# define INET_ADDRSTRLEN 16
# endif
#else
......@@ -417,11 +409,6 @@ static PyObject *socket_herror;
static PyObject *socket_gaierror;
static PyObject *socket_timeout;
#ifdef RISCOS
/* Global variable which is !=0 if Python is running in a RISC OS taskwindow */
static int taskwindow;
#endif
/* A forward reference to the socket type object.
The sock_type variable contains pointers to various functions,
some of which call new_sockobject(), which uses sock_type, so
......@@ -582,18 +569,6 @@ set_error(void)
}
#endif
#if defined(RISCOS)
if (_inet_error.errnum != NULL) {
PyObject *v;
v = Py_BuildValue("(is)", errno, _inet_err());
if (v != NULL) {
PyErr_SetObject(socket_error, v);
Py_DECREF(v);
}
return NULL;
}
#endif
return PyErr_SetFromErrno(socket_error);
}
......@@ -670,10 +645,8 @@ sendsegmented(int sock_fd, char *buf, int len, int flags)
static int
internal_setblocking(PySocketSockObject *s, int block)
{
#ifndef RISCOS
#ifndef MS_WINDOWS
int delay_flag;
#endif
#endif
Py_BEGIN_ALLOW_THREADS
......@@ -682,7 +655,6 @@ internal_setblocking(PySocketSockObject *s, int block)
setsockopt(s->sock_fd, SOL_SOCKET, SO_NONBLOCK,
(void *)(&block), sizeof(int));
#else
#ifndef RISCOS
#ifndef MS_WINDOWS
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
block = !block;
......@@ -702,10 +674,6 @@ internal_setblocking(PySocketSockObject *s, int block)
block = !block;
ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block);
#endif /* MS_WINDOWS */
#else /* RISCOS */
block = !block;
socketioctl(s->sock_fd, FIONBIO, (u_long*)&block);
#endif /* RISCOS */
#endif /* __BEOS__ */
Py_END_ALLOW_THREADS
......@@ -778,9 +746,6 @@ PyMODINIT_FUNC
init_sockobject(PySocketSockObject *s,
SOCKET_T fd, int family, int type, int proto)
{
#ifdef RISCOS
int block = 1;
#endif
s->sock_fd = fd;
s->sock_family = family;
s->sock_type = type;
......@@ -792,10 +757,6 @@ init_sockobject(PySocketSockObject *s,
if (defaulttimeout >= 0.0)
internal_setblocking(s, 0);
#ifdef RISCOS
if (taskwindow)
socketioctl(s->sock_fd, 0x80046679, (u_long*)&block);
#endif
}
......@@ -1700,30 +1661,6 @@ Returns the timeout in floating seconds associated with socket \n\
operations. A timeout of None indicates that timeouts on socket \n\
operations are disabled.");
#ifdef RISCOS
/* s.sleeptaskw(1 | 0) method */
static PyObject *
sock_sleeptaskw(PySocketSockObject *s,PyObject *arg)
{
int block;
block = PyInt_AsLong(arg);
if (block == -1 && PyErr_Occurred())
return NULL;
Py_BEGIN_ALLOW_THREADS
socketioctl(s->sock_fd, 0x80046679, (u_long*)&block);
Py_END_ALLOW_THREADS
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(sleeptaskw_doc,
"sleeptaskw(flag)\n\
\n\
Allow sleeps in taskwindows.");
#endif
/* s.setsockopt() method.
With an integer third argument, sets an integer option.
With a string third argument, sets an option from a buffer;
......@@ -2749,10 +2686,6 @@ static PyMethodDef sock_methods[] = {
setsockopt_doc},
{"shutdown", (PyCFunction)sock_shutdown, METH_O,
shutdown_doc},
#ifdef RISCOS
{"sleeptaskw", (PyCFunction)sock_sleeptaskw, METH_O,
sleeptaskw_doc},
#endif
{NULL, NULL} /* sentinel */
};
......@@ -2963,11 +2896,7 @@ gethost_common(struct hostent *h, struct sockaddr *addr, int alen, int af)
if (h == NULL) {
/* Let's get real error message to return */
#ifndef RISCOS
set_herror(h_errno);
#else
PyErr_SetString(socket_error, "host not found");
#endif
return NULL;
}
......@@ -4016,24 +3945,6 @@ static PyMethodDef socket_methods[] = {
};
#ifdef RISCOS
#define OS_INIT_DEFINED
static int
os_init(void)
{
_kernel_swi_regs r;
r.r[0] = 0;
_kernel_swi(0x43380, &r, &r);
taskwindow = r.r[0];
return 1;
}
#endif /* RISCOS */
#ifdef MS_WINDOWS
#define OS_INIT_DEFINED
......
......@@ -87,10 +87,6 @@ static long main_thread;
#include <kernel/OS.h>
#endif
#ifdef RISCOS
extern int riscos_sleep(double);
#endif
/* Forward declarations */
static int floatsleep(double);
static double floattime(void);
......@@ -983,14 +979,6 @@ floatsleep(double secs)
}
Py_END_ALLOW_THREADS
}
#elif defined(RISCOS)
if (secs <= 0.0)
return 0;
Py_BEGIN_ALLOW_THREADS
/* This sleep *CAN BE* interrupted. */
if ( riscos_sleep(secs) )
return -1;
Py_END_ALLOW_THREADS
#elif defined(PLAN9)
{
double millisecs = secs * 1000.0;
......
......@@ -92,7 +92,6 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds)
path = NULL;
prefix = NULL;
for (;;) {
#ifndef RISCOS
struct stat statbuf;
int rv;
......@@ -104,15 +103,6 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds)
path = buf;
break;
}
#else
if (object_exists(buf)) {
/* it exists */
if (isfile(buf))
/* it's a file */
path = buf;
break;
}
#endif
/* back up one path element */
p = strrchr(buf, SEP);
if (prefix != NULL)
......
......@@ -74,7 +74,7 @@ Notes for some targets:
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
other compilers. Use "make test" to check your compiler.
- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
- gzdopen is not supported on BEOS and by some Mac compilers.
- For PalmOs, see http://palmzlib.sourceforge.net/
......
......@@ -13,7 +13,7 @@
# include <stdlib.h>
#endif
#if defined(VMS) || defined(RISCOS)
#if defined(VMS)
# define TESTFILE "foo-gz"
#else
# define TESTFILE "foo.gz"
......
......@@ -41,11 +41,6 @@
# define unlink delete
# define GZ_SUFFIX "-gz"
#endif
#ifdef RISCOS
# define unlink remove
# define GZ_SUFFIX "-gz"
# define fileno(file) file->__file
#endif
#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
# include <unix.h> /* for fileno */
#endif
......
......@@ -147,7 +147,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define OS_CODE 0x0f
#endif
#if defined(_BEOS_) || defined(RISCOS)
#if defined(_BEOS_)
# define fdopen(fd,mode) NULL /* No fdopen() */
#endif
......
......@@ -9,10 +9,6 @@
#include "token.h"
#include "grammar.h"
#ifdef RISCOS
#include <unixlib.h>
#endif
extern int Py_DebugFlag;
grammar *
......
......@@ -126,11 +126,7 @@ intcatcher(int sig)
case 0:
break;
case 1:
#ifdef RISCOS
fprintf(stderr, message);
#else
write(2, message, strlen(message));
#endif
break;
case 2:
interrupted = 0;
......
......@@ -29,10 +29,6 @@ static PyThread_type_lock _PyOS_ReadlineLock = NULL;
int (*PyOS_InputHook)(void) = NULL;
#ifdef RISCOS
int Py_RISCOSWimpFlag;
#endif
/* This function restarts a fgets() after an EINTR error occurred
except if PyOS_InterruptOccurred() returns true. */
......@@ -114,17 +110,8 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
if ((p = (char *)PyMem_MALLOC(n)) == NULL)
return NULL;
fflush(sys_stdout);
#ifndef RISCOS
if (prompt)
fprintf(stderr, "%s", prompt);
#else
if (prompt) {
if(Py_RISCOSWimpFlag)
fprintf(stderr, "\x0cr%s\x0c", prompt);
else
fprintf(stderr, "%s", prompt);
}
#endif
fflush(stderr);
switch (my_fgets(p, (int)n, sys_stdin)) {
case 0: /* Normal case */
......
......@@ -8,10 +8,6 @@
#include <ctype.h>
#ifdef RISCOS
#include "unixstuff.h"
#endif
/* The default encoding used by the platform file system APIs
Can remain NULL for all platforms that don't have such a concept
*/
......
......@@ -94,13 +94,6 @@ struct _inittab *PyImport_Inittab = _PyImport_Inittab;
/* these tables define the module suffixes that Python recognizes */
struct filedescr * _PyImport_Filetab = NULL;
#ifdef RISCOS
static const struct filedescr _PyImport_StandardFiletab[] = {
{"/py", "U", PY_SOURCE},
{"/pyc", "rb", PY_COMPILED},
{0, 0}
};
#else
static const struct filedescr _PyImport_StandardFiletab[] = {
{".py", "U", PY_SOURCE},
#ifdef MS_WINDOWS
......@@ -109,7 +102,6 @@ static const struct filedescr _PyImport_StandardFiletab[] = {
{".pyc", "rb", PY_COMPILED},
{0, 0}
};
#endif
static PyTypeObject NullImporterType; /* Forward reference */
......@@ -144,13 +136,8 @@ _PyImport_Init(void)
if (Py_OptimizeFlag) {
/* Replace ".pyc" with ".pyo" in _PyImport_Filetab */
for (; filetab->suffix != NULL; filetab++) {
#ifndef RISCOS
if (strcmp(filetab->suffix, ".pyc") == 0)
filetab->suffix = ".pyo";
#else
if (strcmp(filetab->suffix, "/pyc") == 0)
filetab->suffix = "/pyo";
#endif
}
}
......@@ -1131,9 +1118,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
char *filemode;
FILE *fp = NULL;
PyObject *path_hooks, *path_importer_cache;
#ifndef RISCOS
struct stat statbuf;
#endif
static struct filedescr fd_frozen = {"", "", PY_FROZEN};
static struct filedescr fd_builtin = {"", "", C_BUILTIN};
static struct filedescr fd_package = {"", "", PKG_DIRECTORY};
......@@ -1326,25 +1311,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
}
}
}
#else
/* XXX How are you going to test for directories? */
#ifdef RISCOS
if (isdir(buf) &&
case_ok(buf, len, namelen, name)) {
if (find_init_module(buf)) {
return &fd_package;
}
else {
char warnstr[MAXPATHLEN+80];
sprintf(warnstr, "Not importing directory "
"'%.*s': missing __init__.py",
MAXPATHLEN, buf);
if (PyErr_WarnEx(PyExc_ImportWarning,
warnstr, 1)) {
return NULL;
}
}
#endif
#endif
#if defined(PYOS_OS2)
/* take a snapshot of the module spec for restoration
......@@ -1480,9 +1446,6 @@ PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr * fd)
#define INCL_DOSERRORS
#define INCL_NOPMAPI
#include <os2.h>
#elif defined(RISCOS)
#include "oslib/osfscontrol.h"
#endif
static int
......@@ -1568,31 +1531,6 @@ case_ok(char *buf, Py_ssize_t len, Py_ssize_t namelen, char *name)
}
return 0 ; /* Not found */
/* RISC OS */
#elif defined(RISCOS)
char canon[MAXPATHLEN+1]; /* buffer for the canonical form of the path */
char buf2[MAXPATHLEN+2];
char *nameWithExt = buf+len-namelen;
int canonlen;
os_error *e;
if (Py_GETENV("PYTHONCASEOK") != NULL)
return 1;
/* workaround:
append wildcard, otherwise case of filename wouldn't be touched */
strcpy(buf2, buf);
strcat(buf2, "*");
e = xosfscontrol_canonicalise_path(buf2,canon,0,0,MAXPATHLEN+1,&canonlen);
canonlen = MAXPATHLEN+1-canonlen;
if (e || canonlen<=0 || canonlen>(MAXPATHLEN+1) )
return 0;
if (strcmp(nameWithExt, canon+canonlen-strlen(nameWithExt))==0)
return 1; /* match */
return 0;
/* OS/2 */
#elif defined(PYOS_OS2)
HDIR hdir = 1;
......@@ -1668,38 +1606,6 @@ find_init_module(char *buf)
return 0;
}
#else
#ifdef RISCOS
static int
find_init_module(buf)
char *buf;
{
int save_len = strlen(buf);
int i = save_len;
if (save_len + 13 >= MAXPATHLEN)
return 0;
buf[i++] = SEP;
strcpy(buf+i, "__init__/py");
if (isfile(buf)) {
buf[save_len] = '\0';
return 1;
}
if (Py_OptimizeFlag)
strcpy(buf+i, "o");
else
strcpy(buf+i, "c");
if (isfile(buf)) {
buf[save_len] = '\0';
return 1;
}
buf[save_len] = '\0';
return 0;
}
#endif /*RISCOS*/
#endif /* HAVE_STAT */
......@@ -3007,7 +2913,6 @@ NullImporter_init(NullImporter *self, PyObject *args, PyObject *kwds)
PyErr_SetString(PyExc_ImportError, "empty pathname");
return -1;
} else {
#ifndef RISCOS
struct stat statbuf;
int rv;
......@@ -3021,17 +2926,6 @@ NullImporter_init(NullImporter *self, PyObject *args, PyObject *kwds)
return -1;
}
}
#else
if (object_exists(path)) {
/* it exists */
if (isdir(path)) {
/* it's a directory */
PyErr_SetString(PyExc_ImportError,
"existing directory");
return -1;
}
}
#endif
}
return 0;
}
......
......@@ -1290,11 +1290,7 @@ PySys_SetArgv(int argc, char **argv)
p = strrchr(argv0, SEP);
}
if (p != NULL) {
#ifndef RISCOS
n = p + 1 - argv0;
#else /* don't include trailing separator */
n = p - argv0;
#endif /* RISCOS */
#if SEP == '/' /* Special case for Unix filename syntax */
if (n > 1)
n--; /* Drop trailing separator */
......
......@@ -1248,7 +1248,6 @@ PCbuild/ Build directory for Microsoft Visual C++
Parser/ The parser and tokenizer and their input handling
Python/ The byte-compiler and interpreter
README The file you're reading now
RISCOS/ Files specific to RISC OS port
Tools/ Some useful programs written in Python
pyconfig.h.in Source from which pyconfig.h is created (GNU autoheader output)
configure Configuration shell script (GNU autoconf output)
......
This diff is collapsed.
/* -*- C -*- ***********************************************
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
The Netherlands.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI or Corporation for National Research Initiatives or
CNRI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
While CWI is the initial source for this software, a modified version
is made available by the Corporation for National Research Initiatives
(CNRI) at the Internet address ftp://ftp.python.org.
STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
/* Module configuration */
/* !!! !!! !!! This file is edited by the makesetup script !!! !!! !!! */
/* This file contains the table of built-in modules.
See init_builtin() in import.c. */
#include "Python.h"
/* -- ADDMODULE MARKER 1 -- */
extern void PyMarshal_Init(void);
extern void initimp(void);
extern void initgc(void);
extern void initriscos(void);
extern void initswi(void);
struct _inittab _PyImport_Inittab[] = {
{"riscos", initriscos},
/* -- ADDMODULE MARKER 2 -- */
/* This module "lives in" with marshal.c */
{"marshal", PyMarshal_Init},
/* This lives it with import.c */
{"imp", initimp},
/* These entries are here for sys.builtin_module_names */
{"__main__", NULL},
{"__builtin__", NULL},
{"sys", NULL},
/* This lives in gcmodule.c */
{"gc", initgc},
/* Sentinel */
{0, 0}
};
This diff is collapsed.
#include "Python.h"
#include "osdefs.h"
static char *prefix, *exec_prefix, *progpath, *module_search_path=NULL;
static void
calculate_path()
{
char *pypath = getenv("Python$Path");
if (pypath) {
int pathlen = strlen(pypath);
module_search_path = malloc(pathlen + 1);
if (module_search_path)
strncpy(module_search_path, pypath, pathlen + 1);
else {
fprintf(stderr,
"Not enough memory for dynamic PYTHONPATH.\n"
"Using default static PYTHONPATH.\n");
}
}
if (!module_search_path)
module_search_path = "<Python$Dir>.Lib";
prefix = "<Python$Dir>";
exec_prefix = prefix;
progpath = Py_GetProgramName();
}
/* External interface */
char *
Py_GetPath()
{
if (!module_search_path)
calculate_path();
return module_search_path;
}
char *
Py_GetPrefix()
{
if (!module_search_path)
calculate_path();
return prefix;
}
char *
Py_GetExecPrefix()
{
if (!module_search_path)
calculate_path();
return exec_prefix;
}
char *
Py_GetProgramFullPath()
{
if (!module_search_path)
calculate_path();
return progpath;
}
This diff is collapsed.
This diff is collapsed.
/***********************************************************
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
The Netherlands.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI or Corporation for National Research Initiatives or
CNRI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
While CWI is the initial source for this software, a modified version
is made available by the Corporation for National Research Initiatives
(CNRI) at the Internet address ftp://ftp.python.org.
STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
/* This module provides the necessary stubs for when dynamic loading is
not present. */
#include "Python.h"
#include "importdl.h"
#include "dlk.h"
const struct filedescr _PyImport_DynLoadFiletab[] = {
{"/pyd", "rb", C_EXTENSION},
{0, 0}
};
void dynload_init_dummy()
{
}
dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
char *pathname, FILE *fp)
{
int err;
char errstr[256];
void (*init_function)(void);
err = dlk_load_no_init(pathname, &init_function);
if (err) {
PyOS_snprintf(errstr, sizeof(errstr), "dlk failure %d", err);
PyErr_SetString(PyExc_ImportError, errstr);
}
return init_function;
}
char *getcwd(char *buf, int size)
{
buf[0] = '\0';
return buf;
}
#include <stdio.h>
#define __swi
#include "oslib/osfile.h"
long PyOS_GetLastModificationTime(char *path, FILE *fp)
{
int obj;
bits load, exec, ftype;
if (xosfile_read_stamped_no_path(path, &obj, &load, &exec, 0, 0, &ftype)) return -1;
if (obj != osfile_IS_FILE) return -1;
if (ftype == osfile_TYPE_UNTYPED) return -1;
load &= 0xFF;
load -= 51;
if (exec < 1855548004U) load--;
exec -= 1855548004U;
return exec/100+42949672*load+(95*load)/100;
}
This directory contains files for the RISC OS port of Python.
For more information about RISC OS see http://www.riscos.com/ .
This port is currently being maintained by Dietmar Schwertberger,
dietmar@schwertberger.de .
On http://www.schwertberger.de you may find compiled versions and libraries
as well as RISC OS specific documentation and extensions.
==========================================================================
Compiling:
1. Extract Files from archive directory 'Python-...' to a directory named
'!Python'.
2. Use a tool like Rename to change filenames from '*/[ch]' into '[ch].*'.
3. Create missing directories with 'amu cdirs'.
4. Build with 'amu'.
I've only tested Acorn/Norcroft C/C++ 5.30 and amu.
Python now uses the 32 bit libraries from Pace as well as the 32 bit
version of OSLib.
You will also need some additional libraries:
DLK (patched version)
http://www.schwertberger.de
OSLib
http://www.mk-net.demon.co.uk/oslib
zlib (optional)
ftp://ftp.freesoftware.com/pub/infozip/zlib/
expat (optional)
http://sourceforge.net/projects/expat/
(makefile and config.h available from http://www.schwertberger.de/riscos_expat.zip
This diff is collapsed.
#include "oslib/osmodule.h"
#include <stdio.h>
#include "kernel.h"
#include <limits.h>
#include <errno.h>
#include "oslib/taskwindow.h"
#include "Python.h"
int riscos_sleep(double delay)
{
os_t starttime, endtime, time; /* monotonic times (centiseconds) */
int *pollword, ret;
osbool claimed;
/* calculate end time */
starttime = os_read_monotonic_time();
if (starttime + 100.0*delay >INT_MAX)
endtime = INT_MAX;
else
endtime = (os_t)(starttime + 100.0*delay);
/* allocate (in RMA) and set pollword for xupcall_sleep */
pollword = osmodule_alloc(4);
*pollword = 1;
time = starttime;
ret = 0;
while ( time<endtime && time>=starttime ) {
xupcall_sleep (pollword, &claimed);
if (PyErr_CheckSignals()) {
ret = 1;
break;
}
time = os_read_monotonic_time();
}
/* deallocate pollword */
osmodule_free(pollword);
return ret;
}
set Python$Dir <Obey$Dir>
set PythonApp$Path <Obey$Dir>.
IconSprites <Obey$Dir>.!Sprites
<Obey$Dir>.AddToPath Python$Path PythonApp:Lib
<Obey$Dir>.AddToPath Python$Path PythonApp:Lib.plat-riscos
<Obey$Dir>.AddToPath Python$Path PythonApp:Lib.site-packages
set Alias$@RunType_ae5 TaskWindow |"python %%*0|" -name |"Python|" -quit -wimpslot 1248k
| -display
set File$Type_ae5 Python
| load modules for 32 bit compatibility
RMEnsure UtilityModule 3.10 Error This application requires RISC OS 3.10 or later
RMEnsure UtilityModule 3.70 RMEnsure CallASWI 0.02 RMLoad System:Modules.CallASWI
RMEnsure UtilityModule 3.70 RMEnsure CallASWI 0.02 Error This application requires CallASWI 0.02 or later
RMEnsure FPEmulator 4.03 RMLoad System:Modules.FPEmulator
RMEnsure FPEmulator 4.03 Error This application requires FPEmulator 4.03 or later
RMEnsure SharedCLibrary 5.17 RMLoad System:Modules.CLib
RMEnsure SharedCLibrary 5.34 Error This application requires SharedCLibrary 5.34 or later
set Alias$Python Run <Python$Dir>.python23 %*0
\ No newline at end of file
<Obey$Dir>.!Boot
TaskWindow "python" -name "Python" -quit -display -wimpslot 1248k
\ No newline at end of file
/* Fudge unix isatty and fileno for RISCOS */
#include "unixstuff.h"
#include <math.h>
#include <time.h>
#include "oslib/osfile.h"
int fileno(FILE *f)
{ return (int)f;
}
int isatty(int fn)
{ return (fn==fileno(stdin));
}
bits unixtime(bits ld,bits ex)
{ ld&=0xFF;
ld-=51;
if(ex<1855547904U) ld--;
ex-=1855548004U;
return ex/100+42949673U*ld-ld/25;
}
/* from RISC OS infozip, preserves filetype in ld */
int acorntime(bits *ex, bits *ld, time_t utime)
{
unsigned timlo; /* 3 lower bytes of acorn file-time plus carry byte */
unsigned timhi; /* 2 high bytes of acorn file-time */
timlo = ((unsigned)utime & 0x00ffffffU) * 100 + 0x00996a00U;
timhi = ((unsigned)utime >> 24);
timhi = timhi * 100 + 0x0000336eU + (timlo >> 24);
if (timhi & 0xffff0000U)
return 1; /* calculation overflow, do not change time */
/* insert the five time bytes into loadaddr and execaddr variables */
*ex = (timlo & 0x00ffffffU) | ((timhi & 0x000000ffU) << 24);
*ld = (*ld & 0xffffff00U) | ((timhi >> 8) & 0x000000ffU);
return 0; /* subject to future extension to signal overflow */
}
int isdir(char *fn)
{ int ob;
if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) return 0;
switch (ob)
{ case osfile_IS_DIR:return 1;
case osfile_IS_IMAGE:return 1;
}
return 0;
}
int isfile(char *fn)
{ int ob;
if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) return 0;
switch (ob)
{ case osfile_IS_FILE:return 1;
case osfile_IS_IMAGE:return 1;
}
return 0;
}
int object_exists(char *fn)
{ int ob;
if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) return 0;
switch (ob)
{ case osfile_IS_FILE:return 1;
case osfile_IS_DIR:return 1;
case osfile_IS_IMAGE:return 1;
}
return 0;
}
/* Fudge unix isatty and fileno for RISCOS */
#include <stdio.h>
#include <time.h>
int fileno(FILE *f);
int isatty(int fn);
unsigned int unixtime(unsigned int ld,unsigned int ex);
int acorntime(unsigned int *ex, unsigned int *ld, time_t ut);
int isdir(char *fn);
int isfile(char *fn);
int object_exists(char *fn);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment