File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -358,23 +358,21 @@ def maybe_patch_library(app_configs, **kwargs):
358358 import os , django
359359 django_path = os .path .dirname (django .__file__ )
360360 library_path = os .path .dirname (django_path )
361- saved_cwd = os .getcwd ()
361+ cwd = os .getcwd ()
362362 # All patches in settings.CHECKS_LIBRARY_PATCHES_TO_APPLY must have a
363363 # relative file path rooted in the django dir, for instance
364364 # 'django/db/models/fields/__init__.py'
365365 for patch_file in settings .CHECKS_LIBRARY_PATCHES_TO_APPLY :
366366 try :
367- patch_path = os .path .join (saved_cwd , patch_file )
367+ patch_path = os .path .join (cwd , patch_file )
368368 patch_set = patch .fromfile (patch_path )
369369 if patch_set :
370- os .chdir (library_path )
371- if not patch_set .apply ():
370+ if not patch_set .apply (root = library_path ):
372371 errors .append (checks .Warning (
373372 "Could not apply patch from file '%s'" % patch_file ,
374373 hint = "Make sure that the patch file contains a unified diff and has valid file paths" ,
375374 id = "datatracker.W0002" ,
376375 ))
377- os .chdir (saved_cwd )
378376 else :
379377 errors .append (checks .Warning (
380378 "Could not parse patch file '%s'" % patch_file ,
You can’t perform that action at this time.
0 commit comments