From 1e515aa8f6af13436ba2984ccd9956d1f2558431 Mon Sep 17 00:00:00 2001 From: sneaxiy <32832641+sneaxiy@users.noreply.github.com> Date: Tue, 25 Jan 2022 16:22:51 +0800 Subject: [PATCH] [Custom Ops]Assert _compile_dir/includes.txt existence (#39183) * assert _compile_dir include file existence * polish --- python/paddle/utils/cpp_extension/extension_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/utils/cpp_extension/extension_utils.py b/python/paddle/utils/cpp_extension/extension_utils.py index f085eac1e3..853a98a62b 100644 --- a/python/paddle/utils/cpp_extension/extension_utils.py +++ b/python/paddle/utils/cpp_extension/extension_utils.py @@ -449,8 +449,8 @@ def _get_include_dirs_when_compiling(compile_dir): include_dirs_file = 'includes.txt' path = os.path.abspath(compile_dir) include_dirs_file = os.path.join(path, include_dirs_file) - if not os.path.isfile(include_dirs_file): - return [] + assert os.path.isfile(include_dirs_file), "File {} does not exist".format( + include_dirs_file) with open(include_dirs_file, 'r') as f: include_dirs = [line.strip() for line in f.readlines() if line.strip()] -- GitLab