Skip to content

Commit

Permalink
Merge pull request #542 from quantus/hotfix/do-not-annotate-capitaliz…
Browse files Browse the repository at this point in the history
…ed-primary-packages

Remove unwanted annotations from primary packages
  • Loading branch information
vphilippon authored Aug 21, 2017
2 parents cfd6b27 + 1e7076c commit fe8c30e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
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

0 comments on commit fe8c30e

Please sign in to comment.