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
c5d5dfdb
Unverified
Kaydet (Commit)
c5d5dfdb
authored
Ara 20, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Ara 20, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-22831: Use "with" to avoid possible fd leaks in distutils. (GH-10921)
üst
71f82a2f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
69 deletions
+65
-69
archive_util.py
Lib/distutils/archive_util.py
+11
-11
bdist_msi.py
Lib/distutils/command/bdist_msi.py
+12
-12
config.py
Lib/distutils/command/config.py
+17
-19
sdist.py
Lib/distutils/command/sdist.py
+7
-8
util.py
Lib/distutils/util.py
+18
-19
No files found.
Lib/distutils/archive_util.py
Dosyayı görüntüle @
c5d5dfdb
...
@@ -166,21 +166,21 @@ def make_zipfile(base_name, base_dir, verbose=0, dry_run=0):
...
@@ -166,21 +166,21 @@ def make_zipfile(base_name, base_dir, verbose=0, dry_run=0):
zip
=
zipfile
.
ZipFile
(
zip_filename
,
"w"
,
zip
=
zipfile
.
ZipFile
(
zip_filename
,
"w"
,
compression
=
zipfile
.
ZIP_STORED
)
compression
=
zipfile
.
ZIP_STORED
)
if
base_dir
!=
os
.
curdir
:
with
zip
:
path
=
os
.
path
.
normpath
(
os
.
path
.
join
(
base_dir
,
''
))
if
base_dir
!=
os
.
curdir
:
zip
.
write
(
path
,
path
)
path
=
os
.
path
.
normpath
(
os
.
path
.
join
(
base_dir
,
''
))
log
.
info
(
"adding '
%
s'"
,
path
)
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
base_dir
):
for
name
in
dirnames
:
path
=
os
.
path
.
normpath
(
os
.
path
.
join
(
dirpath
,
name
,
''
))
zip
.
write
(
path
,
path
)
zip
.
write
(
path
,
path
)
log
.
info
(
"adding '
%
s'"
,
path
)
log
.
info
(
"adding '
%
s'"
,
path
)
for
name
in
filenames
:
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
base_dir
)
:
path
=
os
.
path
.
normpath
(
os
.
path
.
join
(
dirpath
,
name
))
for
name
in
dirnames
:
if
os
.
path
.
isfile
(
path
):
path
=
os
.
path
.
normpath
(
os
.
path
.
join
(
dirpath
,
name
,
''
))
zip
.
write
(
path
,
path
)
zip
.
write
(
path
,
path
)
log
.
info
(
"adding '
%
s'"
,
path
)
log
.
info
(
"adding '
%
s'"
,
path
)
zip
.
close
()
for
name
in
filenames
:
path
=
os
.
path
.
normpath
(
os
.
path
.
join
(
dirpath
,
name
))
if
os
.
path
.
isfile
(
path
):
zip
.
write
(
path
,
path
)
log
.
info
(
"adding '
%
s'"
,
path
)
return
zip_filename
return
zip_filename
...
...
Lib/distutils/command/bdist_msi.py
Dosyayı görüntüle @
c5d5dfdb
...
@@ -390,18 +390,18 @@ class bdist_msi(Command):
...
@@ -390,18 +390,18 @@ class bdist_msi(Command):
# entries for each version as the above code does
# entries for each version as the above code does
if
self
.
pre_install_script
:
if
self
.
pre_install_script
:
scriptfn
=
os
.
path
.
join
(
self
.
bdist_dir
,
"preinstall.bat"
)
scriptfn
=
os
.
path
.
join
(
self
.
bdist_dir
,
"preinstall.bat"
)
f
=
open
(
scriptfn
,
"w"
)
with
open
(
scriptfn
,
"w"
)
as
f
:
# The batch file will be executed with [PYTHON], so that %1
# The batch file will be executed with [PYTHON], so that %1
# is the path to the Python interpreter; %0 will be the path
# is the path to the Python interpreter; %0 will be the path
# of the batch file.
# of the batch file.
# rem ="""
# rem ="""
# %1 %0
# %1 %0
# exit
# exit
# """
# """
# <actual script>
# <actual script>
f
.
write
(
'rem ="""
\n
%1
%0
\n
exit
\n
"""
\n
'
)
f
.
write
(
'rem ="""
\n
%1
%0
\n
exit
\n
"""
\n
'
)
f
.
write
(
open
(
self
.
pre_install_script
)
.
read
())
with
open
(
self
.
pre_install_script
)
as
fin
:
f
.
close
(
)
f
.
write
(
fin
.
read
()
)
add_data
(
self
.
db
,
"Binary"
,
add_data
(
self
.
db
,
"Binary"
,
[(
"PreInstall"
,
msilib
.
Binary
(
scriptfn
))
[(
"PreInstall"
,
msilib
.
Binary
(
scriptfn
))
])
])
...
...
Lib/distutils/command/config.py
Dosyayı görüntüle @
c5d5dfdb
...
@@ -106,15 +106,14 @@ class config(Command):
...
@@ -106,15 +106,14 @@ class config(Command):
def
_gen_temp_sourcefile
(
self
,
body
,
headers
,
lang
):
def
_gen_temp_sourcefile
(
self
,
body
,
headers
,
lang
):
filename
=
"_configtest"
+
LANG_EXT
[
lang
]
filename
=
"_configtest"
+
LANG_EXT
[
lang
]
file
=
open
(
filename
,
"w"
)
with
open
(
filename
,
"w"
)
as
file
:
if
headers
:
if
headers
:
for
header
in
headers
:
for
header
in
headers
:
file
.
write
(
"#include <
%
s>
\n
"
%
header
)
file
.
write
(
"#include <
%
s>
\n
"
%
header
)
file
.
write
(
"
\n
"
)
file
.
write
(
"
\n
"
)
file
.
write
(
body
)
file
.
write
(
body
)
if
body
[
-
1
]
!=
"
\n
"
:
if
body
[
-
1
]
!=
"
\n
"
:
file
.
write
(
"
\n
"
)
file
.
write
(
"
\n
"
)
file
.
close
()
return
filename
return
filename
def
_preprocess
(
self
,
body
,
headers
,
include_dirs
,
lang
):
def
_preprocess
(
self
,
body
,
headers
,
include_dirs
,
lang
):
...
@@ -203,17 +202,16 @@ class config(Command):
...
@@ -203,17 +202,16 @@ class config(Command):
if
isinstance
(
pattern
,
str
):
if
isinstance
(
pattern
,
str
):
pattern
=
re
.
compile
(
pattern
)
pattern
=
re
.
compile
(
pattern
)
file
=
open
(
out
)
with
open
(
out
)
as
file
:
match
=
False
match
=
False
while
True
:
while
True
:
line
=
file
.
readline
()
line
=
file
.
readline
()
if
line
==
''
:
if
line
==
''
:
break
break
if
pattern
.
search
(
line
):
if
pattern
.
search
(
line
):
match
=
True
match
=
True
break
break
file
.
close
()
self
.
_clean
()
self
.
_clean
()
return
match
return
match
...
...
Lib/distutils/command/sdist.py
Dosyayı görüntüle @
c5d5dfdb
...
@@ -407,14 +407,13 @@ class sdist(Command):
...
@@ -407,14 +407,13 @@ class sdist(Command):
distribution.
distribution.
"""
"""
log
.
info
(
"reading manifest file '
%
s'"
,
self
.
manifest
)
log
.
info
(
"reading manifest file '
%
s'"
,
self
.
manifest
)
manifest
=
open
(
self
.
manifest
)
with
open
(
self
.
manifest
)
as
manifest
:
for
line
in
manifest
:
for
line
in
manifest
:
# ignore comments and blank lines
# ignore comments and blank lines
line
=
line
.
strip
()
line
=
line
.
strip
()
if
line
.
startswith
(
'#'
)
or
not
line
:
if
line
.
startswith
(
'#'
)
or
not
line
:
continue
continue
self
.
filelist
.
append
(
line
)
self
.
filelist
.
append
(
line
)
manifest
.
close
()
def
make_release_tree
(
self
,
base_dir
,
files
):
def
make_release_tree
(
self
,
base_dir
,
files
):
"""Create the directory tree that will become the source
"""Create the directory tree that will become the source
...
...
Lib/distutils/util.py
Dosyayı görüntüle @
c5d5dfdb
...
@@ -378,35 +378,34 @@ def byte_compile (py_files,
...
@@ -378,35 +378,34 @@ def byte_compile (py_files,
else
:
else
:
script
=
open
(
script_name
,
"w"
)
script
=
open
(
script_name
,
"w"
)
script
.
write
(
"""
\
with
script
:
script
.
write
(
"""
\
from distutils.util import byte_compile
from distutils.util import byte_compile
files = [
files = [
"""
)
"""
)
# XXX would be nice to write absolute filenames, just for
# XXX would be nice to write absolute filenames, just for
# safety's sake (script should be more robust in the face of
# safety's sake (script should be more robust in the face of
# chdir'ing before running it). But this requires abspath'ing
# chdir'ing before running it). But this requires abspath'ing
# 'prefix' as well, and that breaks the hack in build_lib's
# 'prefix' as well, and that breaks the hack in build_lib's
# 'byte_compile()' method that carefully tacks on a trailing
# 'byte_compile()' method that carefully tacks on a trailing
# slash (os.sep really) to make sure the prefix here is "just
# slash (os.sep really) to make sure the prefix here is "just
# right". This whole prefix business is rather delicate -- the
# right". This whole prefix business is rather delicate -- the
# problem is that it's really a directory, but I'm treating it
# problem is that it's really a directory, but I'm treating it
# as a dumb string, so trailing slashes and so forth matter.
# as a dumb string, so trailing slashes and so forth matter.
#py_files = map(os.path.abspath, py_files)
#py_files = map(os.path.abspath, py_files)
#if prefix:
#if prefix:
# prefix = os.path.abspath(prefix)
# prefix = os.path.abspath(prefix)
script
.
write
(
",
\n
"
.
join
(
map
(
repr
,
py_files
))
+
"]
\n
"
)
script
.
write
(
",
\n
"
.
join
(
map
(
repr
,
py_files
))
+
"]
\n
"
)
script
.
write
(
"""
script
.
write
(
"""
byte_compile(files, optimize=
%
r, force=
%
r,
byte_compile(files, optimize=
%
r, force=
%
r,
prefix=
%
r, base_dir=
%
r,
prefix=
%
r, base_dir=
%
r,
verbose=
%
r, dry_run=0,
verbose=
%
r, dry_run=0,
direct=1)
direct=1)
"""
%
(
optimize
,
force
,
prefix
,
base_dir
,
verbose
))
"""
%
(
optimize
,
force
,
prefix
,
base_dir
,
verbose
))
script
.
close
()
cmd
=
[
sys
.
executable
]
cmd
=
[
sys
.
executable
]
cmd
.
extend
(
subprocess
.
_optim_args_from_interpreter_flags
())
cmd
.
extend
(
subprocess
.
_optim_args_from_interpreter_flags
())
cmd
.
append
(
script_name
)
cmd
.
append
(
script_name
)
...
...
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