From 61c6ca30581a5a4a7c4d10b428a9cd8946c80ba8 Mon Sep 17 00:00:00 2001 From: Alexey Tereshenkov <50622389+AlexTereshenkov@users.noreply.github.com> Date: Mon, 15 Apr 2024 23:23:28 +0100 Subject: [PATCH] pex: rely on system site-packages for RPM packages installed --- BUILD | 13 +++++++++++++ cheeseshop/cli/cli.py | 2 ++ cheeseshop/cli/utils/utils.py | 1 + cheeseshop/version.py | 2 ++ tests/cli/BUILD | 1 + tests/cli/test_cli.py | 2 ++ 6 files changed, 21 insertions(+) diff --git a/BUILD b/BUILD index 513306c..e5ea712 100644 --- a/BUILD +++ b/BUILD @@ -26,3 +26,16 @@ python_distribution( sdist=False, generate_setup=False, ) + +python_requirement( + name="python3-tabulate", + modules=[ + "tabulate", + ], + requirements=[ + "python3-tabulate", + ], + tags=[ + "provided", + ], +) diff --git a/cheeseshop/cli/cli.py b/cheeseshop/cli/cli.py index e51f256..6107ac8 100644 --- a/cheeseshop/cli/cli.py +++ b/cheeseshop/cli/cli.py @@ -1,5 +1,7 @@ import sys +import tabulate + import click from loguru import logger diff --git a/cheeseshop/cli/utils/utils.py b/cheeseshop/cli/utils/utils.py index bb6ba6a..569a5be 100644 --- a/cheeseshop/cli/utils/utils.py +++ b/cheeseshop/cli/utils/utils.py @@ -3,6 +3,7 @@ # forbidden import # from cheeseshop.repository.parsing.casts import from_none +import tabulate def choices(option_type: Iterable) -> list[str]: """Get click option choices from an iterable.""" diff --git a/cheeseshop/version.py b/cheeseshop/version.py index d55e389..b9abb3e 100644 --- a/cheeseshop/version.py +++ b/cheeseshop/version.py @@ -1,5 +1,7 @@ import pkgutil +import tabulate + VERSION: str = ( pkgutil.get_data(__name__, "VERSION").decode().strip() # type: ignore[union-attr] ) diff --git a/tests/cli/BUILD b/tests/cli/BUILD index 2d957ce..f9cd974 100644 --- a/tests/cli/BUILD +++ b/tests/cli/BUILD @@ -4,6 +4,7 @@ python_tests( "cheeseshop:project-version", ":cassettes", ], + extra_env_vars=["PEX_EXTRA_SYS_PATH"] ) resources( diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py index 8a60305..9dd6900 100644 --- a/tests/cli/test_cli.py +++ b/tests/cli/test_cli.py @@ -4,8 +4,10 @@ from cheeseshop.cli import cli from cheeseshop.version import VERSION +import tabulate def test_cli(): + assert tabulate.tabulate("") == "" runner = CliRunner() result = runner.invoke(cli.cli, ["--version"]) assert result.exit_code == 0