Skip to content

Commit

Permalink
Cleanup: Remove now unused hooks utilities.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoodsend committed Dec 29, 2020
1 parent ab1f9ce commit a104661
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions PyInstaller/utils/hooks/__init__.py
Expand Up @@ -889,40 +889,6 @@ def collect_system_data_files(path, destdir=None, include_py_files=False):
return datas


def _find_prefix(filename):
"""
In virtualenv, _CONFIG_H and _MAKEFILE may have same or different
prefixes, depending on the version of virtualenv.
Try to find the correct one, which is assumed to be the longest one.
"""
if not is_venv:
return sys.prefix
filename = os.path.abspath(filename)
prefixes = [os.path.abspath(sys.prefix), base_prefix]
possible_prefixes = []
for prefix in prefixes:
common = os.path.commonprefix([prefix, filename])
if common == prefix:
possible_prefixes.append(prefix)
if not possible_prefixes:
# no matching prefix, assume running from build directory
possible_prefixes = [os.path.dirname(filename)]
possible_prefixes.sort(key=lambda p: len(p), reverse=True)
return possible_prefixes[0]


def relpath_to_config_or_make(filename):
"""
The following is refactored out of hook-sysconfig and hook-distutils,
both of which need to generate "datas" tuples for pyconfig.h and
Makefile, under the same conditions.
"""

# Relative path in the dist directory.
prefix = _find_prefix(filename)
return os.path.relpath(os.path.dirname(filename), prefix)


def copy_metadata(package_name):
"""
This function returns a list to be assigned to the ``datas`` global
Expand Down

0 comments on commit a104661

Please sign in to comment.