Fix gen_requirements_all.py and add updated requirements_all.txt

This commit is contained in:
Paulus Schoutsen 2015-11-29 13:55:46 -08:00
parent ee805ec145
commit 5023772b3e
2 changed files with 6 additions and 26 deletions

View File

@ -170,4 +170,3 @@ https://github.com/persandstrom/python-verisure/archive/9873c4527f01b1ba1f72ae60
# homeassistant.components.zwave
pydispatcher==2.0.5

View File

@ -8,7 +8,6 @@ import importlib
import os
import pkgutil
import re
import argparse
COMMENT_REQUIREMENTS = [
'RPi.GPIO',
@ -60,10 +59,6 @@ def gather_modules():
except ImportError:
errors.append(package)
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):
continue
@ -74,7 +69,7 @@ def gather_modules():
if errors:
print("Found errors")
print('\n'.join(errors))
return
return None
output.append('# Home Assistant core')
output.append('\n')
@ -99,32 +94,18 @@ def write_file(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():
""" Main """
if not os.path.isfile('requirements_all.txt'):
print('Run this from HA root dir')
return
args = argparsing()
data = gather_modules()
if args.file:
write_file(data)
else:
display(data)
if data is None:
return
write_file(data)
if __name__ == '__main__':
main()