Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hook for fastparquet #583

Merged
merged 1 commit into from
May 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/583.new.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add hook for ``fastparquet``.
1 change: 1 addition & 0 deletions requirements-test-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ minecraft-launcher-lib==5.3; python_version >= '3.8'
scikit-learn==1.2.2; python_version >= '3.8'
scikit-image==0.20.0; python_version >= '3.8'
customtkinter==5.1.3
fastparquet==2023.4.0; python_version >= '3.8'

# ------------------- Platform (OS) specifics

Expand Down
32 changes: 32 additions & 0 deletions src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-fastparquet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ------------------------------------------------------------------
# Copyright (c) 2023 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPDX-License-Identifier: GPL-2.0-or-later
# ------------------------------------------------------------------
import os

from PyInstaller.compat import is_win
from PyInstaller.utils.hooks import get_package_paths

# In all versions for which fastparquet provides Windows wheels (>= 0.7.0), delvewheel is used,
# so we need to collect the external site-packages/fastparquet.libs directory.
if is_win:
pkg_base, pkg_dir = get_package_paths("fastparquet")
lib_dir = os.path.join(pkg_base, "fastparquet.libs")
if os.path.isdir(lib_dir):
# We collect DLLs as data files instead of binaries to suppress binary
# analysis, which would result in duplicates (because it collects a copy
# into the top-level directory instead of preserving the original layout).
# In addition to DLls, this also collects .load-order* file (required on
# python < 3.8), and ensures that fastparquet.libs directory exists (required
# on python >= 3.8 due to os.add_dll_directory call).
datas = [
(os.path.join(lib_dir, lib_file), 'fastparquet.libs')
for lib_file in os.listdir(lib_dir)
]
7 changes: 7 additions & 0 deletions src/_pyinstaller_hooks_contrib/tests/test_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1581,3 +1581,10 @@ def test_pylibmagic(pyi_builder):
assert os.path.isfile(f"{pylibmagic_data_path}/{file}"), \
f"The {file} was not collected to _MEIPASS!"
""")


@importorskip('fastparquet')
def test_fastparquet(pyi_builder):
pyi_builder.test_source("""
import fastparquet
""")