Skip to content

Commit

Permalink
change checksum a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed May 23, 2024
1 parent 545deb2 commit 12423bf
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 10 deletions.
1 change: 0 additions & 1 deletion conda_pypi/cli/list.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys

from conda.base.context import context

from .. import __version__
Expand Down
10 changes: 7 additions & 3 deletions conda_pypi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,14 @@ def compute_record_sum(record_path, algo):
for line in record.splitlines():
path, *_ = line.split(",")
path = Path(path)
if path.parts[0].endswith(".dist-info") and path.name in ("REQUESTED", "direct_url.json"):
continue
if path.parts[0] == ".." and "bin" in path.parts:
if path.parts[0].endswith(".dist-info") and path.name not in ("METADATA", "WHEEL"):
# we only want to check the metadata and wheel parts of dist-info; everything else
# is not deterministic or useful
continue
if path.parts[0] == ".." and ("bin" in path.parts or "lib" in path.parts):
# entry points are autogenerated and can have different hashes/size depending on prefix
path, *_ = line.split(",")
line = f"{path},,"
lines.append(line)
with NamedTemporaryFile("w", delete=False) as tmp:
tmp.write("\n".join(lines))
Expand Down
32 changes: 32 additions & 0 deletions explicit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-arm64
@EXPLICIT
https://conda.anaconda.org/conda-forge/osx-arm64/bzip2-1.0.8-h93a5062_5.conda#1bbc659ca658bfd49a481b5ef7a0f40f
https://conda.anaconda.org/conda-forge/osx-arm64/ca-certificates-2024.2.2-hf0a4a13_0.conda#fb416a1795f18dcc5a038bc2dc54edf9
https://conda.anaconda.org/conda-forge/osx-arm64/libexpat-2.6.2-hebf3989_0.conda#e3cde7cfa87f82f7cb13d482d5e0ad09
https://conda.anaconda.org/conda-forge/osx-arm64/libffi-3.4.2-h3422bc3_5.tar.bz2#086914b672be056eb70fd4285b6783b6
https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.2.13-h53f4e23_5.conda#1a47f5236db2e06a320ffa0392f81bd8
https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.5-hb89a1cb_0.conda#b13ad5724ac9ae98b6b4fd87e4500ba4
https://conda.anaconda.org/conda-forge/noarch/tzdata-2024a-h0c530f3_0.conda#161081fc7cec0bfda0d86d7cb595f8d8
https://conda.anaconda.org/t/ja-715eb732-d419-4a8f-bdfa-16001df99d89/conda-forge/osx-arm64/xz-5.2.6-h57fd34a_0.tar.bz2#39c6b54e94014701dd157f4f576ed211
https://conda.anaconda.org/conda-forge/osx-arm64/libsqlite-3.45.3-h091b4b1_0.conda#c8c1186c7f3351f6ffddb97b1f54fc58
https://conda.anaconda.org/conda-forge/osx-arm64/openssl-3.3.0-hfb2fe0b_2.conda#c9602073e34599f40b8c4ce9e19cabf6
https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.2-h92ec313_1.conda#8cbb776a2f641b943d413b3e19df71f4
https://conda.anaconda.org/conda-forge/osx-arm64/tk-8.6.13-h5083fa2_1.conda#b50a57ba89c32b62428b71a875291c9b
https://conda.anaconda.org/conda-forge/osx-arm64/python-3.12.3-h4a7b5fc_0_cpython.conda#8643ab37bece6ae8f112464068d9df9c
https://conda.anaconda.org/conda-forge/noarch/setuptools-69.5.1-pyhd8ed1ab_0.conda#7462280d81f639363e6e63c81276bd9e
https://conda.anaconda.org/conda-forge/noarch/wheel-0.43.0-pyhd8ed1ab_1.conda#0b5293a157c2b5cd513dd1b03d8d3aae
https://conda.anaconda.org/conda-forge/noarch/pip-24.0-pyhd8ed1ab_0.conda#f586ac1e56c8638b64f9c8122a7b8a67
# The following lines were added by conda-pypi v0.0.0
# This is an experimental feature subject to change. Do not use in production.
# pypi: requests==2.32.1 --python-version 3.12.3 --implementation cp -- --checksum=md5:a0c5688914cc4dc4b022c72b9e2f5f1a
# pypi: threadpoolctl==3.5.0 --python-version 3.12.3 --implementation cp -- --checksum=md5:9eb100bdee69026a8b75ef4b155e68d7
# pypi: joblib==1.4.2 --python-version 3.12.3 --implementation cp -- --checksum=md5:1faad9c640548803fc682838a3bbb9bf
# pypi: idna==3.7 --python-version 3.12.3 --implementation cp -- --checksum=md5:de14024542b5f57b01f768caa46213d2
# pypi: certifi==2024.2.2 --python-version 3.12.3 --implementation cp -- --checksum=md5:9bee459a15bbdf34a7d63cae315f6d30
# pypi: urllib3==2.2.1 --python-version 3.12.3 --implementation cp -- --checksum=md5:b6aa32d2ec157b4b2bd105d0c10d3a1b
# pypi: scikit-learn==1.5.0 --python-version 3.12.3 --implementation cp --abi cp312 --platform macosx_12_0_arm64 -- --checksum=md5:577a58d03459b7b807252ffc8be72f34
# pypi: charset-normalizer==3.3.2 --python-version 3.12.3 --implementation cp --abi cp312 --platform macosx_11_0_arm64 -- --checksum=md5:357959c86a144b21f99a8faf9cd5d2d2
# pypi: numpy==1.26.4 --python-version 3.12.3 --implementation cp --abi cp312 --platform macosx_11_0_arm64 -- --checksum=md5:c44c1fa142b585391b6588a0fdbe4a5c
# pypi: scipy==1.13.1 --python-version 3.12.3 --implementation cp --abi cp312 --platform macosx_12_0_arm64 -- --checksum=md5:8261c87a95d8b05d1018c90317206357
22 changes: 16 additions & 6 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ def test_pyqt(


@pytest.mark.parametrize(
"specs, pure_pip",
"specs, pure_pip, with_md5",
[
(("requests",), True),
(("requests",), False),
(("requests",), True, True),
(("requests",), False, False),
],
)
def test_lockfile_roundtrip(
Expand All @@ -142,6 +142,7 @@ def test_lockfile_roundtrip(
conda_cli: CondaCLIFixture,
specs: Iterable[str],
pure_pip: bool,
with_md5: bool,
):
with tmp_env("python=3.9", "pip") as prefix:
if pure_pip:
Expand All @@ -154,7 +155,8 @@ def test_lockfile_roundtrip(
print(out)
print(err, file=sys.stderr)
assert rc == 0
out, err, rc = conda_cli("list", "--explicit", "--md5")
md5 = ("--md5",) if with_md5 else ()
out, err, rc = conda_cli("list", "--explicit", *md5)
print(out)
print(err, file=sys.stderr)
assert rc == 0
Expand All @@ -168,9 +170,17 @@ def test_lockfile_roundtrip(
tmp_path / "env",
"--file",
tmp_path / "lockfile.txt",
]
],
capture_output=True,
text=True,
check=False,
)
out2, err2, rc2 = conda_cli("list", "--explicit", "--md5", "--prefix", tmp_path / "env")
print(p.stdout)
print(p.stderr, file=sys.stderr)
assert p.returncode == 0
assert "Verifying PyPI transaction" in p.stdout

out2, err2, rc2 = conda_cli("list", "--explicit", md5, "--prefix", tmp_path / "env")
print(out2)
print(err2, file=sys.stderr)
assert rc2 == 0
Expand Down

0 comments on commit 12423bf

Please sign in to comment.