Skip to content

Commit

Permalink
building: have MERGE handle potential path prefix for extensions
Browse files Browse the repository at this point in the history
As we add lib-dynload/ path prefix for python extensions coming
from that directory, we need to adjust relative path computation
in MERGE to handle potential path prefix in extension name.

This could be avoided if path prefix was added as package name
(i.e., with dot instead of path separator), but having it as
path component makes it more explicit and easier to spot.
  • Loading branch information
rokm committed Mar 6, 2021
1 parent 1c9438d commit 6aa1040
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion PyInstaller/building/api.py
Expand Up @@ -830,7 +830,11 @@ def _set_dependencies(self, analysis, path):
# relative path needs to be reconstructed from the
# name components.
if tpl[2] == 'EXTENSION':
ext_components = tpl[0].split('.')[:-1]
# Split on os.path.sep first, to handle additional
# path prefix (e.g., lib-dynload)
ext_components = tpl[0].split(os.path.sep)
ext_components = ext_components[:-1] \
+ ext_components[-1].split('.')[:-1]
if ext_components:
rel_path = os.path.join(*ext_components)
else:
Expand Down

0 comments on commit 6aa1040

Please sign in to comment.