mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Fix gen_requirements_all.py and add updated requirements_all.txt
This commit is contained in:
parent
ee805ec145
commit
5023772b3e
@ -170,4 +170,3 @@ https://github.com/persandstrom/python-verisure/archive/9873c4527f01b1ba1f72ae60
|
|||||||
|
|
||||||
# homeassistant.components.zwave
|
# homeassistant.components.zwave
|
||||||
pydispatcher==2.0.5
|
pydispatcher==2.0.5
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import importlib
|
|||||||
import os
|
import os
|
||||||
import pkgutil
|
import pkgutil
|
||||||
import re
|
import re
|
||||||
import argparse
|
|
||||||
|
|
||||||
COMMENT_REQUIREMENTS = [
|
COMMENT_REQUIREMENTS = [
|
||||||
'RPi.GPIO',
|
'RPi.GPIO',
|
||||||
@ -60,10 +59,6 @@ def gather_modules():
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
errors.append(package)
|
errors.append(package)
|
||||||
continue
|
continue
|
||||||
# For catching the error by RPi.GPIO
|
|
||||||
# RuntimeError: This module can only be run on a Raspberry Pi!
|
|
||||||
except RuntimeError:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not getattr(module, 'REQUIREMENTS', None):
|
if not getattr(module, 'REQUIREMENTS', None):
|
||||||
continue
|
continue
|
||||||
@ -74,7 +69,7 @@ def gather_modules():
|
|||||||
if errors:
|
if errors:
|
||||||
print("Found errors")
|
print("Found errors")
|
||||||
print('\n'.join(errors))
|
print('\n'.join(errors))
|
||||||
return
|
return None
|
||||||
|
|
||||||
output.append('# Home Assistant core')
|
output.append('# Home Assistant core')
|
||||||
output.append('\n')
|
output.append('\n')
|
||||||
@ -99,32 +94,18 @@ def write_file(data):
|
|||||||
req_file.write(data)
|
req_file.write(data)
|
||||||
|
|
||||||
|
|
||||||
def display(data):
|
|
||||||
""" Prints the output to command line. """
|
|
||||||
print(data)
|
|
||||||
|
|
||||||
|
|
||||||
def argparsing():
|
|
||||||
""" Parsing the command line arguments. """
|
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
description='Generate a requirements_all.txt')
|
|
||||||
parser.add_argument('file', nargs='?',
|
|
||||||
help='create new requirements_all.txt file')
|
|
||||||
return parser.parse_args()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
""" Main """
|
""" Main """
|
||||||
if not os.path.isfile('requirements_all.txt'):
|
if not os.path.isfile('requirements_all.txt'):
|
||||||
print('Run this from HA root dir')
|
print('Run this from HA root dir')
|
||||||
return
|
return
|
||||||
args = argparsing()
|
|
||||||
data = gather_modules()
|
data = gather_modules()
|
||||||
|
|
||||||
if args.file:
|
if data is None:
|
||||||
write_file(data)
|
return
|
||||||
else:
|
|
||||||
display(data)
|
write_file(data)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user