From 4b98898c7c9844d06e8a6dffd995d820202456bd Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Wed, 4 Apr 2018 09:36:45 +0200 Subject: [Qt module] refactor b4cd949c48ab67891e4bc6b14a8f9f247e28777d Since relative path in qrc files are always relative to qrc file itself then we just need to check that normpath(qrc file + resource) doesn't start with build dir path, this would mean that the resource is generated. Signed-off-by: Alexis Jeandet --- mesonbuild/modules/qt.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'mesonbuild/modules/qt.py') diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index a306af7..39c65ed 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -93,6 +93,9 @@ class QtBaseModule: # a) in build directory -> implies a generated file # b) in source directory # c) somewhere else external dependency file to bundle + # + # Also from qrc documentation: relative path are always from qrc file + # So relative path must always be computed from qrc file ! if os.path.isabs(resource_path): # a) if resource_path.startswith(os.path.abspath(state.environment.build_dir)): @@ -102,10 +105,9 @@ class QtBaseModule: else: result.append(File(is_built=False, subdir=state.subdir, fname=resource_path)) else: - path_from_build = os.path.normpath(os.path.join(state.environment.build_dir, resource_path)) - path_from_rcc = os.path.join(rcc_dirname, resource_path) + path_from_rcc = os.path.normpath(os.path.join(rcc_dirname, resource_path)) # a) - if path_from_build.startswith(state.environment.build_dir) and not os.path.exists(path_from_rcc): + if path_from_rcc.startswith(state.environment.build_dir): result.append(File(is_built=True, subdir=state.subdir, fname=resource_path)) # b) else: -- cgit v1.1