mirror of
https://github.com/faucetsdn/ryu.git
synced 2025-08-09 16:17:09 +02:00
utils: Remove "parse_requirements" function
This patch removes unused function "parse_requirements" in order to avoid using "pip" as a Python library. Note: Officially "from pip import req as pip_req" is not supported usage of "pip". Reported-by: Katsaounis Molyvas Stamatios <mokats@intracom-telecom.com> Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
e6773539b5
commit
a27c56a054
31
ryu/utils.py
31
ryu/utils.py
@ -126,34 +126,3 @@ def binary_str(data):
|
|||||||
"""
|
"""
|
||||||
# convert data into bytearray explicitly
|
# convert data into bytearray explicitly
|
||||||
return ''.join('\\x%02x' % byte for byte in bytearray(data))
|
return ''.join('\\x%02x' % byte for byte in bytearray(data))
|
||||||
|
|
||||||
|
|
||||||
def parse_requirements(requirements_files=None):
|
|
||||||
"""
|
|
||||||
Parses requirements files and returns a list of requirements.
|
|
||||||
|
|
||||||
Returned list would be like::
|
|
||||||
|
|
||||||
['foo', 'bar>=X.X', ...]
|
|
||||||
|
|
||||||
:param requirements_files: List of requirements files. The default
|
|
||||||
is ['requirements.txt', 'tools/pip-requires'].
|
|
||||||
:return: List of requirements.
|
|
||||||
"""
|
|
||||||
from pip import req as pip_req
|
|
||||||
from pip.download import PipSession
|
|
||||||
|
|
||||||
requirements_files = requirements_files or [
|
|
||||||
'requirements.txt',
|
|
||||||
'tools/pip-requires',
|
|
||||||
]
|
|
||||||
|
|
||||||
requirements = []
|
|
||||||
for f in requirements_files:
|
|
||||||
if not os.path.isfile(f):
|
|
||||||
continue
|
|
||||||
|
|
||||||
for r in pip_req.parse_requirements(f, session=PipSession()):
|
|
||||||
requirements.append(str(r.req))
|
|
||||||
|
|
||||||
return requirements
|
|
||||||
|
Loading…
Reference in New Issue
Block a user