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
912a14c0
Kaydet (Commit)
912a14c0
authored
Mar 05, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Reindented, removed tabs.
üst
1e07403b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
33 deletions
+37
-33
makefreeze.py
Tools/freeze/makefreeze.py
+37
-33
modulefinder.py
Tools/freeze/modulefinder.py
+0
-0
No files found.
Tools/freeze/makefreeze.py
Dosyayı görüntüle @
912a14c0
...
...
@@ -10,52 +10,56 @@ header = """
static struct _frozen _PyImport_FrozenModules[] = {
"""
trailer
=
"""
\
{0, 0, 0} /* sentinel */
{0, 0, 0} /* sentinel */
};
int
main(argc, argv)
int argc;
char **argv;
int argc;
char **argv;
{
PyImport_FrozenModules = _PyImport_FrozenModules;
return Py_FrozenMain(argc, argv);
PyImport_FrozenModules = _PyImport_FrozenModules;
return Py_FrozenMain(argc, argv);
}
"""
def
makefreeze
(
outfp
,
dict
,
debug
=
0
):
done
=
[]
mods
=
dict
.
keys
()
mods
.
sort
()
for
mod
in
mods
:
m
=
dict
[
mod
]
mangled
=
string
.
join
(
string
.
split
(
mod
,
"."
),
"__"
)
if
m
.
__code__
:
if
debug
:
print
"freezing"
,
mod
,
"..."
str
=
marshal
.
dumps
(
m
.
__code__
)
size
=
len
(
str
)
if
m
.
__path__
:
# Indicate package by negative size
size
=
-
size
done
.
append
((
mod
,
mangled
,
size
))
writecode
(
outfp
,
mangled
,
str
)
if
debug
:
print
"generating table of frozen modules"
outfp
.
write
(
header
)
for
mod
,
mangled
,
size
in
done
:
outfp
.
write
(
'
\t
{"
%
s", M_
%
s,
%
d},
\n
'
%
(
mod
,
mangled
,
size
))
outfp
.
write
(
trailer
)
done
=
[]
mods
=
dict
.
keys
()
mods
.
sort
()
for
mod
in
mods
:
m
=
dict
[
mod
]
mangled
=
string
.
join
(
string
.
split
(
mod
,
"."
),
"__"
)
if
m
.
__code__
:
if
debug
:
print
"freezing"
,
mod
,
"..."
str
=
marshal
.
dumps
(
m
.
__code__
)
size
=
len
(
str
)
if
m
.
__path__
:
# Indicate package by negative size
size
=
-
size
done
.
append
((
mod
,
mangled
,
size
))
writecode
(
outfp
,
mangled
,
str
)
if
debug
:
print
"generating table of frozen modules"
outfp
.
write
(
header
)
for
mod
,
mangled
,
size
in
done
:
outfp
.
write
(
'
\t
{"
%
s", M_
%
s,
%
d},
\n
'
%
(
mod
,
mangled
,
size
))
outfp
.
write
(
trailer
)
# Write a C initializer for a module containing the frozen python code.
# The array is called M_<mod>.
def
writecode
(
outfp
,
mod
,
str
):
outfp
.
write
(
'static unsigned char M_
%
s[] = {'
%
mod
)
for
i
in
range
(
0
,
len
(
str
),
16
):
outfp
.
write
(
'
\n\t
'
)
for
c
in
str
[
i
:
i
+
16
]:
outfp
.
write
(
'
%
d,'
%
ord
(
c
))
outfp
.
write
(
'
\n
};
\n
'
)
outfp
.
write
(
'static unsigned char M_
%
s[] = {'
%
mod
)
for
i
in
range
(
0
,
len
(
str
),
16
):
outfp
.
write
(
'
\n\t
'
)
for
c
in
str
[
i
:
i
+
16
]:
outfp
.
write
(
'
%
d,'
%
ord
(
c
))
outfp
.
write
(
'
\n
};
\n
'
)
# Local Variables:
# indent-tabs-mode: nil
# End:
Tools/freeze/modulefinder.py
Dosyayı görüntüle @
912a14c0
This diff is collapsed.
Click to expand it.
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