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
61c3556c
Kaydet (Commit)
61c3556c
authored
Haz 15, 2013
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17177: Stop using imp in distutils
üst
7822e123
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
22 deletions
+26
-22
build_py.py
Lib/distutils/command/build_py.py
+5
-5
install_lib.py
Lib/distutils/command/install_lib.py
+3
-3
test_bdist_dumb.py
Lib/distutils/tests/test_bdist_dumb.py
+1
-2
test_build_py.py
Lib/distutils/tests/test_build_py.py
+6
-4
test_install.py
Lib/distutils/tests/test_install.py
+2
-2
test_install_lib.py
Lib/distutils/tests/test_install_lib.py
+5
-3
util.py
Lib/distutils/util.py
+4
-3
No files found.
Lib/distutils/command/build_py.py
Dosyayı görüntüle @
61c3556c
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Implements the Distutils 'build_py' command."""
Implements the Distutils 'build_py' command."""
import
os
import
os
import
imp
import
imp
ortlib.util
import
sys
import
sys
from
glob
import
glob
from
glob
import
glob
...
@@ -312,11 +312,11 @@ class build_py (Command):
...
@@ -312,11 +312,11 @@ class build_py (Command):
outputs
.
append
(
filename
)
outputs
.
append
(
filename
)
if
include_bytecode
:
if
include_bytecode
:
if
self
.
compile
:
if
self
.
compile
:
outputs
.
append
(
imp
.
cache_from_source
(
filename
,
outputs
.
append
(
imp
ortlib
.
util
.
cache_from_source
(
debug_override
=
True
))
filename
,
debug_override
=
True
))
if
self
.
optimize
>
0
:
if
self
.
optimize
>
0
:
outputs
.
append
(
imp
.
cache_from_source
(
filename
,
outputs
.
append
(
imp
ortlib
.
util
.
cache_from_source
(
debug_override
=
False
))
filename
,
debug_override
=
False
))
outputs
+=
[
outputs
+=
[
os
.
path
.
join
(
build_dir
,
filename
)
os
.
path
.
join
(
build_dir
,
filename
)
...
...
Lib/distutils/command/install_lib.py
Dosyayı görüntüle @
61c3556c
...
@@ -4,7 +4,7 @@ Implements the Distutils 'install_lib' command
...
@@ -4,7 +4,7 @@ Implements the Distutils 'install_lib' command
(install all Python modules)."""
(install all Python modules)."""
import
os
import
os
import
imp
import
imp
ortlib.util
import
sys
import
sys
from
distutils.core
import
Command
from
distutils.core
import
Command
...
@@ -165,10 +165,10 @@ class install_lib(Command):
...
@@ -165,10 +165,10 @@ class install_lib(Command):
if
ext
!=
PYTHON_SOURCE_EXTENSION
:
if
ext
!=
PYTHON_SOURCE_EXTENSION
:
continue
continue
if
self
.
compile
:
if
self
.
compile
:
bytecode_files
.
append
(
imp
.
cache_from_source
(
bytecode_files
.
append
(
imp
ortlib
.
util
.
cache_from_source
(
py_file
,
debug_override
=
True
))
py_file
,
debug_override
=
True
))
if
self
.
optimize
>
0
:
if
self
.
optimize
>
0
:
bytecode_files
.
append
(
imp
.
cache_from_source
(
bytecode_files
.
append
(
imp
ortlib
.
util
.
cache_from_source
(
py_file
,
debug_override
=
False
))
py_file
,
debug_override
=
False
))
return
bytecode_files
return
bytecode_files
...
...
Lib/distutils/tests/test_bdist_dumb.py
Dosyayı görüntüle @
61c3556c
"""Tests for distutils.command.bdist_dumb."""
"""Tests for distutils.command.bdist_dumb."""
import
os
import
os
import
imp
import
sys
import
sys
import
zipfile
import
zipfile
import
unittest
import
unittest
...
@@ -88,7 +87,7 @@ class BuildDumbTestCase(support.TempdirManager,
...
@@ -88,7 +87,7 @@ class BuildDumbTestCase(support.TempdirManager,
contents
=
sorted
(
os
.
path
.
basename
(
fn
)
for
fn
in
contents
)
contents
=
sorted
(
os
.
path
.
basename
(
fn
)
for
fn
in
contents
)
wanted
=
[
'foo-0.1-py
%
s.
%
s.egg-info'
%
sys
.
version_info
[:
2
],
'foo.py'
]
wanted
=
[
'foo-0.1-py
%
s.
%
s.egg-info'
%
sys
.
version_info
[:
2
],
'foo.py'
]
if
not
sys
.
dont_write_bytecode
:
if
not
sys
.
dont_write_bytecode
:
wanted
.
append
(
'foo.
%
s.pyc'
%
imp
.
get_tag
()
)
wanted
.
append
(
'foo.
%
s.pyc'
%
sys
.
implementation
.
cache_tag
)
self
.
assertEqual
(
contents
,
sorted
(
wanted
))
self
.
assertEqual
(
contents
,
sorted
(
wanted
))
def
test_suite
():
def
test_suite
():
...
...
Lib/distutils/tests/test_build_py.py
Dosyayı görüntüle @
61c3556c
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
import
os
import
os
import
sys
import
sys
import
imp
import
unittest
import
unittest
from
distutils.command.build_py
import
build_py
from
distutils.command.build_py
import
build_py
...
@@ -63,7 +62,8 @@ class BuildPyTestCase(support.TempdirManager,
...
@@ -63,7 +62,8 @@ class BuildPyTestCase(support.TempdirManager,
self
.
assertFalse
(
os
.
path
.
exists
(
pycache_dir
))
self
.
assertFalse
(
os
.
path
.
exists
(
pycache_dir
))
else
:
else
:
pyc_files
=
os
.
listdir
(
pycache_dir
)
pyc_files
=
os
.
listdir
(
pycache_dir
)
self
.
assertIn
(
"__init__.
%
s.pyc"
%
imp
.
get_tag
(),
pyc_files
)
self
.
assertIn
(
"__init__.
%
s.pyc"
%
sys
.
implementation
.
cache_tag
,
pyc_files
)
def
test_empty_package_dir
(
self
):
def
test_empty_package_dir
(
self
):
# See bugs #1668596/#1720897
# See bugs #1668596/#1720897
...
@@ -102,7 +102,8 @@ class BuildPyTestCase(support.TempdirManager,
...
@@ -102,7 +102,8 @@ class BuildPyTestCase(support.TempdirManager,
found
=
os
.
listdir
(
cmd
.
build_lib
)
found
=
os
.
listdir
(
cmd
.
build_lib
)
self
.
assertEqual
(
sorted
(
found
),
[
'__pycache__'
,
'boiledeggs.py'
])
self
.
assertEqual
(
sorted
(
found
),
[
'__pycache__'
,
'boiledeggs.py'
])
found
=
os
.
listdir
(
os
.
path
.
join
(
cmd
.
build_lib
,
'__pycache__'
))
found
=
os
.
listdir
(
os
.
path
.
join
(
cmd
.
build_lib
,
'__pycache__'
))
self
.
assertEqual
(
found
,
[
'boiledeggs.
%
s.pyc'
%
imp
.
get_tag
()])
self
.
assertEqual
(
found
,
[
'boiledeggs.
%
s.pyc'
%
sys
.
implementation
.
cache_tag
])
@unittest.skipIf
(
sys
.
dont_write_bytecode
,
'byte-compile disabled'
)
@unittest.skipIf
(
sys
.
dont_write_bytecode
,
'byte-compile disabled'
)
def
test_byte_compile_optimized
(
self
):
def
test_byte_compile_optimized
(
self
):
...
@@ -119,7 +120,8 @@ class BuildPyTestCase(support.TempdirManager,
...
@@ -119,7 +120,8 @@ class BuildPyTestCase(support.TempdirManager,
found
=
os
.
listdir
(
cmd
.
build_lib
)
found
=
os
.
listdir
(
cmd
.
build_lib
)
self
.
assertEqual
(
sorted
(
found
),
[
'__pycache__'
,
'boiledeggs.py'
])
self
.
assertEqual
(
sorted
(
found
),
[
'__pycache__'
,
'boiledeggs.py'
])
found
=
os
.
listdir
(
os
.
path
.
join
(
cmd
.
build_lib
,
'__pycache__'
))
found
=
os
.
listdir
(
os
.
path
.
join
(
cmd
.
build_lib
,
'__pycache__'
))
self
.
assertEqual
(
sorted
(
found
),
[
'boiledeggs.
%
s.pyo'
%
imp
.
get_tag
()])
self
.
assertEqual
(
sorted
(
found
),
[
'boiledeggs.
%
s.pyo'
%
sys
.
implementation
.
cache_tag
])
def
test_dont_write_bytecode
(
self
):
def
test_dont_write_bytecode
(
self
):
# makes sure byte_compile is not used
# makes sure byte_compile is not used
...
...
Lib/distutils/tests/test_install.py
Dosyayı görüntüle @
61c3556c
"""Tests for distutils.command.install."""
"""Tests for distutils.command.install."""
import
os
import
os
import
imp
import
sys
import
sys
import
unittest
import
unittest
import
site
import
site
...
@@ -193,7 +192,8 @@ class InstallTestCase(support.TempdirManager,
...
@@ -193,7 +192,8 @@ class InstallTestCase(support.TempdirManager,
f
.
close
()
f
.
close
()
found
=
[
os
.
path
.
basename
(
line
)
for
line
in
content
.
splitlines
()]
found
=
[
os
.
path
.
basename
(
line
)
for
line
in
content
.
splitlines
()]
expected
=
[
'hello.py'
,
'hello.
%
s.pyc'
%
imp
.
get_tag
(),
'sayhi'
,
expected
=
[
'hello.py'
,
'hello.
%
s.pyc'
%
sys
.
implementation
.
cache_tag
,
'sayhi'
,
'UNKNOWN-0.0.0-py
%
s.
%
s.egg-info'
%
sys
.
version_info
[:
2
]]
'UNKNOWN-0.0.0-py
%
s.
%
s.egg-info'
%
sys
.
version_info
[:
2
]]
self
.
assertEqual
(
found
,
expected
)
self
.
assertEqual
(
found
,
expected
)
...
...
Lib/distutils/tests/test_install_lib.py
Dosyayı görüntüle @
61c3556c
"""Tests for distutils.command.install_data."""
"""Tests for distutils.command.install_data."""
import
sys
import
sys
import
os
import
os
import
imp
import
imp
ortlib.util
import
unittest
import
unittest
from
distutils.command.install_lib
import
install_lib
from
distutils.command.install_lib
import
install_lib
...
@@ -44,8 +44,10 @@ class InstallLibTestCase(support.TempdirManager,
...
@@ -44,8 +44,10 @@ class InstallLibTestCase(support.TempdirManager,
f
=
os
.
path
.
join
(
project_dir
,
'foo.py'
)
f
=
os
.
path
.
join
(
project_dir
,
'foo.py'
)
self
.
write_file
(
f
,
'# python file'
)
self
.
write_file
(
f
,
'# python file'
)
cmd
.
byte_compile
([
f
])
cmd
.
byte_compile
([
f
])
pyc_file
=
imp
.
cache_from_source
(
'foo.py'
,
debug_override
=
True
)
pyc_file
=
importlib
.
util
.
cache_from_source
(
'foo.py'
,
pyo_file
=
imp
.
cache_from_source
(
'foo.py'
,
debug_override
=
False
)
debug_override
=
True
)
pyo_file
=
importlib
.
util
.
cache_from_source
(
'foo.py'
,
debug_override
=
False
)
self
.
assertTrue
(
os
.
path
.
exists
(
pyc_file
))
self
.
assertTrue
(
os
.
path
.
exists
(
pyc_file
))
self
.
assertTrue
(
os
.
path
.
exists
(
pyo_file
))
self
.
assertTrue
(
os
.
path
.
exists
(
pyo_file
))
...
...
Lib/distutils/util.py
Dosyayı görüntüle @
61c3556c
...
@@ -6,7 +6,7 @@ one of the other *util.py modules.
...
@@ -6,7 +6,7 @@ one of the other *util.py modules.
import
os
import
os
import
re
import
re
import
imp
import
imp
ortlib.util
import
sys
import
sys
import
string
import
string
from
distutils.errors
import
DistutilsPlatformError
from
distutils.errors
import
DistutilsPlatformError
...
@@ -453,9 +453,10 @@ byte_compile(files, optimize=%r, force=%r,
...
@@ -453,9 +453,10 @@ byte_compile(files, optimize=%r, force=%r,
# cfile - byte-compiled file
# cfile - byte-compiled file
# dfile - purported source filename (same as 'file' by default)
# dfile - purported source filename (same as 'file' by default)
if
optimize
>=
0
:
if
optimize
>=
0
:
cfile
=
imp
.
cache_from_source
(
file
,
debug_override
=
not
optimize
)
cfile
=
importlib
.
util
.
cache_from_source
(
file
,
debug_override
=
not
optimize
)
else
:
else
:
cfile
=
imp
.
cache_from_source
(
file
)
cfile
=
imp
ortlib
.
util
.
cache_from_source
(
file
)
dfile
=
file
dfile
=
file
if
prefix
:
if
prefix
:
if
file
[:
len
(
prefix
)]
!=
prefix
:
if
file
[:
len
(
prefix
)]
!=
prefix
:
...
...
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