Merge pull request #773 from balloob/travis-tweaks

Travis tweaks
This commit is contained in:
Paulus Schoutsen
2015-12-18 00:46:32 -08:00
6 changed files with 37 additions and 11 deletions

View File

@@ -5,6 +5,8 @@ python:
- 3.4
- 3.5
install:
# Validate requirements_all.txt on Python 3.5
- if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then python3 setup.py develop; script/gen_requirements_all.py validate; fi
- 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 -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 flake8 pylint coveralls pytest pytest-cov
REQ_DEV_STATUS=$?

View File

@@ -5,6 +5,12 @@
cd "$(dirname "$0")/.."
if [ "$TRAVIS_PYTHON_VERSION" != "3.4" ]; then
NO_LINT=1
fi
export NO_LINT
script/test coverage
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)

View File

@@ -5,9 +5,12 @@
cd "$(dirname "$0")/.."
script/lint
LINT_STATUS=$?
if [ "$NO_LINT" = "1" ]; then
LINT_STATUS=0
else
script/lint
LINT_STATUS=$?
fi
echo "Running tests..."