Skip to content

Commit

Permalink
convert requirements-*.txt to be inclusive; flake8 script introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
ambv committed May 17, 2013
1 parent 1553192 commit dede1f2
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 18 deletions.
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ before_install:
- git submodule update --init --recursive

install:
- pip install -r requirements.txt -r requirements-test.txt --use-mirrors
- if [[ $USE_OPTIONAL == "true" ]]; then pip install -r requirements-optional.txt --use-mirrors; fi
- if [[ $TRAVIS_PYTHON_VERSION == "2.6" && $USE_OPTIONAL == "true" ]]; then pip install -r requirements-optional-2.6.txt --use-mirrors; fi
- if [[ $TRAVIS_PYTHON_VERSION != "pypy" && $USE_OPTIONAL == "true" ]]; then pip install -r requirements-optional-cpython.txt --use-mirrors; fi
- if [[ $FLAKE == "true" ]]; then pip install --use-mirrors flake8; fi
- bash requirements-install.sh

script:
- nosetests
- if [[ $FLAKE == "true" ]]; then find html5lib/ -name '*.py' -and -not -name 'constants.py' -print0 | xargs -0 flake8 --ignore=E501; fi
- if [[ $FLAKE == "true" ]]; then flake8 --max-line-length=99 --ignore=E126 html5lib/constants.py; fi
- bash flake8-run.sh

after_script:
- python debug-info.py
11 changes: 11 additions & 0 deletions flake8-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -e

if [[ ! -x $(which flake8) ]]; then
echo "fatal: flake8 not found on $PATH. Exiting."
exit 1
fi

if [[ $FLAKE == "true" ]]; then
find html5lib/ -name '*.py' -and -not -name 'constants.py' -print0 | xargs -0 flake8 --ignore=E501
flake8 --max-line-length=99 --ignore=E126 html5lib/constants.py
fi
20 changes: 20 additions & 0 deletions requirements-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -e

if [[ $USE_OPTIONAL != "true" && $USE_OPTIONAL != "false" ]]; then
echo "fatal: \$USE_OPTIONAL not set to true or false. Exiting."
exit 1
fi

pip install -r requirements-test.txt --use-mirrors

if [[ $USE_OPTIONAL == "true" && $TRAVIS_PYTHON_VERSION != "pypy" ]]; then
if [[ $TRAVIS_PYTHON_VERSION == "2.6" ]]; then
pip install -r requirements-optional-2.6.txt --use-mirrors
else
pip install -r requirements-optional-cpython.txt --use-mirrors
fi
fi

if [[ $FLAKE == "true" ]]; then
pip install --use-mirrors flake8
fi
2 changes: 2 additions & 0 deletions requirements-optional-2.6.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-r requirements-optional-cpython.txt

# Can be used to force attributes to be serialized in alphabetical
# order.
ordereddict
2 changes: 2 additions & 0 deletions requirements-optional-cpython.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-r requirements-optional.txt

# lxml is supported with its own treebuilder ("lxml") and otherwise
# uses the standard ElementTree support
lxml
2 changes: 2 additions & 0 deletions requirements-optional.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-r requirements.txt

# We support a Genshi treewalker that can be used to serialize Genshi
# streams.
genshi
Expand Down
2 changes: 2 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
-r requirements.txt

nose
ordereddict # Python 2.6
14 changes: 3 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ envlist = py26,py27,py32,py33

[testenv]
deps =
charade
datrie
Genshi
lxml
-r{toxinidir}/requirements-optional-cpython.txt
nose
six
commands =
{envbindir}/nosetests -q
{toxinidir}/flake8-run.sh

[testenv:pypy]
# lxml doesn't work and datrie doesn't make sense
Expand All @@ -24,10 +21,5 @@ deps =
[testenv:py26]
basepython = python2.6
deps =
charade
datrie
Genshi
lxml
-r{toxinidir}/requirements-optional-2.6.txt
nose
six
ordereddict

0 comments on commit dede1f2

Please sign in to comment.