Skip to content

Commit

Permalink
Revert "use PEP621 metadata to define license file to copy to wheel"
Browse files Browse the repository at this point in the history
This reverts commit cd8b4d0.

embedding the full LICENSE text file as a multi-line RFC5322 text breaks
in unexpected ways on Windows, I get double CRLF line endings which lead
to twine check fail to validate the README section that follows the
LICENSE...

Let's revert to adding the license file using wheeltools for the time
being.
anthrotype committed Mar 7, 2022
1 parent 31784be commit 2a89cde
Showing 3 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
import subprocess
import sys
from pathlib import Path
from wheeltools import InWheel


root_dir = Path(__file__).parent.resolve()
@@ -37,10 +38,18 @@ def main():
except (IndexError, KeyError):
sys.exit("usage: build.py [sdist|wheel]")

return subprocess.call(
cmd + ["-o", str(dist_dir)] + sys.argv[2:], cwd=str(crate_dir)
subprocess.run(
cmd + ["-o", str(dist_dir)] + sys.argv[2:], check=True, cwd=str(crate_dir)
)

# maturin doesn't add the license text to the wheel archive yet so we
# have to do it ourselves: cf. https://github.com/PyO3/maturin/issues/829
for wheel_file in dist_dir.glob("pngquant*.whl"):
with InWheel(in_wheel=str(wheel_file), out_wheel=str(wheel_file)) as tmpdir:
distinfo = next(Path(tmpdir).glob("*.dist-info"))
assert distinfo.is_dir()
shutil.copyfile(crate_dir / "COPYRIGHT", distinfo / "LICENSE")


if __name__ == "__main__":
sys.exit(main())
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ name = "pngquant-cli"
version = "2.17.0.post3"
description = "Precompiled binaries for pngquant, the lossy PNG compressor based on libimagequant."
maintainers = [{name = "Cosimo Lupo", email = "cosimo@anthrotype.com"}]
license = {file = "COPYRIGHT"}

[project.urls]
repository = "https://github.com/anthrotype/pngquant-wheels"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -2,3 +2,4 @@ maturin
tomli
tomli-w
twine
wheeltools

0 comments on commit 2a89cde

Please sign in to comment.