Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1d6495dd
Commit
1d6495dd
authored
Jul 23, 2006
by
Andrew MacIntyre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get mailbox module working on OS/2 EMX port.
parent
88f3f307
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
Lib/mailbox.py
Lib/mailbox.py
+10
-2
Lib/test/test_mailbox.py
Lib/test/test_mailbox.py
+2
-2
No files found.
Lib/mailbox.py
View file @
1d6495dd
...
...
@@ -15,6 +15,9 @@ import email.Generator
import
rfc822
import
StringIO
try
:
if
sys
.
platform
==
'os2emx'
:
# OS/2 EMX fcntl() not adequate
raise
ImportError
import
fcntl
except
ImportError
:
fcntl
=
None
...
...
@@ -565,7 +568,8 @@ class _singlefileMailbox(Mailbox):
try
:
os
.
rename
(
new_file
.
name
,
self
.
_path
)
except
OSError
,
e
:
if
e
.
errno
==
errno
.
EEXIST
:
if
e
.
errno
==
errno
.
EEXIST
or
\
(
os
.
name
==
'os2'
and
e
.
errno
==
errno
.
EACCES
):
os
.
remove
(
self
.
_path
)
os
.
rename
(
new_file
.
name
,
self
.
_path
)
else
:
...
...
@@ -1030,6 +1034,9 @@ class MH(Mailbox):
if
hasattr
(
os
,
'link'
):
os
.
link
(
os
.
path
.
join
(
self
.
_path
,
str
(
key
)),
os
.
path
.
join
(
self
.
_path
,
str
(
prev
+
1
)))
if
sys
.
platform
==
'os2emx'
:
# cannot unlink an open file on OS/2
f
.
close
()
os
.
unlink
(
os
.
path
.
join
(
self
.
_path
,
str
(
key
)))
else
:
f
.
close
()
...
...
@@ -1828,7 +1835,8 @@ def _lock_file(f, dotlock=True):
os
.
rename
(
pre_lock
.
name
,
f
.
name
+
'.lock'
)
dotlock_done
=
True
except
OSError
,
e
:
if
e
.
errno
==
errno
.
EEXIST
:
if
e
.
errno
==
errno
.
EEXIST
or
\
(
os
.
name
==
'os2'
and
e
.
errno
==
errno
.
EACCES
):
os
.
remove
(
pre_lock
.
name
)
raise
ExternalClashError
(
'dot lock unavailable: %s'
%
f
.
name
)
...
...
Lib/test/test_mailbox.py
View file @
1d6495dd
...
...
@@ -461,7 +461,7 @@ class TestMaildir(TestMailbox):
def
setUp
(
self
):
TestMailbox
.
setUp
(
self
)
if
os
.
name
==
'nt'
:
if
os
.
name
in
(
'nt'
,
'os2'
)
:
self
.
_box
.
colon
=
'!'
def
test_add_MM
(
self
):
...
...
@@ -520,7 +520,7 @@ class TestMaildir(TestMailbox):
# Initialize an existing mailbox
self
.
tearDown
()
for
subdir
in
''
,
'tmp'
,
'new'
,
'cur'
:
os
.
mkdir
(
os
.
path
.
join
(
self
.
_path
,
subdir
))
os
.
mkdir
(
os
.
path
.
normpath
(
os
.
path
.
join
(
self
.
_path
,
subdir
)
))
self
.
_box
=
mailbox
.
Maildir
(
self
.
_path
)
self
.
_check_basics
(
factory
=
rfc822
.
Message
)
self
.
_box
=
mailbox
.
Maildir
(
self
.
_path
,
factory
=
None
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment