mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
RISCOS changes by dschwertberger.
This commit is contained in:
parent
4ba3d657ef
commit
d74fb6b12a
6 changed files with 64 additions and 24 deletions
|
@ -1,5 +1,12 @@
|
|||
"""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.
|
||||
|
||||
|
@ -17,9 +24,9 @@ def whichdb(filename):
|
|||
|
||||
# Check for dbm first -- this has a .pag and a .dir file
|
||||
try:
|
||||
f = open(filename + ".pag", "rb")
|
||||
f = open(filename + endsep + "pag", "rb")
|
||||
f.close()
|
||||
f = open(filename + ".dir", "rb")
|
||||
f = open(filename + endsep + "dir", "rb")
|
||||
f.close()
|
||||
return "dbm"
|
||||
except IOError:
|
||||
|
@ -27,9 +34,9 @@ def whichdb(filename):
|
|||
|
||||
# Check for dumbdbm next -- this has a .dir and and a .dat file
|
||||
try:
|
||||
f = open(filename + ".dat", "rb")
|
||||
f = open(filename + endsep + "dat", "rb")
|
||||
f.close()
|
||||
f = open(filename + ".dir", "rb")
|
||||
f = open(filename + endsep + "dir", "rb")
|
||||
try:
|
||||
if f.read(1) in ["'", '"']:
|
||||
return "dumbdbm"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue