mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Oops
This commit is contained in:
parent
5f42106d46
commit
8119ada3ea
@ -114,6 +114,22 @@ if not _run_once:
|
|||||||
r, w, a, rb, wb, ab, r+, w+, a+, r+b, w+b, a+b
|
r, w, a, rb, wb, ab, r+, w+, a+, r+b, w+b, a+b
|
||||||
'''
|
'''
|
||||||
if iswindows:
|
if iswindows:
|
||||||
|
class fwrapper(object):
|
||||||
|
def __init__(self, name, fobject):
|
||||||
|
object.__setattr__(self, 'fobject', fobject)
|
||||||
|
object.__setattr__(self, 'name', name)
|
||||||
|
|
||||||
|
def __getattribute__(self, attr):
|
||||||
|
if attr == 'name':
|
||||||
|
return object.__getattribute__(self, attr)
|
||||||
|
fobject = object.__getattribute__(self, 'fobject')
|
||||||
|
return getattr(fobject, attr)
|
||||||
|
|
||||||
|
def __setattr__(self, attr, val):
|
||||||
|
fobject = object.__getattribute__(self, 'fobject')
|
||||||
|
return setattr(fobject, attr, val)
|
||||||
|
|
||||||
|
|
||||||
m = mode[0]
|
m = mode[0]
|
||||||
random = len(mode) > 1 and mode[1] == '+'
|
random = len(mode) > 1 and mode[1] == '+'
|
||||||
binary = mode[-1] == 'b'
|
binary = mode[-1] == 'b'
|
||||||
@ -139,7 +155,7 @@ if not _run_once:
|
|||||||
flags |= os.O_NOINHERIT
|
flags |= os.O_NOINHERIT
|
||||||
fd = os.open(name, flags)
|
fd = os.open(name, flags)
|
||||||
ans = os.fdopen(fd, mode, bufsize)
|
ans = os.fdopen(fd, mode, bufsize)
|
||||||
ans.name = name
|
ans = fwrapper(name, ans)
|
||||||
else:
|
else:
|
||||||
import fcntl
|
import fcntl
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user