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
58a59482
Kaydet (Commit)
58a59482
authored
Agu 14, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Changes for building under windows.
üst
41b9f00e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
9 deletions
+87
-9
freeze.py
Tools/freeze/freeze.py
+42
-9
winmakemakefile.py
Tools/freeze/winmakemakefile.py
+45
-0
No files found.
Tools/freeze/freeze.py
Dosyayı görüntüle @
58a59482
...
@@ -28,6 +28,13 @@ Options:
...
@@ -28,6 +28,13 @@ Options:
-h: Print this help message.
-h: Print this help message.
-w: Toggle Windows (NT or 95) behavior.
(For debugging only -- on a win32 platform, win32 behaviour
is automatic.)
-s subsystem: Specify the subsystem; 'windows' or 'console' (default).
(For Windows only.)
Arguments:
Arguments:
script.py: The Python script to be executed by the resulting binary.
script.py: The Python script to be executed by the resulting binary.
...
@@ -76,16 +83,18 @@ def main():
...
@@ -76,16 +83,18 @@ def main():
extensions
=
[]
extensions
=
[]
path
=
sys
.
path
path
=
sys
.
path
odir
=
''
odir
=
''
win
=
sys
.
platform
[:
3
]
==
'win'
# output files
# output files
frozen_c
=
'frozen.c'
frozen_c
=
'frozen.c'
config_c
=
'config.c'
config_c
=
'config.c'
target
=
'a.out'
# normally derived from script name
target
=
'a.out'
# normally derived from script name
makefile
=
'Makefile'
makefile
=
'Makefile'
subsystem
=
'console'
# parse command line
# parse command line
try
:
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'he:o:p:P:'
)
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'he:o:p:P:
s:w
'
)
except
getopt
.
error
,
msg
:
except
getopt
.
error
,
msg
:
usage
(
'getopt error: '
+
str
(
msg
))
usage
(
'getopt error: '
+
str
(
msg
))
...
@@ -102,6 +111,12 @@ def main():
...
@@ -102,6 +111,12 @@ def main():
prefix
=
a
prefix
=
a
if
o
==
'-P'
:
if
o
==
'-P'
:
exec_prefix
=
a
exec_prefix
=
a
if
o
==
'-w'
:
win
=
not
win
if
o
==
'-s'
:
if
not
win
:
usage
(
"-s subsystem option only on Windows"
)
subsystem
=
a
# default prefix and exec_prefix
# default prefix and exec_prefix
if
not
exec_prefix
:
if
not
exec_prefix
:
...
@@ -122,7 +137,7 @@ def main():
...
@@ -122,7 +137,7 @@ def main():
binlib
=
exec_prefix
binlib
=
exec_prefix
incldir
=
os
.
path
.
join
(
prefix
,
'Include'
)
incldir
=
os
.
path
.
join
(
prefix
,
'Include'
)
config_c_in
=
os
.
path
.
join
(
prefix
,
'Modules'
,
'config.c.in'
)
config_c_in
=
os
.
path
.
join
(
prefix
,
'Modules'
,
'config.c.in'
)
frozenmain_c
=
os
.
path
.
join
(
prefix
,
'
Modules
'
,
'frozenmain.c'
)
frozenmain_c
=
os
.
path
.
join
(
prefix
,
'
Python
'
,
'frozenmain.c'
)
makefile_in
=
os
.
path
.
join
(
exec_prefix
,
'Modules'
,
'Makefile'
)
makefile_in
=
os
.
path
.
join
(
exec_prefix
,
'Modules'
,
'Makefile'
)
else
:
else
:
binlib
=
os
.
path
.
join
(
exec_prefix
,
binlib
=
os
.
path
.
join
(
exec_prefix
,
...
@@ -141,17 +156,22 @@ def main():
...
@@ -141,17 +156,22 @@ def main():
usage
(
'needed directory
%
s not found'
%
dir
)
usage
(
'needed directory
%
s not found'
%
dir
)
if
not
os
.
path
.
isdir
(
dir
):
if
not
os
.
path
.
isdir
(
dir
):
usage
(
'
%
s: not a directory'
%
dir
)
usage
(
'
%
s: not a directory'
%
dir
)
for
file
in
[
config_c_in
,
makefile_in
]
+
supp_sources
:
if
win
:
files
=
supp_sources
else
:
files
=
[
config_c_in
,
makefile_in
]
+
supp_sources
for
file
in
supp_sources
:
if
not
os
.
path
.
exists
(
file
):
if
not
os
.
path
.
exists
(
file
):
usage
(
'needed file
%
s not found'
%
file
)
usage
(
'needed file
%
s not found'
%
file
)
if
not
os
.
path
.
isfile
(
file
):
if
not
os
.
path
.
isfile
(
file
):
usage
(
'
%
s: not a plain file'
%
file
)
usage
(
'
%
s: not a plain file'
%
file
)
for
dir
in
extensions
:
if
not
win
:
setup
=
os
.
path
.
join
(
dir
,
'Setup'
)
for
dir
in
extensions
:
if
not
os
.
path
.
exists
(
setup
):
setup
=
os
.
path
.
join
(
dir
,
'Setup'
)
usage
(
'needed file
%
s not found'
%
setup
)
if
not
os
.
path
.
exists
(
setup
):
if
not
os
.
path
.
isfile
(
setup
):
usage
(
'needed file
%
s not found'
%
setup
)
usage
(
'
%
s: not a plain file'
%
setup
)
if
not
os
.
path
.
isfile
(
setup
):
usage
(
'
%
s: not a plain file'
%
setup
)
# check that enough arguments are passed
# check that enough arguments are passed
if
not
args
:
if
not
args
:
...
@@ -222,6 +242,19 @@ def main():
...
@@ -222,6 +242,19 @@ def main():
frozen_c
)
frozen_c
)
os
.
rename
(
backup
,
frozen_c
)
os
.
rename
(
backup
,
frozen_c
)
if
win
:
# Taking a shortcut here...
import
winmakemakefile
outfp
=
open
(
makefile
,
'w'
)
try
:
winmakemakefile
.
makemakefile
(
outfp
,
locals
(),
[
frozenmain_c
,
frozen_c
],
target
)
finally
:
outfp
.
close
()
return
builtins
=
[]
builtins
=
[]
unknown
=
[]
unknown
=
[]
mods
=
dict
.
keys
()
mods
=
dict
.
keys
()
...
...
Tools/freeze/winmakemakefile.py
0 → 100644
Dosyayı görüntüle @
58a59482
import
sys
,
os
,
string
def
makemakefile
(
outfp
,
vars
,
files
,
target
):
save
=
sys
.
stdout
try
:
sys
.
stdout
=
outfp
realwork
(
vars
,
files
,
target
)
finally
:
sys
.
stdout
=
save
def
realwork
(
vars
,
files
,
target
):
print
"# Makefile for Windows (NT or 95) generated by freeze.py script"
print
print
"target ="
,
target
print
"pythonhome ="
,
vars
[
'prefix'
]
print
"pythonlib ="
,
vars
[
'exec_prefix'
]
+
"/pcbuild/release/python15.lib"
print
"subsystem ="
,
vars
[
'subsystem'
]
print
print
"all: $(target).exe"
print
objects
=
[]
for
file
in
files
:
base
=
os
.
path
.
basename
(
file
)
base
,
ext
=
os
.
path
.
splitext
(
base
)
objects
.
append
(
base
+
".obj"
)
print
"
%
s.obj:
%
s"
%
(
base
,
file
)
print
"
\t
$(CC) -c $(cdl)"
,
print
"-I$(pythonhome)/Include -I$(pythonhome)/PC
\\
"
print
"
\t\t
$(cflags) $(cdebug) $(cinclude)
\\
"
print
"
\t\t
"
,
file
print
print
"$(target).exe:"
,
for
obj
in
objects
:
print
obj
,
print
print
"
\t
link -out:$(target).exe"
,
for
obj
in
objects
:
print
obj
,
print
"
\\
"
print
"
\t\t
$(pythonlib) $(lcustom) shell32.lib comdlg32.lib wsock32.lib
\\
"
print
"
\t\t
-subsystem:$(subsystem) $(resources)"
# Local Variables:
# indent-tabs-mode: nil
# End:
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