Update code to use a std. read_requirements_file()

Change-Id: I48c26cc432a0322c5482bc1645537f59c1f6717d
This commit is contained in:
Tony Breeds 2022-08-02 15:54:32 +10:00
parent 5d31764c15
commit b12966c487
5 changed files with 12 additions and 26 deletions

View File

@ -18,18 +18,13 @@
import argparse import argparse
import collections import collections
from openstack_requirements import requirement from openstack_requirements.utils import read_requirements_file
import packaging.specifiers import packaging.specifiers
import packaging.version import packaging.version
def read_requirements_file(filename):
with open(filename, 'rt') as f:
body = f.read()
return requirement.parse(body)
def get_requirements_version(req): def get_requirements_version(req):
"""Find the version for a requirement. """Find the version for a requirement.

View File

@ -20,13 +20,7 @@ import traceback
import pkg_resources import pkg_resources
from openstack_requirements import requirement from openstack_requirements.utils import read_requirements_file
def read_requirements_file(filename):
with open(filename, 'rt') as f:
body = f.read()
return requirement.parse(body)
def main(): def main():

View File

@ -22,12 +22,7 @@ from packaging.version import Version
from openstack_requirements import project from openstack_requirements import project
from openstack_requirements import requirement from openstack_requirements import requirement
from openstack_requirements.utils import read_requirements_file
def read_requirements_file(filename):
with open(filename, 'rt') as f:
body = f.read()
return requirement.parse(body)
def main(args=None): def main(args=None):

View File

@ -19,12 +19,7 @@ import os
from openstack_requirements import constraints from openstack_requirements import constraints
from openstack_requirements import requirement from openstack_requirements import requirement
from openstack_requirements.utils import read_requirements_file
def read_requirements_file(filename):
with open(filename, 'rt') as f:
body = f.read()
return requirement.parse(body)
def main(): def main():

View File

@ -0,0 +1,7 @@
from openstack_requirements import requirement
def read_requirements_file(filename):
with open(filename, 'rt') as f:
body = f.read()
return requirement.parse(body)