From 39c07bb676411f75adc1dab697c5917b6a803c49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Thu, 26 Nov 2020 18:00:28 +0000 Subject: Fix provisioning support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- tests/demo_pkg_inline/build.py | 53 ++++++++++++++++++++++++++++++++++++ tests/demo_pkg_inline/pyproject.toml | 4 +++ 2 files changed, 57 insertions(+) create mode 100644 tests/demo_pkg_inline/build.py create mode 100644 tests/demo_pkg_inline/pyproject.toml (limited to 'tests/demo_pkg_inline') diff --git a/tests/demo_pkg_inline/build.py b/tests/demo_pkg_inline/build.py new file mode 100644 index 00000000..7515fc0b --- /dev/null +++ b/tests/demo_pkg_inline/build.py @@ -0,0 +1,53 @@ +import sys +from pathlib import Path +from textwrap import dedent +from zipfile import ZipFile + +name = "demo_pkg_inline" +pkg_name = name.replace("_", "-") + +version = "1.0.0" +dist_info = f"{name}-{version}.dist-info" + +content = { + f"{name}/__init__.py": f"def do():\nprint('greetings from {name}')", + f"{dist_info}/METADATA": f""" + Metadata-Version: 2.1 + Name: {pkg_name} + Version: {version} + Summary: UNKNOWN + Home-page: UNKNOWN + Author: UNKNOWN + Author-email: UNKNOWN + License: UNKNOWN + Platform: UNKNOWN + + UNKNOWN + """, + f"{dist_info}/WHEEL": f""" + Wheel-Version: 1.0 + Generator: {name}-{version} + Root-Is-Purelib: true + Tag: py3-none-any + """, + f"{dist_info}/top_level.txt": name, + f"{dist_info}/RECORD": f""" + {name}/__init__.py,, + {dist_info}/METADATA,, + {dist_info}/WHEEL,, + {dist_info}/top_level.txt,, + {dist_info}/RECORD,, + """, +} + + +def build_wheel(wheel_directory, metadata_directory=None, config_settings=None): + path = Path(wheel_directory) / f"{name}-{version}-py{sys.version_info.major}-none-any.whl" + with ZipFile(str(path), "w") as zip_file_handler: + for arc_name, data in content.items(): + zip_file_handler.writestr(zinfo_or_arcname=arc_name, data=dedent(data).strip()) + print(f"created wheel {path}") + + +def get_requires_for_build_wheel(config_settings): + return [] diff --git a/tests/demo_pkg_inline/pyproject.toml b/tests/demo_pkg_inline/pyproject.toml new file mode 100644 index 00000000..a28fa49a --- /dev/null +++ b/tests/demo_pkg_inline/pyproject.toml @@ -0,0 +1,4 @@ +[build-system] +requires=[] +build-backend="build" +backend-path=["."] -- cgit v1.2.1