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
678a7f0d
Commit
678a7f0d
authored
Jul 15, 2006
by
Bob Ippolito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #1220874: Update the binhex module for Mach-O.
parent
ca390085
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
16 deletions
+11
-16
Lib/binhex.py
Lib/binhex.py
+9
-16
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/binhex.py
View file @
678a7f0d
...
...
@@ -44,22 +44,14 @@ RUNCHAR=chr(0x90) # run-length introducer
#
# Workarounds for non-mac machines.
if
os
.
name
==
'mac'
:
import
macfs
import
MacOS
try
:
openrf
=
MacOS
.
openrf
except
AttributeError
:
# Backward compatibility
openrf
=
open
def
FInfo
():
return
macfs
.
FInfo
()
try
:
from
Carbon.File
import
FSSpec
,
FInfo
from
MacOS
import
openrf
def
getfileinfo
(
name
):
finfo
=
macfs
.
FSSpec
(
name
).
GetFInfo
()
finfo
=
FSSpec
(
name
).
FSp
GetFInfo
()
dir
,
file
=
os
.
path
.
split
(
name
)
# XXX
X
Get resource/data sizes
# XXX Get resource/data sizes
fp
=
open
(
name
,
'rb'
)
fp
.
seek
(
0
,
2
)
dlen
=
fp
.
tell
()
...
...
@@ -75,7 +67,7 @@ if os.name == 'mac':
mode
=
'*'
+
mode
[
0
]
return
openrf
(
name
,
mode
)
e
lse
:
e
xcept
ImportError
:
#
# Glue code for non-macintosh usage
#
...
...
@@ -183,7 +175,7 @@ class BinHex:
ofname
=
ofp
ofp
=
open
(
ofname
,
'w'
)
if
os
.
name
==
'mac'
:
fss
=
macfs
.
FSSpec
(
ofname
)
fss
=
FSSpec
(
ofname
)
fss
.
SetCreatorType
(
'BnHq'
,
'TEXT'
)
ofp
.
write
(
'(This file must be converted with BinHex 4.0)
\
n
\
n
:'
)
hqxer
=
_Hqxcoderengine
(
ofp
)
...
...
@@ -486,7 +478,7 @@ def hexbin(inp, out):
if
not
out
:
out
=
ifp
.
FName
if
os
.
name
==
'mac'
:
ofss
=
macfs
.
FSSpec
(
out
)
ofss
=
FSSpec
(
out
)
out
=
ofss
.
as_pathname
()
ofp
=
open
(
out
,
'wb'
)
...
...
@@ -519,6 +511,7 @@ def hexbin(inp, out):
def
_test
():
if
os
.
name
==
'mac'
:
import
macfs
fss
,
ok
=
macfs
.
PromptGetFile
(
'File to convert:'
)
if
not
ok
:
sys
.
exit
(
0
)
...
...
Misc/NEWS
View file @
678a7f0d
...
...
@@ -22,6 +22,8 @@ Core and builtins
Library
-------
- Patch #1220874: Update the binhex module for Mach-O.
Extension Modules
-----------------
...
...
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