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

Consider specifiers for equality operator to pin a dependency in make_install_requirement #1323

Merged
merged 11 commits into from
Feb 25, 2021
Prev Previous commit
Next Next commit
Prefer forcing version to string rather than building a Version objec…
…t from

a specifier version as it made tests fail
  • Loading branch information
IceTDrinker committed Feb 24, 2021
commit 6a3b232ee34bd251456261ed6f8e1af3b29a1fc0
5 changes: 2 additions & 3 deletions piptools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def comment(text: str) -> str:


def make_install_requirement(
name: str, version: Version, ireq: InstallRequirement
name: str, version: Union[str, Version], ireq: InstallRequirement
) -> InstallRequirement:
# If no extras are specified, the extras string is blank
extras_string = ""
Expand All @@ -78,8 +78,7 @@ def make_install_requirement(

version_specifier = "=="
for specifier in ireq.specifier:
specifier_version = Version(specifier.version)
if specifier.operator == "===" and specifier_version == version:
if specifier.operator == "===" and specifier.version == str(version):
version_specifier = "==="
break

Expand Down