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

Remove unwanted annotations from primary packages #542

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Bug Fixes:
when `--allow-unsafe` was not set. ([#517](https://github.com/jazzband/pip-tools/pull/517)). Thanks @dschaller
- Fixed bug where editable PyPI dependencies would have a `download_dir` and be exposed to `git-checkout-index`,
(thus losing their VCS directory) and `python setup.py egg_info` fails. ([#385](https://github.com/jazzband/pip-tools/pull/385#) and [#538](https://github.com/jazzband/pip-tools/pull/538)). Thanks @blueyed and @dfee
- Fixed bug where some primary dependencies were annotated with "via" info comments. ([#542](https://github.com/jazzband/pip-tools/pull/542)). Thanks @quantus

# 1.9.0 (2017-04-12)

Expand Down
2 changes: 1 addition & 1 deletion piptools/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _format_requirement(self, ireq, reverse_dependencies, primary_packages, mark
for hash_ in sorted(ireq_hashes):
line += " \\\n --hash={}".format(hash_)

if not self.annotate or ireq.name in primary_packages:
if not self.annotate or key_from_req(ireq.req) in primary_packages:
return line

# Annotate what packages this package is required by
Expand Down
11 changes: 11 additions & 0 deletions tests/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ def test_format_requirement_not_for_primary(from_line, writer):
'test==1.2')


def test_format_requirement_not_for_primary_lower_case(from_line, writer):
"Primary packages should not get annotated."
ireq = from_line('Test==1.2')
reverse_dependencies = {'test': ['xyz']}

assert (writer._format_requirement(ireq,
reverse_dependencies,
primary_packages=['test']) ==
'test==1.2')


def test_format_requirement_environment_marker(from_line, writer):
"Environment markers should get passed through to output."
ireq = from_line('test ; python_version == "2.7" and platform_python_implementation == "CPython"')
Expand Down