Verify requirements_all in Travis

pull/773/head
Paulus Schoutsen 2015-12-17 23:51:34 -08:00
parent a0ff8819a9
commit b5fc7f5e71
4 changed files with 25 additions and 8 deletions

View File

@ -5,6 +5,8 @@ python:
- 3.4
- 3.5
install:
- python3 setup.py -q develop
- script/gen_requirements_all.py validate
- script/bootstrap_server
script:
- script/cibuild

View File

@ -1,4 +1,5 @@
echo "Bootstrapping frontend..."
git submodule update
cd homeassistant/components/frontend/www_static/home-assistant-polymer
npm install
bower install

View File

@ -1,15 +1,12 @@
cd "$(dirname "$0")/.."
echo "Update the submodule to latest version..."
git submodule update
echo "Installing dependencies..."
python3 -m pip install --upgrade -r requirements_all.txt
python3 -m pip install -q -r requirements_all.txt
REQ_STATUS=$?
echo "Installing development dependencies.."
python3 -m pip install --upgrade flake8 pylint coveralls pytest pytest-cov
python3 -m pip install -q flake8 pylint coveralls pytest pytest-cov
REQ_DEV_STATUS=$?

View File

@ -8,6 +8,7 @@ import importlib
import os
import pkgutil
import re
import sys
COMMENT_REQUIREMENTS = [
'RPi.GPIO',
@ -68,8 +69,9 @@ def gather_modules():
reqs.setdefault(req, []).append(package)
if errors:
print("Found errors")
print('\n'.join(errors))
print("******* ERROR")
print("Errors while importing: ", ', '.join(errors))
print("Make sure you import 3rd party libraries inside methods.")
return None
output.append('# Home Assistant core')
@ -95,6 +97,12 @@ def write_file(data):
req_file.write(data)
def validate_file(data):
""" Validates if requirements_all.txt is up to date. """
with open('requirements_all.txt', 'r') as req_file:
return data == ''.join(req_file)
def main():
""" Main """
if not os.path.isfile('requirements_all.txt'):
@ -104,7 +112,16 @@ def main():
data = gather_modules()
if data is None:
return
sys.exit(1)
if sys.argv[-1] == 'validate':
if validate_file(data):
print("requirements_all.txt is up to date.")
sys.exit(0)
print("******* ERROR")
print("requirements_all.txt is not up to date")
print("Please run script/gen_requirements_all.py")
sys.exit(1)
write_file(data)