diff --git a/hatch_pip_compile/lock.py b/hatch_pip_compile/lock.py index aa512e4..9f6ba7f 100644 --- a/hatch_pip_compile/lock.py +++ b/hatch_pip_compile/lock.py @@ -54,12 +54,12 @@ def process_lock(self, lockfile: pathlib.Path) -> None: ) if self.constraints_file is not None: constraint_sha = hashlib.sha256(self.constraints_file.read_bytes()).hexdigest() - constraints_path = self.constraints_file.relative_to(self.project_root) + constraints_path = self.constraints_file.relative_to(self.project_root).as_posix() constraints_line = f"# [constraints] {constraints_path} (SHA256: {constraint_sha})" joined_dependencies = "\n".join([constraints_line, "#", joined_dependencies]) cleaned_input_file = re.sub( r"-c \S*", - f"-c {constraints_path}", + lambda _: f"-c {constraints_path}", cleaned_input_file, ) prefix += "\n" + joined_dependencies + "\n#"