From f30c231e2794bd8cb067eebfde74b069befad4a2 Mon Sep 17 00:00:00 2001 From: Eli Kogan-Wang Date: Wed, 14 Aug 2024 13:51:12 +0200 Subject: [PATCH 1/4] Freeze all packages regardless of version --- src/appenv.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/appenv.py b/src/appenv.py index 58974ef..bce7837 100755 --- a/src/appenv.py +++ b/src/appenv.py @@ -516,12 +516,6 @@ def reset(self, args=None, remaining=None): def update_lockfile(self, args=None, remaining=None): ensure_minimal_python() - preferences = parse_preferences() - python312_mixed_setuptools_workaround = False - if preferences is not None: - if any(f'3.{x}' in preferences for x in range(4, 12)): - if any(f'3.{x}' in preferences for x in range(12, 20)): - python312_mixed_setuptools_workaround = True os.chdir(self.base) print("Updating lockfile") tmpdir = os.path.join(self.appenv_dir, "updatelock") @@ -532,11 +526,9 @@ def update_lockfile(self, args=None, remaining=None): pip(tmpdir, ["install", "-r", "requirements.txt"]) extra_specs = [] - pip_freeze_args = ["freeze"] - if python312_mixed_setuptools_workaround: - pip_freeze_args.extend(["--all", "--exclude", "pip"]) result = pip( - tmpdir, pip_freeze_args, merge_stderr=False).decode('ascii') + tmpdir, ["freeze", "--all", "--exclude", "pip"], + merge_stderr=False).decode('ascii') # They changed this behaviour in https://github.com/pypa/pip/pull/12032 pinned_versions = {} for line in result.splitlines(): From 63bb112e45d55a663c196d8d8551f4b8e0bb1847 Mon Sep 17 00:00:00 2001 From: Eli Kogan-Wang Date: Wed, 14 Aug 2024 14:44:16 +0200 Subject: [PATCH 2/4] test: update lockfile to include setuptools requirement --- tests/test_update_lockfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_update_lockfile.py b/tests/test_update_lockfile.py index 9ea38a8..93b9999 100644 --- a/tests/test_update_lockfile.py +++ b/tests/test_update_lockfile.py @@ -24,6 +24,7 @@ def test_init_and_create_lockfile(workdir, monkeypatch): assert (lockfile_content == """\ # appenv-requirements-hash: ffa75c00de4879b41008d0e9f6b9953cf7d65bb5f5b85d1d049e783b2486614d ducker==2.0.1 +setuptools==40.6.2 """) # noqa From 6909826d2764657d5e5f4386375237c688c8db8f Mon Sep 17 00:00:00 2001 From: Eli Kogan-Wang Date: Tue, 20 Aug 2024 09:58:37 +0200 Subject: [PATCH 3/4] test: do not assert specific setuptools version --- tests/test_update_lockfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_update_lockfile.py b/tests/test_update_lockfile.py index 93b9999..fc06125 100644 --- a/tests/test_update_lockfile.py +++ b/tests/test_update_lockfile.py @@ -21,11 +21,10 @@ def test_init_and_create_lockfile(workdir, monkeypatch): assert os.path.exists(lockfile) with open(lockfile) as f: lockfile_content = f.read() - assert (lockfile_content == """\ + assert """\ # appenv-requirements-hash: ffa75c00de4879b41008d0e9f6b9953cf7d65bb5f5b85d1d049e783b2486614d ducker==2.0.1 -setuptools==40.6.2 -""") # noqa +setuptools==""" in lockfile_content # noqa @pytest.mark.skipif( From c27df6453c243d5db775151a49e57749f6e2a582 Mon Sep 17 00:00:00 2001 From: Eli Kogan-Wang Date: Tue, 20 Aug 2024 10:17:00 +0200 Subject: [PATCH 4/4] test_init_and_create_lockfile: only assert ducker part. ducker is a bad dependency for this test since it needs no packages --- tests/test_update_lockfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_update_lockfile.py b/tests/test_update_lockfile.py index fc06125..c618f4f 100644 --- a/tests/test_update_lockfile.py +++ b/tests/test_update_lockfile.py @@ -23,8 +23,7 @@ def test_init_and_create_lockfile(workdir, monkeypatch): lockfile_content = f.read() assert """\ # appenv-requirements-hash: ffa75c00de4879b41008d0e9f6b9953cf7d65bb5f5b85d1d049e783b2486614d -ducker==2.0.1 -setuptools==""" in lockfile_content # noqa +ducker==2.0.1""" in lockfile_content # noqa @pytest.mark.skipif(