Skip to content

Commit

Permalink
Merge pull request #55 from flyingcircusio/pip-freeze-all-package-reg…
Browse files Browse the repository at this point in the history
…ardless-of-version

Freeze all packages regardless of version
  • Loading branch information
zagy authored Aug 20, 2024
2 parents 2aee66b + c27df64 commit 4692dff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
12 changes: 2 additions & 10 deletions src/appenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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():
Expand Down
5 changes: 2 additions & 3 deletions tests/test_update_lockfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ 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
""") # noqa
ducker==2.0.1""" in lockfile_content # noqa


@pytest.mark.skipif(
Expand Down

0 comments on commit 4692dff

Please sign in to comment.