diff options
author | Masen Furer <m_github@0x26.net> | 2023-01-18 07:50:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-18 07:50:21 -0800 |
commit | 8323aaa78a00425b598b093ea0eae82b228fe6d6 (patch) | |
tree | 52d932c5532386ee4d97aef9798df01966c99d53 /tests | |
parent | 23510dc61a2e5e4fc5381a957e75f17796ace265 (diff) | |
download | tox-git-8323aaa78a00425b598b093ea0eae82b228fe6d6.tar.gz |
Include WHEEL metadata when using PDM and poetry backends (#2881)
Fix https://github.com/tox-dev/tox/issues/2880
Fix https://github.com/tox-dev/tox/issues/2870
Diffstat (limited to 'tests')
-rw-r--r-- | tests/demo_pkg_inline/build.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/demo_pkg_inline/build.py b/tests/demo_pkg_inline/build.py index 47df3a3d..22e5dda0 100644 --- a/tests/demo_pkg_inline/build.py +++ b/tests/demo_pkg_inline/build.py @@ -21,8 +21,7 @@ wheel = "{}/WHEEL".format(dist_info) record = "{}/RECORD".format(dist_info) content = { logic: "def do():\n print('greetings from {}')".format(name), - plugin: dedent( - """ + plugin: """ try: from tox.plugin import impl from tox.tox_env.python.virtual_env.runner import VirtualEnvRunner @@ -37,14 +36,13 @@ content = { @impl def tox_register_tox_env(register: ToxEnvRegister) -> None: register.add_run_env(ExampleVirtualEnvRunner) - """, - ), - entry_points: dedent( - """ + """, +} +metadata_files = { + entry_points: """ [tox] example = {}.example_plugin""".format( - name, - ), + name, ), metadata: """ Metadata-Version: 2.1 @@ -88,12 +86,22 @@ content = { } -def build_wheel(wheel_directory, metadata_directory=None, config_settings=None): # noqa: U100 +def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): # noqa: U100 base_name = "{}-{}-py{}-none-any.whl".format(name, version, sys.version_info[0]) path = os.path.join(wheel_directory, base_name) with ZipFile(path, "w") as zip_file_handler: for arc_name, data in content.items(): # pragma: no branch zip_file_handler.writestr(arc_name, dedent(data).strip()) + if metadata_directory is not None: + for sub_directory, _, filenames in os.walk(metadata_directory): + for filename in filenames: + zip_file_handler.write( + os.path.join(metadata_directory, sub_directory, filename), + os.path.join(sub_directory, filename), + ) + else: + for arc_name, data in metadata_files.items(): # pragma: no branch + zip_file_handler.writestr(arc_name, dedent(data).strip()) print("created wheel {}".format(path)) return base_name |