Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lockfile Out Of Date between Windows vs. Linux #58

Closed
juftin opened this issue Jan 8, 2024 · 3 comments · Fixed by #60
Closed

Lockfile Out Of Date between Windows vs. Linux #58

juftin opened this issue Jan 8, 2024 · 3 comments · Fixed by #60
Assignees
Labels
bug Something isn't working released

Comments

@juftin
Copy link
Owner

juftin commented Jan 8, 2024

Changing between Linux and Windows makes hatch-pip-compile try to recreate the lockfile.

For some reason when running in Windows lockfile_up_to_date is False but lockfile_up_to_date is True when run on Linux.

See https://github.com/juftin/hatch-pip-compile/actions/runs/7450650936/job/20270034562 / #57 (comment)

@juftin juftin added the bug Something isn't working label Jan 8, 2024
@juftin juftin self-assigned this Jan 8, 2024
@juftin
Copy link
Owner Author

juftin commented Jan 10, 2024

Aha! The problem is actually with lockfiles with constraints. The SHA256 of the constraint file in Windows doesn't match mac. My best guess is line endings being different here - I'll keep digging.

@juftin
Copy link
Owner Author

juftin commented Jan 10, 2024

Yup, the issue is CLRF line endings.

This

return hashlib.sha256(self.lock_file.read_bytes()).hexdigest()

becomes this

lockfile_contents = self.lock_file.read_bytes()
cross_platform_contents = lockfile_contents.replace(b"\r\n", b"\n")
return hashlib.sha256(cross_platform_contents).hexdigest()

juftin added a commit that referenced this issue Jan 10, 2024
github-actions bot added a commit that referenced this issue Jan 10, 2024
# [v1.9.2](v1.9.1...v1.9.2) (2024-01-10)

## 🐛 Bug Fixes
- [`d008612`](d008612)  cross-platform hashes (Issues: [`#58`](#58))

[skip ci]
@juftin
Copy link
Owner Author

juftin commented Jan 10, 2024

🎉 This issue has been resolved in version 1.9.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant