Skip to content

Commit

Permalink
Remove wheel constraint
Browse files Browse the repository at this point in the history
The bdist_wheel command is now part of setuptools
pypa/setuptools#4369
  • Loading branch information
maxwell-k committed Aug 6, 2024
1 parent 5d49a13 commit 6cba20d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 40 deletions.
1 change: 0 additions & 1 deletion constraints.txt

This file was deleted.

4 changes: 2 additions & 2 deletions dist/SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
f12e5d9d8bfd39e33e4774e1ecfea5a084c7683dd3088d192902ebabca7d4141 reproducibly-0.0.11-py3-none-any.whl
e5b873bab5cf10bc9e1a3cb925b9053c4136f9309190d636ee6d6b2aef4e1c95 reproducibly-0.0.11.tar.gz
c69f6940be8ccec22f5ad22ffac310818d2f155b432cfec79366a175ed0d86e0 reproducibly-0.0.11-py3-none-any.whl
175fee2ef6f1ea565bd8756773766765fd5ddf911ac27442bcc700d38e51de30 reproducibly-0.0.11.tar.gz
29 changes: 3 additions & 26 deletions reproducibly.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from build.env import DefaultIsolatedEnv
from cibuildwheel.__main__ import build_in_directory
from cibuildwheel.options import CommandLineArguments
from packaging.requirements import Requirement
from pyproject_hooks import default_subprocess_runner

# [[[cog import cog ; from pathlib import Path ]]]
Expand Down Expand Up @@ -72,15 +71,6 @@
EARLIEST = datetime(1980, 1, 1, 0, 0, 0).timestamp() # 315532800.0


CONSTRAINTS = {
# [[[cog
# for line in Path("constraints.txt").read_text().splitlines():
# cog.outl(f'"{line}",')
# ]]]
"wheel==0.44.0",
# [[[end]]]
}

__version__ = "0.0.11"


Expand All @@ -96,8 +86,8 @@ def _build(
srcdir,
runner=default_subprocess_runner,
)
env.install(override(builder.build_system_requires))
env.install(override(builder.get_requires_for_build(distribution)))
env.install(builder.build_system_requires)
env.install(builder.get_requires_for_build(distribution))
built = builder.build(distribution, output)
return output / built

Expand All @@ -112,14 +102,12 @@ def _cibuildwheel(sdist: Path, output: Path) -> Path:
"""Call the cibuildwheel API
Returns the path to the built distribution"""
filename = Path("constraints.txt")
with (
ModifiedEnvironment(
CIBW_DEPENDENCY_VERSIONS=str(filename),
CIBW_BUILD_FRONTEND="build",
CIBW_CONTAINER_ENGINE="podman",
CIBW_ENVIRONMENT_PASS_LINUX="SOURCE_DATE_EPOCH",
CIBW_ENVIRONMENT=f"PIP_TIMEOUT=150 PIP_CONSTRAINT=/{filename}",
CIBW_ENVIRONMENT="PIP_TIMEOUT=150",
),
TemporaryDirectory() as directory,
):
Expand All @@ -129,7 +117,6 @@ def _cibuildwheel(sdist: Path, output: Path) -> Path:
args.output_dir = Path(directory).resolve()
args.platform = None
with chdir(directory): # output maybe a relative path
filename.write_text("\n".join(CONSTRAINTS) + "\n")
build_in_directory(args)
wheel = next(args.output_dir.glob("*.whl"))
output.joinpath(wheel.name).unlink(missing_ok=True)
Expand Down Expand Up @@ -257,16 +244,6 @@ def key(input_: bytes | ZipInfo) -> tuple[int, list[str | list]]:
return (group, breadth_first_key(item))


def override(before: set[str], constraints: set[str] = CONSTRAINTS) -> set[str]:
"""Replace certain requirements from constraints"""
after = set()
for replacement in constraints:
name = Requirement(replacement).name
for i in before:
after.add(replacement if Requirement(i).name == name else i)
return after


def zipumask(path: Path, umask: int = 0o022) -> Path:
"""Apply a umask to a zip file at path
Expand Down
11 changes: 0 additions & 11 deletions reproducibly_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
latest_modification_time,
main,
ModifiedEnvironment,
override,
parse_args,
zipumask,
)
Expand Down Expand Up @@ -150,16 +149,6 @@ def test_basic(self):
self.assertEqual(result, str(int(latest)))


class TestOverride(unittest.TestCase):
def test_overridden_with_specific_version(self):
result = override({"example"}, {"example==1.2.3"})
self.assertEqual(result, {"example==1.2.3"})

def test_unchanged(self):
result = override({"example"}, {"other==1.2.3"})
self.assertEqual(result, {"example"})


class TestZipumask(unittest.TestCase):
def test_basic(self):
with TemporaryDirectory() as tmpdir:
Expand Down

0 comments on commit 6cba20d

Please sign in to comment.