From aa2dee2cf93d7500c5f246d3adc171b05acce000 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 2 Jul 2025 03:15:51 +0200 Subject: [PATCH] Fix twisted plugin installation with new packaging. (#562) * Added test for twisted plugin installation. Refs #557. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed setuptools configuration Port correct configuration from old setup.cfg file. Regression in #542. Fixes #557. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- tests/test_packaging.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/test_packaging.py diff --git a/pyproject.toml b/pyproject.toml index 7a2e796..9b410aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ requires = ["setuptools"] build-backend = "setuptools.build_meta" [tool.setuptools] -packages = ["daphne"] +package-dir = { daphne = "daphne", twisted = "daphne/twisted" } [tool.setuptools.dynamic] version = { attr = "daphne.__version__" } diff --git a/tests/test_packaging.py b/tests/test_packaging.py new file mode 100644 index 0000000..2107b5d --- /dev/null +++ b/tests/test_packaging.py @@ -0,0 +1,15 @@ +import sys +from pathlib import Path + + +def test_fd_endpoint_plugin_installed(): + # Find the site-packages directory + for path in sys.path: + if "site-packages" in path: + site_packages = Path(path) + break + else: + raise AssertionError("Could not find site-packages in sys.path") + + plugin_path = site_packages / "twisted" / "plugins" / "fd_endpoint.py" + assert plugin_path.exists(), f"fd_endpoint.py not found at {plugin_path}"