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
d3b06a87
Kaydet (Commit)
d3b06a87
authored
Haz 12, 1997
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added optional preload arg to some routines (which creates reloaded
resources when set)
üst
7fb76e0f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
py_resource.py
Mac/Lib/py_resource.py
+9
-5
No files found.
Mac/Lib/py_resource.py
Dosyayı görüntüle @
d3b06a87
...
...
@@ -28,30 +28,34 @@ def open(dst):
Res
.
UseResFile
(
output
)
return
output
def
writemodule
(
name
,
id
,
data
,
type
=
'PYC '
):
def
writemodule
(
name
,
id
,
data
,
type
=
'PYC '
,
preload
=
0
):
"""Write pyc code to a PYC resource with given name and id."""
# XXXX Check that it doesn't exist
res
=
Res
.
Resource
(
data
)
res
.
AddResource
(
type
,
id
,
name
)
if
preload
:
attrs
=
res
.
GetResAttrs
()
attrs
=
attrs
|
0x04
res
.
SetResAttrs
(
attrs
)
res
.
WriteResource
()
res
.
ReleaseResource
()
def
frompycfile
(
file
,
name
=
None
):
def
frompycfile
(
file
,
name
=
None
,
preload
=
0
):
"""Copy one pyc file to the open resource file"""
if
name
==
None
:
d
,
name
=
os
.
path
.
split
(
file
)
name
=
name
[:
-
4
]
id
=
findfreeid
()
writemodule
(
name
,
id
,
__builtin__
.
open
(
file
,
'rb'
)
.
read
())
writemodule
(
name
,
id
,
__builtin__
.
open
(
file
,
'rb'
)
.
read
()
,
preload
=
preload
)
return
id
,
name
def
frompyfile
(
file
,
name
=
None
):
def
frompyfile
(
file
,
name
=
None
,
preload
=
0
):
"""Compile python source file to pyc file and add to resource file"""
import
py_compile
py_compile
.
compile
(
file
)
file
=
file
+
'c'
return
frompycfile
(
file
,
name
)
return
frompycfile
(
file
,
name
,
preload
=
preload
)
# XXXX Note this is incorrect, it only handles one type and one file....
...
...
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