diff --git a/PyInstaller/building/api.py b/PyInstaller/building/api.py index 02d5c30a9fe..2b00dfaf59b 100644 --- a/PyInstaller/building/api.py +++ b/PyInstaller/building/api.py @@ -824,8 +824,28 @@ def _set_dependencies(self, analysis, path): else: dep_path = self._get_relative_path(path, self._dependencies[tpl[1]]) logger.debug("Referencing %s to be a dependecy for %s, located in %s" % (tpl[1], path, dep_path)) + # Determine the path relative to dep_path (i.e, within + # the target directory) from the 'name' component + # of the TOC tuple. If entry is EXTENSION, then the + # relative path needs to be reconstructed from the + # name components. + if tpl[2] == 'EXTENSION': + ext_components = tpl[0].split('.')[:-1] + if ext_components: + rel_path = os.path.join(*ext_components) + else: + rel_path = '' + else: + rel_path = os.path.dirname(tpl[0]) + # Take filename from 'path' (second component of + # TOC tuple); this way, we don't need to worry about + # suffix of extensions. + filename = os.path.basename(tpl[1]) + # Construct the full file path relative to dep_path... + filename = os.path.join(rel_path, filename) + # ...and use it in new DEPENDENCY entry analysis.dependencies.append( - (":".join((dep_path, os.path.basename(tpl[1]))), + (":".join((dep_path, filename)), tpl[1], "DEPENDENCY")) toc[i] = (None, None, None) diff --git a/news/5606.bugfix.rst b/news/5606.bugfix.rst new file mode 100644 index 00000000000..d6e59790e05 --- /dev/null +++ b/news/5606.bugfix.rst @@ -0,0 +1,2 @@ +Fix ``MERGE()`` to properly set references to nested resources with their +full shared-package-relative path instead of just basename.