Remove dead code

We not not appear to have ever emitted this header (or rather, set
prefix to True).

Change-Id: I6e289c91b8efad227778c1a5c4b519458c1aa600
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2025-09-15 11:27:13 +01:00
parent 562d323af4
commit 6ed25d28a2
3 changed files with 4 additions and 19 deletions
@@ -68,7 +68,7 @@ def main(argv=None, stdout=None):
content = open(args[0], 'rt').read()
reqs = requirement.parse(content, permit_urls=True)
out_reqs = edit(reqs, args[1], args[2])
out = requirement.to_content(out_reqs, prefix=False)
out = requirement.to_content(out_reqs)
with open(args[0] + '.tmp', 'wt') as f:
f.write(out)
if os.path.exists(args[0]):
+1 -14
View File
@@ -21,17 +21,6 @@ import pkg_resources
import re
# A header for the requirements file(s).
# TODO(lifeless): Remove this once constraints are in use.
_REQS_HEADER = [
'# The order of packages is significant, because pip processes '
'them in the order\n',
'# of appearance. Changing the order has an impact on the overall '
'integration\n',
'# process, which may cause wedges in the gate later.\n',
]
def key_specifier(a):
weight = {'>=': 0, '>': 0,
'===': 1, '==': 1, '~=': 1, '!=': 1,
@@ -160,10 +149,8 @@ def parse_line(req_line, permit_urls=False):
return Requirement(name, location, specifier, markers, comment, extras)
def to_content(reqs, marker_sep=';', line_prefix='', prefix=True):
def to_content(reqs, marker_sep=';', line_prefix=''):
lines = []
if prefix:
lines += _REQS_HEADER
for req in reqs.reqs:
lines.append(req.to_line(marker_sep, line_prefix))
return u''.join(lines)
@@ -116,8 +116,7 @@ class TestToContent(testtools.TestCase):
'foo', '', '<=1', "python_version=='2.7'", '# BSD')]),
marker_sep='!')
self.assertEqual(
''.join(requirement._REQS_HEADER
+ ["foo<=1!python_version=='2.7' # BSD\n"]),
"foo<=1!python_version=='2.7' # BSD\n",
reqs)
def test_location(self):
@@ -125,8 +124,7 @@ class TestToContent(testtools.TestCase):
[requirement.Requirement(
'foo', 'file://foo', '', "python_version=='2.7'", '# BSD')]))
self.assertEqual(
''.join(requirement._REQS_HEADER
+ ["file://foo#egg=foo;python_version=='2.7' # BSD\n"]),
"file://foo#egg=foo;python_version=='2.7' # BSD\n",
reqs)