From 8e0e0b12f6e2c2c0052d6d2d7e46d497a232bb77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=A9nainn=20Woodsend?= Date: Mon, 23 Oct 2023 23:59:40 +0100 Subject: [PATCH 1/2] Collect metadata for eth_typing. --- news/656.new.rst | 1 + requirements-test-libraries.txt | 1 + .../hooks/stdhooks/hook-eth_typing.py | 16 ++++++++++++++++ .../tests/test_libraries.py | 7 +++++++ 4 files changed, 25 insertions(+) create mode 100644 news/656.new.rst create mode 100644 src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-eth_typing.py diff --git a/news/656.new.rst b/news/656.new.rst new file mode 100644 index 00000000..b67244e3 --- /dev/null +++ b/news/656.new.rst @@ -0,0 +1 @@ +Add hook for ``eth_typing`` which requires its package metadata. diff --git a/requirements-test-libraries.txt b/requirements-test-libraries.txt index 853ee8be..3ddfd5fc 100644 --- a/requirements-test-libraries.txt +++ b/requirements-test-libraries.txt @@ -28,6 +28,7 @@ dash-uploader==0.6.0 # discid requires libdiscid to be provided by the system. # We install it via apt-get and brew on ubuntu and macOS CI runners, respectively. discid==1.2.0; sys_platform != 'win32' +eth_typing==3.5.1 fabric==3.2.2 fiona==1.9.5; sys_platform != 'win32' folium==0.14.0 diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-eth_typing.py b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-eth_typing.py new file mode 100644 index 00000000..85c2e0ee --- /dev/null +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-eth_typing.py @@ -0,0 +1,16 @@ +# ------------------------------------------------------------------ +# 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 +# ------------------------------------------------------------------ + +from PyInstaller.utils.hooks import copy_metadata + +# eth-typing queries it's own version using importlib.metadata/pkg_resources. +datas = copy_metadata("eth-typing") diff --git a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py index eab87e34..faca19e8 100644 --- a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py +++ b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py @@ -640,6 +640,13 @@ def test_googleapiclient(pyi_builder): """) +@importorskip('eth_typing') +def test_eth_typing(pyi_builder): + pyi_builder.test_source(""" + import eth_typing + """) + + @importorskip('plotly') @importorskip('pandas') def test_plotly(pyi_builder): From 98c8de2ace30465cb1f6820ca30452bb4ec7a4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=A9nainn=20Woodsend?= Date: Tue, 24 Oct 2023 00:17:46 +0100 Subject: [PATCH 2/2] Collect data file for eth_utils.network. --- news/656.new.1.rst | 1 + requirements-test-libraries.txt | 1 + .../hooks/stdhooks/hook-eth_utils.network.py | 15 +++++++++++++++ .../tests/test_libraries.py | 8 ++++++++ 4 files changed, 25 insertions(+) create mode 100644 news/656.new.1.rst create mode 100644 src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-eth_utils.network.py diff --git a/news/656.new.1.rst b/news/656.new.1.rst new file mode 100644 index 00000000..ae386326 --- /dev/null +++ b/news/656.new.1.rst @@ -0,0 +1 @@ +Add hook for ``eth_utils`` to collect its embedded JSON files. diff --git a/requirements-test-libraries.txt b/requirements-test-libraries.txt index 3ddfd5fc..a570e832 100644 --- a/requirements-test-libraries.txt +++ b/requirements-test-libraries.txt @@ -29,6 +29,7 @@ dash-uploader==0.6.0 # We install it via apt-get and brew on ubuntu and macOS CI runners, respectively. discid==1.2.0; sys_platform != 'win32' eth_typing==3.5.1 +eth_utils==2.3.0 fabric==3.2.2 fiona==1.9.5; sys_platform != 'win32' folium==0.14.0 diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-eth_utils.network.py b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-eth_utils.network.py new file mode 100644 index 00000000..fcf6432a --- /dev/null +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-eth_utils.network.py @@ -0,0 +1,15 @@ +# ------------------------------------------------------------------ +# Copyright (c) 2020 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 +# ------------------------------------------------------------------ + +from PyInstaller.utils.hooks import collect_data_files + +datas = collect_data_files("eth_utils") diff --git a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py index faca19e8..3908fcef 100644 --- a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py +++ b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py @@ -647,6 +647,14 @@ def test_eth_typing(pyi_builder): """) +@importorskip("eth_utils") +def test_eth_utils_network(pyi_builder): + pyi_builder.test_source(""" + import eth_utils.network + eth_utils.network.name_from_chain_id(1) + """) + + @importorskip('plotly') @importorskip('pandas') def test_plotly(pyi_builder):