Skip to content

Commit a125892

Browse files
authored
Don't write transitives comment if there are no transitives (#144)
1 parent d08ed32 commit a125892

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crawl/pom.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,9 @@ def _gen_dependencies(self, pomcontenttype):
563563
# account for any version overrides that need to carry over to the
564564
# Maven build.
565565
transitives = self._get_transitive_deps(self.dependencies)
566-
content += self._xml_comment("The transitives of the dependencies above", indent)
567-
content += self._gen_dependencies_xml(pomcontenttype, transitives, indent)
566+
if len(transitives) > 0:
567+
content += self._xml_comment("The transitives of the dependencies above", indent)
568+
content += self._gen_dependencies_xml(pomcontenttype, transitives, indent)
568569

569570
content, indent = self._xml(content, "dependencies", indent, close_element=True)
570571
return content
@@ -586,7 +587,8 @@ def _gen_dependencies_xml(self, pomcontenttype, dependencies, indent):
586587

587588
def _get_transitive_deps(self, dependencies):
588589
"""
589-
Returns all transitive deps of the deps this pom references directly.
590+
Given an iterable of dependency instances, returns all transitive
591+
dependencies.
590592
"""
591593
transitives = []
592594
transitives_set = set()

0 commit comments

Comments
 (0)