Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
83c434b1
Kaydet (Commit)
83c434b1
authored
Şub 26, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
get creator from Owner resource; set attrs
üst
2e1db775
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
mkapplet.py
Mac/mkapplet.py
+24
-7
No files found.
Mac/mkapplet.py
Dosyayı görüntüle @
83c434b1
...
...
@@ -27,6 +27,9 @@ TEMPLATE = "PythonApplet"
RESTYPE
=
'PYC '
RESNAME
=
'__main__'
# A resource with this name sets the "owner" (creator) of the destination
OWNERNAME
=
"owner resource"
# OpenResFile mode parameters
READ
=
1
WRITE
=
2
...
...
@@ -107,7 +110,6 @@ def process(template, filename):
ctor
,
type
=
MacOS
.
GetCreatorAndType
(
destname
)
if
type
in
undefs
:
type
=
'APPL'
if
ctor
in
undefs
:
ctor
=
tctor
MacOS
.
SetCreatorAndType
(
destname
,
ctor
,
type
)
# Open the output resource fork
...
...
@@ -121,8 +123,9 @@ def process(template, filename):
# Copy the resources from the template
input
=
FSpOpenResFile
(
template
,
READ
)
copyres
(
input
,
output
)
newctor
=
copyres
(
input
,
output
)
CloseResFile
(
input
)
if
newctor
:
ctor
=
newctor
# Copy the resources from the target specific resource template, if any
...
...
@@ -131,8 +134,13 @@ def process(template, filename):
except
MacOS
.
Error
:
pass
else
:
copyres
(
input
,
output
)
newctor
=
copyres
(
input
,
output
)
CloseResFile
(
input
)
if
newctor
:
ctor
=
newctor
# Now set the creator and type of the destination
MacOS
.
SetCreatorAndType
(
destname
,
ctor
,
type
)
# Make sure we're manipulating the output resource file now
...
...
@@ -171,10 +179,13 @@ def process(template, filename):
message
(
"Applet
%
s created."
%
`destname`
)
# Copy resources between two resource file descriptors
# Exception: don't copy a __main__ resource
# Copy resources between two resource file descriptors.
# Exception: don't copy a __main__ resource.
# If a resource's name is "owner resource", its type is returned
# (so the caller can use it to set the destination's creator)
def
copyres
(
input
,
output
):
ctor
=
None
UseResFile
(
input
)
ntypes
=
Count1Types
()
for
itype
in
range
(
1
,
1
+
ntypes
):
...
...
@@ -183,8 +194,10 @@ def copyres(input, output):
for
ires
in
range
(
1
,
1
+
nresources
):
res
=
Get1IndResource
(
type
,
ires
)
id
,
type
,
name
=
res
.
GetResInfo
()
if
(
type
,
name
)
==
(
RESTYPE
,
RESNAME
):
lcname
=
string
.
lower
(
name
)
if
(
type
,
lcname
)
==
(
RESTYPE
,
RESNAME
):
continue
# Don't copy __main__ from template
if
lcname
==
OWNERNAME
:
ctor
=
type
size
=
res
.
SizeResource
()
attrs
=
res
.
GetResAttrs
()
print
id
,
type
,
name
,
size
,
hex
(
attrs
)
...
...
@@ -199,9 +212,12 @@ def copyres(input, output):
print
"Overwriting..."
res2
.
RmveResource
()
res
.
AddResource
(
type
,
id
,
name
)
#res.SetResAttrs(attrs)
res
.
WriteResource
()
attrs
=
attrs
|
res
.
GetResAttrs
()
print
"New attrs ="
,
hex
(
attrs
)
res
.
SetResAttrs
(
attrs
)
UseResFile
(
input
)
return
ctor
# Show a message and exit
...
...
@@ -230,3 +246,4 @@ def message(str, id = 256):
if
__name__
==
'__main__'
:
main
()
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