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
f59c6fa1
Commit
f59c6fa1
authored
Feb 12, 2003
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When in MacPython-OSX use bundlebuilder to create .app bundles.
parent
53b341ff
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
181 deletions
+53
-181
Lib/plat-mac/aepack.py
Lib/plat-mac/aepack.py
+4
-0
Lib/plat-mac/aetypes.py
Lib/plat-mac/aetypes.py
+18
-34
Lib/plat-mac/bgenlocations.py
Lib/plat-mac/bgenlocations.py
+2
-2
Lib/plat-mac/buildtools.py
Lib/plat-mac/buildtools.py
+29
-145
No files found.
Lib/plat-mac/aepack.py
View file @
f59c6fa1
...
@@ -88,6 +88,8 @@ def pack(x, forcetype = None):
...
@@ -88,6 +88,8 @@ def pack(x, forcetype = None):
return
x
return
x
if
isinstance
(
x
,
FSSType
):
if
isinstance
(
x
,
FSSType
):
return
AE
.
AECreateDesc
(
'fss '
,
x
.
data
)
return
AE
.
AECreateDesc
(
'fss '
,
x
.
data
)
if
isinstance
(
x
,
FSRefType
):
return
AE
.
AECreateDesc
(
'fsrf'
,
x
.
data
)
if
isinstance
(
x
,
AliasType
):
if
isinstance
(
x
,
AliasType
):
return
AE
.
AECreateDesc
(
'alis'
,
x
.
data
)
return
AE
.
AECreateDesc
(
'alis'
,
x
.
data
)
if
isinstance
(
x
,
IntType
):
if
isinstance
(
x
,
IntType
):
...
@@ -166,6 +168,8 @@ def unpack(desc, formodulename=""):
...
@@ -166,6 +168,8 @@ def unpack(desc, formodulename=""):
return
struct
.
unpack
(
'd'
,
data
)[
0
]
return
struct
.
unpack
(
'd'
,
data
)[
0
]
if
t
==
typeFSS
:
if
t
==
typeFSS
:
return
Carbon
.
File
.
FSSpec
(
rawdata
=
desc
.
data
)
return
Carbon
.
File
.
FSSpec
(
rawdata
=
desc
.
data
)
if
t
==
typeFSRef
:
return
Carbon
.
File
.
FSRef
(
rawdata
=
desc
.
data
)
if
t
==
typeInsertionLoc
:
if
t
==
typeInsertionLoc
:
record
=
desc
.
AECoerceDesc
(
'reco'
)
record
=
desc
.
AECoerceDesc
(
'reco'
)
return
mkinsertionloc
(
unpack
(
record
,
formodulename
))
return
mkinsertionloc
(
unpack
(
record
,
formodulename
))
...
...
Lib/plat-mac/aetypes.py
View file @
f59c6fa1
...
@@ -11,23 +11,7 @@ import string
...
@@ -11,23 +11,7 @@ import string
#
#
def
pack
(
*
args
,
**
kwargs
):
def
pack
(
*
args
,
**
kwargs
):
from
aepack
import
pack
from
aepack
import
pack
return
apply
(
pack
,
args
,
kwargs
)
return
pack
(
*
args
,
**
kwargs
)
def
IsSubclass
(
cls
,
base
):
"""Test whether CLASS1 is the same as or a subclass of CLASS2"""
# Loop to optimize for single inheritance
while
1
:
if
cls
is
base
:
return
1
if
len
(
cls
.
__bases__
)
<>
1
:
break
cls
=
cls
.
__bases__
[
0
]
# Recurse to cope with multiple inheritance
for
c
in
cls
.
__bases__
:
if
IsSubclass
(
c
,
base
):
return
1
return
0
def
IsInstance
(
x
,
cls
):
"""Test whether OBJECT is an instance of (a subclass of) CLASS"""
return
type
(
x
)
is
InstanceType
and
IsSubclass
(
x
.
__class__
,
cls
)
def
nice
(
s
):
def
nice
(
s
):
"""'nice' representation of an object"""
"""'nice' representation of an object"""
...
@@ -63,7 +47,7 @@ class Enum:
...
@@ -63,7 +47,7 @@ class Enum:
return
pack
(
self
.
enum
,
typeEnumeration
)
return
pack
(
self
.
enum
,
typeEnumeration
)
def
IsEnum
(
x
):
def
IsEnum
(
x
):
return
IsI
nstance
(
x
,
Enum
)
return
isi
nstance
(
x
,
Enum
)
def
mkenum
(
enum
):
def
mkenum
(
enum
):
if
IsEnum
(
enum
):
return
enum
if
IsEnum
(
enum
):
return
enum
...
@@ -108,7 +92,7 @@ class Boolean:
...
@@ -108,7 +92,7 @@ class Boolean:
return
pack
(
struct
.
pack
(
'b'
,
self
.
bool
),
'bool'
)
return
pack
(
struct
.
pack
(
'b'
,
self
.
bool
),
'bool'
)
def
IsBoolean
(
x
):
def
IsBoolean
(
x
):
return
IsI
nstance
(
x
,
Boolean
)
return
isi
nstance
(
x
,
Boolean
)
def
mkboolean
(
bool
):
def
mkboolean
(
bool
):
if
IsBoolean
(
bool
):
return
bool
if
IsBoolean
(
bool
):
return
bool
...
@@ -130,7 +114,7 @@ class Type:
...
@@ -130,7 +114,7 @@ class Type:
return
pack
(
self
.
type
,
typeType
)
return
pack
(
self
.
type
,
typeType
)
def
IsType
(
x
):
def
IsType
(
x
):
return
IsI
nstance
(
x
,
Type
)
return
isi
nstance
(
x
,
Type
)
def
mktype
(
type
):
def
mktype
(
type
):
if
IsType
(
type
):
return
type
if
IsType
(
type
):
return
type
...
@@ -153,7 +137,7 @@ class Keyword:
...
@@ -153,7 +137,7 @@ class Keyword:
return
pack
(
self
.
keyword
,
typeKeyword
)
return
pack
(
self
.
keyword
,
typeKeyword
)
def
IsKeyword
(
x
):
def
IsKeyword
(
x
):
return
IsI
nstance
(
x
,
Keyword
)
return
isi
nstance
(
x
,
Keyword
)
class
Range
:
class
Range
:
"""An AE range object"""
"""An AE range object"""
...
@@ -172,7 +156,7 @@ class Range:
...
@@ -172,7 +156,7 @@ class Range:
return
pack
({
'star'
:
self
.
start
,
'stop'
:
self
.
stop
},
'rang'
)
return
pack
({
'star'
:
self
.
start
,
'stop'
:
self
.
stop
},
'rang'
)
def
IsRange
(
x
):
def
IsRange
(
x
):
return
IsI
nstance
(
x
,
Range
)
return
isi
nstance
(
x
,
Range
)
class
Comparison
:
class
Comparison
:
"""An AE Comparison"""
"""An AE Comparison"""
...
@@ -195,7 +179,7 @@ class Comparison:
...
@@ -195,7 +179,7 @@ class Comparison:
'cmpd'
)
'cmpd'
)
def
IsComparison
(
x
):
def
IsComparison
(
x
):
return
IsI
nstance
(
x
,
Comparison
)
return
isi
nstance
(
x
,
Comparison
)
class
NComparison
(
Comparison
):
class
NComparison
(
Comparison
):
# The class attribute 'relo' must be set in a subclass
# The class attribute 'relo' must be set in a subclass
...
@@ -220,7 +204,7 @@ class Ordinal:
...
@@ -220,7 +204,7 @@ class Ordinal:
return
pack
(
self
.
abso
,
'abso'
)
return
pack
(
self
.
abso
,
'abso'
)
def
IsOrdinal
(
x
):
def
IsOrdinal
(
x
):
return
IsI
nstance
(
x
,
Ordinal
)
return
isi
nstance
(
x
,
Ordinal
)
class
NOrdinal
(
Ordinal
):
class
NOrdinal
(
Ordinal
):
# The class attribute 'abso' must be set in a subclass
# The class attribute 'abso' must be set in a subclass
...
@@ -250,7 +234,7 @@ class Logical:
...
@@ -250,7 +234,7 @@ class Logical:
return
pack
({
'logc'
:
mkenum
(
self
.
logc
),
'term'
:
self
.
term
},
'logi'
)
return
pack
({
'logc'
:
mkenum
(
self
.
logc
),
'term'
:
self
.
term
},
'logi'
)
def
IsLogical
(
x
):
def
IsLogical
(
x
):
return
IsI
nstance
(
x
,
Logical
)
return
isi
nstance
(
x
,
Logical
)
class
StyledText
:
class
StyledText
:
"""An AE object respresenting text in a certain style"""
"""An AE object respresenting text in a certain style"""
...
@@ -269,7 +253,7 @@ class StyledText:
...
@@ -269,7 +253,7 @@ class StyledText:
return
pack
({
'ksty'
:
self
.
style
,
'ktxt'
:
self
.
text
},
'STXT'
)
return
pack
({
'ksty'
:
self
.
style
,
'ktxt'
:
self
.
text
},
'STXT'
)
def
IsStyledText
(
x
):
def
IsStyledText
(
x
):
return
IsI
nstance
(
x
,
StyledText
)
return
isi
nstance
(
x
,
StyledText
)
class
AEText
:
class
AEText
:
"""An AE text object with style, script and language specified"""
"""An AE text object with style, script and language specified"""
...
@@ -290,7 +274,7 @@ class AEText:
...
@@ -290,7 +274,7 @@ class AEText:
keyAEText
:
self
.
text
},
typeAEText
)
keyAEText
:
self
.
text
},
typeAEText
)
def
IsAEText
(
x
):
def
IsAEText
(
x
):
return
IsI
nstance
(
x
,
AEText
)
return
isi
nstance
(
x
,
AEText
)
class
IntlText
:
class
IntlText
:
"""A text object with script and language specified"""
"""A text object with script and language specified"""
...
@@ -311,7 +295,7 @@ class IntlText:
...
@@ -311,7 +295,7 @@ class IntlText:
typeIntlText
)
typeIntlText
)
def
IsIntlText
(
x
):
def
IsIntlText
(
x
):
return
IsI
nstance
(
x
,
IntlText
)
return
isi
nstance
(
x
,
IntlText
)
class
IntlWritingCode
:
class
IntlWritingCode
:
"""An object representing script and language"""
"""An object representing script and language"""
...
@@ -331,7 +315,7 @@ class IntlWritingCode:
...
@@ -331,7 +315,7 @@ class IntlWritingCode:
typeIntlWritingCode
)
typeIntlWritingCode
)
def
IsIntlWritingCode
(
x
):
def
IsIntlWritingCode
(
x
):
return
IsI
nstance
(
x
,
IntlWritingCode
)
return
isi
nstance
(
x
,
IntlWritingCode
)
class
QDPoint
:
class
QDPoint
:
"""A point"""
"""A point"""
...
@@ -351,7 +335,7 @@ class QDPoint:
...
@@ -351,7 +335,7 @@ class QDPoint:
typeQDPoint
)
typeQDPoint
)
def
IsQDPoint
(
x
):
def
IsQDPoint
(
x
):
return
IsI
nstance
(
x
,
QDPoint
)
return
isi
nstance
(
x
,
QDPoint
)
class
QDRectangle
:
class
QDRectangle
:
"""A rectangle"""
"""A rectangle"""
...
@@ -374,7 +358,7 @@ class QDRectangle:
...
@@ -374,7 +358,7 @@ class QDRectangle:
typeQDRectangle
)
typeQDRectangle
)
def
IsQDRectangle
(
x
):
def
IsQDRectangle
(
x
):
return
IsI
nstance
(
x
,
QDRectangle
)
return
isi
nstance
(
x
,
QDRectangle
)
class
RGBColor
:
class
RGBColor
:
"""An RGB color"""
"""An RGB color"""
...
@@ -395,7 +379,7 @@ class RGBColor:
...
@@ -395,7 +379,7 @@ class RGBColor:
typeRGBColor
)
typeRGBColor
)
def
IsRGBColor
(
x
):
def
IsRGBColor
(
x
):
return
IsI
nstance
(
x
,
RGBColor
)
return
isi
nstance
(
x
,
RGBColor
)
class
ObjectSpecifier
:
class
ObjectSpecifier
:
...
@@ -444,7 +428,7 @@ class ObjectSpecifier:
...
@@ -444,7 +428,7 @@ class ObjectSpecifier:
'obj '
)
'obj '
)
def
IsObjectSpecifier
(
x
):
def
IsObjectSpecifier
(
x
):
return
IsI
nstance
(
x
,
ObjectSpecifier
)
return
isi
nstance
(
x
,
ObjectSpecifier
)
# Backwards compatability, sigh...
# Backwards compatability, sigh...
...
...
Lib/plat-mac/bgenlocations.py
View file @
f59c6fa1
...
@@ -26,9 +26,9 @@ else:
...
@@ -26,9 +26,9 @@ else:
# end of lines, so don't worry about that.
# end of lines, so don't worry about that.
#
#
if
sys
.
platform
==
'mac'
:
if
sys
.
platform
==
'mac'
:
_MWERKSDIR
=
"
Moes
:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior"
_MWERKSDIR
=
"
Sap
:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior"
else
:
else
:
_MWERKSDIR
=
"/Volumes/
Moes
/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/"
_MWERKSDIR
=
"/Volumes/
Sap
/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/"
INCLUDEDIR
=
os
.
path
.
join
(
_MWERKSDIR
,
"MacOS Support"
,
"Universal"
,
"Interfaces"
,
"CIncludes"
)
INCLUDEDIR
=
os
.
path
.
join
(
_MWERKSDIR
,
"MacOS Support"
,
"Universal"
,
"Interfaces"
,
"CIncludes"
)
#
#
...
...
Lib/plat-mac/buildtools.py
View file @
f59c6fa1
...
@@ -44,9 +44,7 @@ RESOURCE_FORK_NAME=Carbon.File.FSGetResourceForkName()
...
@@ -44,9 +44,7 @@ RESOURCE_FORK_NAME=Carbon.File.FSGetResourceForkName()
def
findtemplate
(
template
=
None
):
def
findtemplate
(
template
=
None
):
"""Locate the applet template along sys.path"""
"""Locate the applet template along sys.path"""
if
MacOS
.
runtimemodel
==
'macho'
:
if
MacOS
.
runtimemodel
==
'macho'
:
if
template
:
return
None
return
template
return
findtemplate_macho
()
if
not
template
:
if
not
template
:
template
=
TEMPLATE
template
=
TEMPLATE
for
p
in
sys
.
path
:
for
p
in
sys
.
path
:
...
@@ -61,15 +59,7 @@ def findtemplate(template=None):
...
@@ -61,15 +59,7 @@ def findtemplate(template=None):
file
=
file
.
as_pathname
()
file
=
file
.
as_pathname
()
return
file
return
file
def
findtemplate_macho
():
def
process
(
template
,
filename
,
destname
,
copy_codefragment
=
0
,
execpath
=
sys
.
executable
.
split
(
'/'
)
if
not
'Contents'
in
execpath
:
raise
BuildError
,
"Not running from a .app bundle: %s"
%
sys
.
executable
i
=
execpath
.
index
(
'Contents'
)
return
'/'
.
join
(
execpath
[:
i
])
def
process
(
template
,
filename
,
destname
,
copy_codefragment
,
rsrcname
=
None
,
others
=
[],
raw
=
0
,
progress
=
"default"
):
rsrcname
=
None
,
others
=
[],
raw
=
0
,
progress
=
"default"
):
if
progress
==
"default"
:
if
progress
==
"default"
:
...
@@ -118,7 +108,7 @@ def process(template, filename, destname, copy_codefragment,
...
@@ -118,7 +108,7 @@ def process(template, filename, destname, copy_codefragment,
except
os
.
error
:
except
os
.
error
:
pass
pass
process_common
(
template
,
progress
,
code
,
rsrcname
,
destname
,
0
,
process_common
(
template
,
progress
,
code
,
rsrcname
,
destname
,
0
,
copy_codefragment
,
raw
,
others
)
copy_codefragment
,
raw
,
others
,
filename
)
def
update
(
template
,
filename
,
output
):
def
update
(
template
,
filename
,
output
):
...
@@ -140,10 +130,10 @@ def update(template, filename, output):
...
@@ -140,10 +130,10 @@ def update(template, filename, output):
def
process_common
(
template
,
progress
,
code
,
rsrcname
,
destname
,
is_update
,
def
process_common
(
template
,
progress
,
code
,
rsrcname
,
destname
,
is_update
,
copy_codefragment
,
raw
=
0
,
others
=
[]):
copy_codefragment
,
raw
=
0
,
others
=
[]
,
filename
=
None
):
if
MacOS
.
runtimemodel
==
'macho'
:
if
MacOS
.
runtimemodel
==
'macho'
:
return
process_common_macho
(
template
,
progress
,
code
,
rsrcname
,
destname
,
return
process_common_macho
(
template
,
progress
,
code
,
rsrcname
,
destname
,
is_update
,
raw
,
others
)
is_update
,
raw
,
others
,
filename
)
if
others
:
if
others
:
raise
BuildError
,
"Extra files only allowed for MachoPython applets"
raise
BuildError
,
"Extra files only allowed for MachoPython applets"
# Create FSSpecs for the various files
# Create FSSpecs for the various files
...
@@ -274,12 +264,16 @@ def process_common(template, progress, code, rsrcname, destname, is_update,
...
@@ -274,12 +264,16 @@ def process_common(template, progress, code, rsrcname, destname, is_update,
progress
.
label
(
"Done."
)
progress
.
label
(
"Done."
)
progress
.
inc
(
0
)
progress
.
inc
(
0
)
def
process_common_macho
(
template
,
progress
,
code
,
rsrcname
,
destname
,
is_update
,
raw
=
0
,
others
=
[]):
def
process_common_macho
(
template
,
progress
,
code
,
rsrcname
,
destname
,
is_update
,
raw
=
0
,
others
=
[],
filename
=
None
):
# Check that we have a filename
if
filename
is
None
:
raise
BuildError
,
"Need source filename on MacOSX"
# First make sure the name ends in ".app"
# First make sure the name ends in ".app"
if
destname
[
-
4
:]
!=
'.app'
:
if
destname
[
-
4
:]
!=
'.app'
:
destname
=
destname
+
'.app'
destname
=
destname
+
'.app'
# Now deduce the short name
# Now deduce the short name
shortname
=
os
.
path
.
split
(
destname
)[
1
]
destdir
,
shortname
=
os
.
path
.
split
(
destname
)
if
shortname
[
-
4
:]
==
'.app'
:
if
shortname
[
-
4
:]
==
'.app'
:
# Strip the .app suffix
# Strip the .app suffix
shortname
=
shortname
[:
-
4
]
shortname
=
shortname
[:
-
4
]
...
@@ -295,136 +289,26 @@ def process_common_macho(template, progress, code, rsrcname, destname, is_update
...
@@ -295,136 +289,26 @@ def process_common_macho(template, progress, code, rsrcname, destname, is_update
icnsname
=
None
icnsname
=
None
else
:
else
:
plistname
=
None
plistname
=
None
# Start with copying the .app framework
if
not
os
.
path
.
exists
(
rsrcname
):
if
not
is_update
:
rsrcname
=
None
exceptlist
=
[
"Contents/Info.plist"
,
"Contents/Resources/English.lproj/InfoPlist.strings"
,
"Contents/Resources/English.lproj/Documentation"
,
"Contents/Resources/python.rsrc"
,
]
copyapptree
(
template
,
destname
,
exceptlist
,
progress
)
# SERIOUS HACK. If we've just copied a symlink as the
# executable we assume we're running from the MacPython addon
# to 10.2 python. We remove the symlink again and install
# the appletrunner script.
executable
=
os
.
path
.
join
(
destname
,
"Contents/MacOS/python"
)
if
os
.
path
.
islink
(
executable
):
os
.
remove
(
executable
)
dummyfp
,
appletrunner
,
d2
=
imp
.
find_module
(
'appletrunner'
)
del
dummyfp
shutil
.
copy2
(
appletrunner
,
executable
)
os
.
chmod
(
executable
,
0775
)
# Now either use the .plist file or the default
if
progress
:
if
progress
:
progress
.
label
(
'Create info.plist'
)
progress
.
label
(
'Creating bundle...'
)
progress
.
inc
(
0
)
import
bundlebuilder
builder
=
bundlebuilder
.
AppBuilder
(
verbosity
=
0
)
builder
.
mainprogram
=
filename
builder
.
builddir
=
destdir
builder
.
name
=
shortname
if
rsrcname
:
builder
.
resources
.
append
(
rsrcname
)
for
o
in
others
:
builder
.
resources
.
append
(
o
)
if
plistname
:
if
plistname
:
shutil
.
copy2
(
plistname
,
os
.
path
.
join
(
destname
,
'Contents'
,
'Info.plist'
))
import
Plist
builder
.
plist
=
Plist
.
fromFile
(
plistname
)
if
icnsname
:
if
icnsname
:
icnsdest
=
os
.
path
.
split
(
icnsname
)[
1
]
builder
.
iconfile
=
icnsname
icnsdest
=
os
.
path
.
join
(
destname
,
builder
.
setup
()
os
.
path
.
join
(
'Contents'
,
'Resources'
,
icnsdest
))
builder
.
build
()
shutil
.
copy2
(
icnsname
,
icnsdest
)
# XXXX Wrong. This should be parsed from plist file. Also a big hack:-)
if
shortname
==
'PythonIDE'
:
ownertype
=
'Pide'
else
:
ownertype
=
'PytA'
# XXXX Should copy .icns file
else
:
cocoainfo
=
''
for
o
in
others
:
if
o
[
-
4
:]
==
'.nib'
:
nibname
=
os
.
path
.
split
(
o
)[
1
][:
-
4
]
cocoainfo
=
"""
<key>NSMainNibFile</key>
<string>%s</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>"""
%
nibname
elif
o
[
-
6
:]
==
'.lproj'
:
files
=
os
.
listdir
(
o
)
for
f
in
files
:
if
f
[
-
4
:]
==
'.nib'
:
nibname
=
os
.
path
.
split
(
f
)[
1
][:
-
4
]
cocoainfo
=
"""
<key>NSMainNibFile</key>
<string>%s</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>"""
%
nibname
plistname
=
os
.
path
.
join
(
template
,
'Contents'
,
'Resources'
,
'Applet-Info.plist'
)
plistdata
=
open
(
plistname
).
read
()
plistdata
=
plistdata
%
{
'appletname'
:
shortname
,
'cocoainfo'
:
cocoainfo
}
ofp
=
open
(
os
.
path
.
join
(
destname
,
'Contents'
,
'Info.plist'
),
'w'
)
ofp
.
write
(
plistdata
)
ofp
.
close
()
ownertype
=
'PytA'
# Create the PkgInfo file
if
progress
:
progress
.
label
(
'Create PkgInfo'
)
progress
.
inc
(
0
)
ofp
=
open
(
os
.
path
.
join
(
destname
,
'Contents'
,
'PkgInfo'
),
'wb'
)
ofp
.
write
(
'APPL'
+
ownertype
)
ofp
.
close
()
# Copy the resources from the target specific resource template, if any
typesfound
,
ownertype
=
[],
None
try
:
input
=
macresource
.
open_pathname
(
rsrcname
)
except
(
MacOS
.
Error
,
ValueError
):
if
progress
:
progress
.
inc
(
50
)
else
:
if
progress
:
progress
.
label
(
"Copy resources..."
)
progress
.
set
(
20
)
resfilename
=
'python.rsrc'
# XXXX later: '%s.rsrc' % shortname
try
:
output
=
Res
.
FSOpenResourceFile
(
os
.
path
.
join
(
destname
,
'Contents'
,
'Resources'
,
resfilename
),
u''
,
WRITE
)
except
MacOS
.
Error
:
fsr
,
dummy
=
Res
.
FSCreateResourceFile
(
os
.
path
.
join
(
destname
,
'Contents'
,
'Resources'
),
unicode
(
resfilename
),
''
)
output
=
Res
.
FSOpenResourceFile
(
fsr
,
u''
,
WRITE
)
typesfound
,
ownertype
=
copyres
(
input
,
output
,
[],
0
,
progress
)
Res
.
CloseResFile
(
input
)
Res
.
CloseResFile
(
output
)
if
code
:
if
raw
:
pycname
=
'__rawmain__.pyc'
else
:
pycname
=
'__main__.pyc'
# And we also create __rawmain__.pyc
outputfilename
=
os
.
path
.
join
(
destname
,
'Contents'
,
'Resources'
,
'__rawmain__.pyc'
)
if
progress
:
progress
.
label
(
'Creating __rawmain__.pyc'
)
progress
.
inc
(
0
)
rawsourcefp
,
rawsourcefile
,
d2
=
imp
.
find_module
(
'appletrawmain'
)
rawsource
=
rawsourcefp
.
read
()
rawcode
=
compile
(
rawsource
,
rawsourcefile
,
'exec'
)
writepycfile
(
rawcode
,
outputfilename
)
outputfilename
=
os
.
path
.
join
(
destname
,
'Contents'
,
'Resources'
,
pycname
)
if
progress
:
progress
.
label
(
'Creating '
+
pycname
)
progress
.
inc
(
0
)
writepycfile
(
code
,
outputfilename
)
# Copy other files the user asked for
for
osrc
in
others
:
oname
=
os
.
path
.
split
(
osrc
)[
1
]
odst
=
os
.
path
.
join
(
destname
,
'Contents'
,
'Resources'
,
oname
)
if
progress
:
progress
.
label
(
'Copy '
+
oname
)
progress
.
inc
(
0
)
if
os
.
path
.
isdir
(
osrc
):
copyapptree
(
osrc
,
odst
)
else
:
shutil
.
copy2
(
osrc
,
odst
)
if
progress
:
if
progress
:
progress
.
label
(
'Done.'
)
progress
.
label
(
'Done.'
)
progress
.
inc
(
0
)
progress
.
inc
(
0
)
...
...
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