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
9f5db07d
Kaydet (Commit)
9f5db07d
authored
Eki 29, 2010
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make file handing in setup.py more robust by using context managers to properly
close files.
üst
2b40efdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
43 deletions
+45
-43
setup.py
setup.py
+45
-43
No files found.
setup.py
Dosyayı görüntüle @
9f5db07d
...
@@ -423,7 +423,8 @@ class PyBuildExt(build_ext):
...
@@ -423,7 +423,8 @@ class PyBuildExt(build_ext):
missing
=
[]
missing
=
[]
config_h
=
sysconfig
.
get_config_h_filename
()
config_h
=
sysconfig
.
get_config_h_filename
()
config_h_vars
=
sysconfig
.
parse_config_h
(
open
(
config_h
))
with
open
(
config_h
)
as
file
:
config_h_vars
=
sysconfig
.
parse_config_h
(
file
)
platform
=
self
.
get_platform
()
platform
=
self
.
get_platform
()
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
...
@@ -556,17 +557,17 @@ class PyBuildExt(build_ext):
...
@@ -556,17 +557,17 @@ class PyBuildExt(build_ext):
os
.
makedirs
(
self
.
build_temp
)
os
.
makedirs
(
self
.
build_temp
)
ret
=
os
.
system
(
"ldd
%
s >
%
s"
%
(
do_readline
,
tmpfile
))
ret
=
os
.
system
(
"ldd
%
s >
%
s"
%
(
do_readline
,
tmpfile
))
if
ret
>>
8
==
0
:
if
ret
>>
8
==
0
:
fp
=
open
(
tmpfile
)
with
open
(
tmpfile
)
as
fp
:
for
ln
in
fp
:
for
ln
in
fp
:
if
'curses'
in
ln
:
if
'curses'
in
ln
:
readline_termcap_library
=
re
.
sub
(
readline_termcap_library
=
re
.
sub
(
r'.*lib(n?cursesw?)\.so.*'
,
r'\1'
,
ln
r'.*lib(n?cursesw?)\.so.*'
,
r'\1'
,
ln
)
.
rstrip
()
)
.
rstrip
()
break
break
if
'tinfo'
in
ln
:
# termcap interface split out from ncurses
# termcap interface split out from ncurses
readline_termcap_library
=
'tinfo'
if
'tinfo'
in
ln
:
break
readline_termcap_library
=
'tinfo'
fp
.
close
()
break
os
.
unlink
(
tmpfile
)
os
.
unlink
(
tmpfile
)
# Issue 7384: If readline is already linked against curses,
# Issue 7384: If readline is already linked against curses,
# use the same library for the readline and curses modules.
# use the same library for the readline and curses modules.
...
@@ -675,11 +676,11 @@ class PyBuildExt(build_ext):
...
@@ -675,11 +676,11 @@ class PyBuildExt(build_ext):
if
sys
.
platform
==
'darwin'
and
is_macosx_sdk_path
(
name
):
if
sys
.
platform
==
'darwin'
and
is_macosx_sdk_path
(
name
):
name
=
os
.
path
.
join
(
macosx_sdk_root
(),
name
[
1
:])
name
=
os
.
path
.
join
(
macosx_sdk_root
(),
name
[
1
:])
try
:
try
:
incfile
=
open
(
name
,
'r'
)
with
open
(
name
,
'r'
)
as
incfile
:
for
line
in
incfile
:
for
line
in
incfile
:
m
=
openssl_ver_re
.
match
(
line
)
m
=
openssl_ver_re
.
match
(
line
)
if
m
:
if
m
:
openssl_ver
=
eval
(
m
.
group
(
1
))
openssl_ver
=
eval
(
m
.
group
(
1
))
except
IOError
as
msg
:
except
IOError
as
msg
:
print
(
"IOError while reading opensshv.h:"
,
msg
)
print
(
"IOError while reading opensshv.h:"
,
msg
)
pass
pass
...
@@ -825,7 +826,8 @@ class PyBuildExt(build_ext):
...
@@ -825,7 +826,8 @@ class PyBuildExt(build_ext):
if
db_setup_debug
:
print
(
"db: looking for db.h in"
,
f
)
if
db_setup_debug
:
print
(
"db: looking for db.h in"
,
f
)
if
os
.
path
.
exists
(
f
):
if
os
.
path
.
exists
(
f
):
f
=
open
(
f
,
"rb"
)
.
read
()
with
open
(
f
,
'rb'
)
as
file
:
f
=
file
.
read
()
m
=
re
.
search
(
br
"#define
\
WDB_VERSION_MAJOR
\
W(
\
d+)"
,
f
)
m
=
re
.
search
(
br
"#define
\
WDB_VERSION_MAJOR
\
W(
\
d+)"
,
f
)
if
m
:
if
m
:
db_major
=
int
(
m
.
group
(
1
))
db_major
=
int
(
m
.
group
(
1
))
...
@@ -945,7 +947,8 @@ class PyBuildExt(build_ext):
...
@@ -945,7 +947,8 @@ class PyBuildExt(build_ext):
if
os
.
path
.
exists
(
f
):
if
os
.
path
.
exists
(
f
):
if
sqlite_setup_debug
:
print
(
"sqlite: found
%
s"
%
f
)
if
sqlite_setup_debug
:
print
(
"sqlite: found
%
s"
%
f
)
incf
=
open
(
f
)
.
read
()
with
open
(
f
)
as
file
:
incf
=
file
.
read
()
m
=
re
.
search
(
m
=
re
.
search
(
r'\s*.*#\s*.*define\s.*SQLITE_VERSION\W*"(.*)"'
,
incf
)
r'\s*.*#\s*.*define\s.*SQLITE_VERSION\W*"(.*)"'
,
incf
)
if
m
:
if
m
:
...
@@ -1170,14 +1173,14 @@ class PyBuildExt(build_ext):
...
@@ -1170,14 +1173,14 @@ class PyBuildExt(build_ext):
zlib_h
=
zlib_inc
[
0
]
+
'/zlib.h'
zlib_h
=
zlib_inc
[
0
]
+
'/zlib.h'
version
=
'"0.0.0"'
version
=
'"0.0.0"'
version_req
=
'"1.1.3"'
version_req
=
'"1.1.3"'
fp
=
open
(
zlib_h
)
with
open
(
zlib_h
)
as
fp
:
while
1
:
while
1
:
line
=
fp
.
readline
()
line
=
fp
.
readline
()
if
not
line
:
if
not
line
:
break
break
if
line
.
startswith
(
'#define ZLIB_VERSION'
):
if
line
.
startswith
(
'#define ZLIB_VERSION'
):
version
=
line
.
split
()[
2
]
version
=
line
.
split
()[
2
]
break
break
if
version
>=
version_req
:
if
version
>=
version_req
:
if
(
self
.
compiler
.
find_library_file
(
lib_dirs
,
'z'
)):
if
(
self
.
compiler
.
find_library_file
(
lib_dirs
,
'z'
)):
if
sys
.
platform
==
"darwin"
:
if
sys
.
platform
==
"darwin"
:
...
@@ -1430,14 +1433,13 @@ class PyBuildExt(build_ext):
...
@@ -1430,14 +1433,13 @@ class PyBuildExt(build_ext):
os
.
system
(
"file
%
s/Tk.framework/Tk | grep 'for architecture' >
%
s"
%
(
os
.
path
.
join
(
sysroot
,
F
[
1
:]),
tmpfile
))
os
.
system
(
"file
%
s/Tk.framework/Tk | grep 'for architecture' >
%
s"
%
(
os
.
path
.
join
(
sysroot
,
F
[
1
:]),
tmpfile
))
else
:
else
:
os
.
system
(
"file
%
s/Tk.framework/Tk | grep 'for architecture' >
%
s"
%
(
F
,
tmpfile
))
os
.
system
(
"file
%
s/Tk.framework/Tk | grep 'for architecture' >
%
s"
%
(
F
,
tmpfile
))
fp
=
open
(
tmpfile
)
with
open
(
tmpfile
)
as
fp
:
detected_archs
=
[]
detected_archs
=
[]
for
ln
in
fp
:
for
ln
in
fp
:
a
=
ln
.
split
()[
-
1
]
a
=
ln
.
split
()[
-
1
]
if
a
in
archs
:
if
a
in
archs
:
detected_archs
.
append
(
ln
.
split
()[
-
1
])
detected_archs
.
append
(
ln
.
split
()[
-
1
])
fp
.
close
()
os
.
unlink
(
tmpfile
)
os
.
unlink
(
tmpfile
)
for
a
in
detected_archs
:
for
a
in
detected_archs
:
...
@@ -1708,14 +1710,14 @@ class PyBuildExt(build_ext):
...
@@ -1708,14 +1710,14 @@ class PyBuildExt(build_ext):
ffi_inc
=
find_file
(
'ffi.h'
,
[],
inc_dirs
)
ffi_inc
=
find_file
(
'ffi.h'
,
[],
inc_dirs
)
if
ffi_inc
is
not
None
:
if
ffi_inc
is
not
None
:
ffi_h
=
ffi_inc
[
0
]
+
'/ffi.h'
ffi_h
=
ffi_inc
[
0
]
+
'/ffi.h'
fp
=
open
(
ffi_h
)
with
open
(
ffi_h
)
as
fp
:
while
1
:
while
1
:
line
=
fp
.
readline
()
line
=
fp
.
readline
()
if
not
line
:
if
not
line
:
ffi_inc
=
None
ffi_inc
=
None
break
break
if
line
.
startswith
(
'#define LIBFFI_H'
):
if
line
.
startswith
(
'#define LIBFFI_H'
):
break
break
ffi_lib
=
None
ffi_lib
=
None
if
ffi_inc
is
not
None
:
if
ffi_inc
is
not
None
:
for
lib_name
in
(
'ffi_convenience'
,
'ffi_pic'
,
'ffi'
):
for
lib_name
in
(
'ffi_convenience'
,
'ffi_pic'
,
'ffi'
):
...
...
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