Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite758eb3

Browse files
miss-islingtonencukoujaraco
authored
[3.12]gh-123085: _compile_importlib: Avoid copying sources before compilation (GH-124131) (GH-128581)
gh-123085: _compile_importlib: Avoid copying sources before compilation (GH-124131)(cherry picked from commit42c8b05)Co-authored-by: Petr Viktorin <encukou@gmail.com>Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
1 parentadddbc3 commite758eb3

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

‎Lib/test/test_importlib/resources/test_files.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,17 @@ def create_zip_from_directory(source_dir, zip_filename):
150150
def_compile_importlib(self):
151151
"""
152152
Make a compiled-only copy of the importlib resources package.
153+
154+
Currently only code is copied, as importlib resources doesn't itself
155+
have any resources.
153156
"""
154157
bin_site=self.fixtures.enter_context(os_helper.temp_dir())
155158
c_resources=pathlib.Path(bin_site,'c_resources')
156159
sources=pathlib.Path(resources.__file__).parent
157-
shutil.copytree(sources,c_resources,ignore=lambda*_: ['__pycache__'])
158-
159-
fordirpath,_,filenamesinos.walk(c_resources):
160-
forfilenameinfilenames:
161-
source_path=pathlib.Path(dirpath)/filename
162-
cfile=source_path.with_suffix('.pyc')
163-
py_compile.compile(source_path,cfile)
164-
pathlib.Path.unlink(source_path)
160+
161+
forsource_pathinsources.glob('**/*.py'):
162+
c_path=c_resources.joinpath(source_path.relative_to(sources)).with_suffix('.pyc')
163+
py_compile.compile(source_path,c_path)
165164
self.fixtures.enter_context(import_helper.DirsOnSysPath(bin_site))
166165

167166
deftest_implicit_files_with_compiled_importlib(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp