Skip to content

Commit

Permalink
Merge pull request #53 from maxwell-k/maxwell-k-without-wheel
Browse files Browse the repository at this point in the history
Remove constraint on wheel
  • Loading branch information
maxwell-k authored Aug 6, 2024
2 parents 5d49a13 + 5cf5100 commit eed949c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 41 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
9e37bc61cd401b48ae09883864fd8d0efff84277493724207eff9c1b05f686bf reproducibly-0.0.12-py3-none-any.whl
f786d2be89fc2f9e99403eb29dc34ba90e02d4af8ad0c1cd1f38580c251c077b reproducibly-0.0.12.tar.gz
31 changes: 4 additions & 27 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,16 +71,7 @@
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"
__version__ = "0.0.12"


def _build(
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 eed949c

Please sign in to comment.