Update code to use a std. read_requirements_file()
Change-Id: I48c26cc432a0322c5482bc1645537f59c1f6717d
This commit is contained in:
parent
5d31764c15
commit
b12966c487
@ -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.
|
||||||
|
|
||||||
|
@ -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():
|
||||||
|
@ -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):
|
||||||
|
@ -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():
|
||||||
|
7
openstack_requirements/utils.py
Normal file
7
openstack_requirements/utils.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user