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.4
- 3.5 - 3.5
install: 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/bootstrap_server
script: script:
- script/cibuild - script/cibuild

View File

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

View File

@@ -1,15 +1,12 @@
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
echo "Update the submodule to latest version..."
git submodule update
echo "Installing dependencies..." echo "Installing dependencies..."
python3 -m pip install --upgrade -r requirements_all.txt python3 -m pip install -r requirements_all.txt
REQ_STATUS=$? REQ_STATUS=$?
echo "Installing development dependencies.." 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=$? REQ_DEV_STATUS=$?

View File

@@ -5,6 +5,12 @@
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
if [ "$TRAVIS_PYTHON_VERSION" != "3.4" ]; then
NO_LINT=1
fi
export NO_LINT
script/test coverage script/test coverage
STATUS=$? STATUS=$?

View File

@@ -8,6 +8,7 @@ import importlib
import os import os
import pkgutil import pkgutil
import re import re
import sys
COMMENT_REQUIREMENTS = [ COMMENT_REQUIREMENTS = [
'RPi.GPIO', 'RPi.GPIO',
@@ -68,8 +69,9 @@ def gather_modules():
reqs.setdefault(req, []).append(package) reqs.setdefault(req, []).append(package)
if errors: if errors:
print("Found errors") print("******* ERROR")
print('\n'.join(errors)) print("Errors while importing: ", ', '.join(errors))
print("Make sure you import 3rd party libraries inside methods.")
return None return None
output.append('# Home Assistant core') output.append('# Home Assistant core')
@@ -95,6 +97,12 @@ def write_file(data):
req_file.write(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(): def main():
""" Main """ """ Main """
if not os.path.isfile('requirements_all.txt'): if not os.path.isfile('requirements_all.txt'):
@@ -104,7 +112,16 @@ def main():
data = gather_modules() data = gather_modules()
if data is None: 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) write_file(data)

View File

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