diff --git a/ietf/checks.py b/ietf/checks.py index 183f5b827..4697195ec 100644 --- a/ietf/checks.py +++ b/ietf/checks.py @@ -358,23 +358,21 @@ def maybe_patch_library(app_configs, **kwargs): import os, django django_path = os.path.dirname(django.__file__) library_path = os.path.dirname(django_path) - saved_cwd = os.getcwd() + cwd = os.getcwd() # All patches in settings.CHECKS_LIBRARY_PATCHES_TO_APPLY must have a # relative file path rooted in the django dir, for instance # 'django/db/models/fields/__init__.py' for patch_file in settings.CHECKS_LIBRARY_PATCHES_TO_APPLY: try: - patch_path = os.path.join(saved_cwd, patch_file) + patch_path = os.path.join(cwd, patch_file) patch_set = patch.fromfile(patch_path) if patch_set: - os.chdir(library_path) - if not patch_set.apply(): + if not patch_set.apply(root=library_path): errors.append(checks.Warning( "Could not apply patch from file '%s'"%patch_file, hint="Make sure that the patch file contains a unified diff and has valid file paths", id="datatracker.W0002", )) - os.chdir(saved_cwd) else: errors.append(checks.Warning( "Could not parse patch file '%s'"%patch_file,