From 4ff662da00f4e2f59e719ccc7caf7344d5677351 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Mon, 30 Sep 2024 00:39:01 +0530 Subject: [PATCH 1/2] Support metadata version 2.4 --- make_wheels.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/make_wheels.py b/make_wheels.py index 3330659..4ee359c 100644 --- a/make_wheels.py +++ b/make_wheels.py @@ -48,7 +48,7 @@ def writestr(self, zinfo_or_arcname, data, *args, **kwargs): def make_message(headers, payload=None): msg = EmailMessage() - for name, value in headers.items(): + for name, value in headers: if isinstance(value, list): for value_part in value: msg[name] = value_part @@ -71,18 +71,18 @@ def write_wheel(out_dir, *, name, version, tag, metadata, description, contents) dist_info = f'{name}-{version}.dist-info' return write_wheel_file(os.path.join(out_dir, wheel_name), { **contents, - f'{dist_info}/METADATA': make_message({ - 'Metadata-Version': '2.1', - 'Name': name, - 'Version': version, - **metadata, - }, description), - f'{dist_info}/WHEEL': make_message({ - 'Wheel-Version': '1.0', - 'Generator': 'ziglang make_wheels.py', - 'Root-Is-Purelib': 'false', - 'Tag': tag, - }), + f'{dist_info}/METADATA': make_message([ + ('Metadata-Version', '2.4'), + ('Name', name), + ('Version', version), + *metadata, + ], description), + f'{dist_info}/WHEEL': make_message([ + ('Wheel-Version', '1.0'), + ('Generator', 'ziglang make_wheels.py'), + ('Root-Is-Purelib', 'false'), + ('Tag', tag), + ]), }) From 0b39c09601de7eb7a8f622313680331a580142e3 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Mon, 30 Sep 2024 00:42:42 +0530 Subject: [PATCH 2/2] Add `License-Expression:` and `License-File:` fields, more classifiers --- make_wheels.py | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/make_wheels.py b/make_wheels.py index 4ee359c..bacfd75 100644 --- a/make_wheels.py +++ b/make_wheels.py @@ -134,20 +134,33 @@ def write_ziglang_wheel(out_dir, *, version, platform, archive): name='ziglang', version=version, tag=f'py3-none-{platform}', - metadata={ - 'Summary': 'Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.', - 'Description-Content-Type': 'text/markdown', - 'License': 'MIT', - 'Classifier': [ - 'License :: OSI Approved :: MIT License', - ], - 'Project-URL': [ - 'Homepage, https://ziglang.org', - 'Source Code, https://github.com/ziglang/zig-pypi', - 'Bug Tracker, https://github.com/ziglang/zig-pypi/issues', - ], - 'Requires-Python': '~=3.5', - }, + metadata=[ + ('Summary', 'Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.'), + ('Description-Content-Type', "'text/markdown'; charset=UTF-8; variant=GFM"), + ('License-Expression', 'MIT'), + ('License-File', 'LICENSE'), + ('License-File', 'ziglang/lib/libc/glibc/LICENSES'), + ('License-File', 'ziglang/lib/libc/mingw/COPYING'), + ('License-File', 'ziglang/lib/libc/musl/COPYRIGHT'), + ('License-File', 'ziglang/lib/libc/wasi/LICENSE'), + ('License-File', 'ziglang/lib/libc/wasi/LICENSE-APACHE'), + ('License-File', 'ziglang/lib/libc/wasi/LICENSE-APACHE-LLVM'), + ('License-File', 'ziglang/lib/libc/wasi/LICENSE-MIT'), + ('License-File', 'ziglang/lib/libcxx/LICENSE.TXT'), + ('License-File', 'ziglang/lib/libcxxabi/LICENSE.TXT'), + ('License-File', 'ziglang/lib/libunwind/LICENSE.TXT'), + ('Classifier', 'Development Status :: 4 - Beta'), + ('Classifier', 'Intended Audience :: Developers'), + ('Classifier', 'Topic :: Software Development :: Compilers'), + ('Classifier', 'Topic :: Software Development :: Code Generators'), + ('Classifier', 'Topic :: Software Development :: Build Tools'), + ('Classifier', 'Programming Language :: Other'), + ('Classifier', 'Programming Language :: Other Scripting Engines'), + ('Project-URL', 'Homepage, https://ziglang.org'), + ('Project-URL', 'Source Code, https://github.com/ziglang/zig-pypi'), + ('Project-URL', 'Bug Tracker, https://github.com/ziglang/zig-pypi/issues'), + ('Requires-Python', '~=3.5'), + ], description=description, contents=contents, )