-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: fix under pyproject-hooks 1.2
By replacing setuptools with a bare-bones wheel builder.
- Loading branch information
Showing
4 changed files
with
30 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,25 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
from setuptools.build_meta import build_sdist as build_sdist | ||
from setuptools.build_meta import build_wheel as build_wheel | ||
|
||
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): | ||
import os.path | ||
import zipfile | ||
|
||
from build._compat import tomllib | ||
|
||
with open('pyproject.toml', 'rb') as f: | ||
metadata = tomllib.load(f) | ||
|
||
wheel_basename = f"{metadata['project']['name'].replace('-', '_')}-{metadata['project']['version']}" | ||
with zipfile.ZipFile(os.path.join(wheel_directory, f'{wheel_basename}-py3-none-any.whl'), 'w') as wheel: | ||
wheel.writestr( | ||
f'{wheel_basename}.dist-info/METADATA', | ||
f"""\ | ||
Metadata-Version: 2.2 | ||
Name: {metadata['project']['name']} | ||
Version: {metadata['project']['version']} | ||
Summary: {metadata['project']['description']} | ||
""", | ||
) | ||
|
||
return wheel.filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
[build-system] | ||
build-backend = 'backend_no_prepare' | ||
backend-path = ['.'] | ||
requires = ['setuptools >= 42.0.0'] | ||
requires = [] | ||
|
||
[project] | ||
name = "test-no-prepare" | ||
version = "1.0.0" | ||
description = "Test extracting metadata from a backend w/out `prepare_metadata_for_build_wheel` hook" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters