Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Commit

Permalink
Support PyPy
Browse files Browse the repository at this point in the history
  • Loading branch information
vfaronov committed Jul 28, 2016
1 parent c49af43 commit 07ea82c
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 9 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ addons:

python:
- "2.7"
- "pypy"
- "3.4"
- "3.5"

Expand All @@ -17,11 +18,12 @@ env:
- REQUIRES=normal

install:
- test "$REQUIRES" = minimum && tools/minimum_requires.sh || true
- if [ "$TRAVIS_PYTHON_VERSION" = pypy ]; then . `tools/pypy_env.sh`; fi
- if [ "$REQUIRES" = minimum ]; then tools/minimum_requires.sh; fi
- pip install -e .
- pip install -r tools/requirements.txt
- tools/vnu.sh install
- npm install jshint@2.9.2
- tools/jshint.sh install

cache: pip

Expand All @@ -32,10 +34,10 @@ script:
- tools/build_extra_doc.sh

# This also validates an actual HTML report (``showcase.html``).
- tools/vnu.sh validate extra_doc/_build/*.html
- tools/vnu.sh run extra_doc/_build/*.html

- tools/css_validator.sh httpolice/reports/html.css
- node_modules/.bin/jshint httpolice/reports/html.js
- tools/jshint.sh run httpolice/reports/html.js

# Check that the API example works.
- python doc/api_example.py && grep -q 1194 report.html
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ Added
- The ``httpolice`` command-line tool now has
a ``--fail-on`` option to exit with a non-zero status
if any notices with a given severity have been reported.
- HTTPolice now works under `PyPy`_ (the 2.7 variant).
You will probably need a recent version of PyPy
(5.3.1 works, but with 5.0.0 I get segfaults all over the place).
Actually, PyPy doesn't seem to make HTTPolice faster,
so this is only interesting if you already have a PyPy environment.
- Check for missing scheme name in authorization headers (notice `1274`_).
- Check for missing quality values in headers like Accept (notice `1276`_).
- Check for obsolete 'X-' prefix in experimental headers (notice `1277`_).
- Work around more problems in HAR files exported by Firefox.
- Notice `1093`_ recognizes a few more product names as client libraries.

.. _HTML reports: http://httpolice.readthedocs.io/en/stable/reports.html
.. _PyPy: http://pypy.org/
.. _1093: http://pythonhosted.org/HTTPolice/notices.html#1093
.. _1274: http://pythonhosted.org/HTTPolice/notices.html#1274
.. _1276: http://pythonhosted.org/HTTPolice/notices.html#1276
Expand Down
5 changes: 5 additions & 0 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ __ https://pip.pypa.io/en/stable/installing/
__ https://packaging.python.org/en/latest/install_requirements_linux/
__ http://lxml.de/installation.html

`PyPy`__ (the 2.7 variant) is also supported,
but you may experience problems with older PyPy versions (5.3.1 should be OK).

__ http://pypy.org/


On Debian/Ubuntu
----------------
Expand Down
22 changes: 22 additions & 0 deletions tools/jshint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

set -e

VERSION=2.9.2
BASE=$HOME/install-jshint

action=$1
shift

case $action in
install)
rm -rf "$BASE"
mkdir "$BASE"
cd "$BASE"
npm install jshint@$VERSION
;;

run)
"$BASE/node_modules/.bin/jshint" "$@"
;;
esac
18 changes: 18 additions & 0 deletions tools/pypy_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

# Travis has an old PyPy version. Install one that is recent enough for us.
# See also https://github.com/travis-ci/travis-ci/issues/5027

set -e

VERSION=pypy2-v5.3.1-linux64
BASE=$HOME/install-pypy

rm -rf "$BASE"
mkdir -p "$BASE"
cd "$BASE"

wget https://bitbucket.org/pypy/pypy/downloads/$VERSION.tar.bz2
tar -jxf $VERSION.tar.bz2
virtualenv --python=$VERSION/bin/pypy env >&2
echo "$PWD/env/bin/activate"
12 changes: 7 additions & 5 deletions tools/vnu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,21 @@ VERSION=16.6.29
JAVA=/usr/lib/jvm/java-8-oracle/bin/java
test -e "$JAVA" || JAVA=java

BASE=$HOME/install-vnu

action=$1
shift

case $action in
install)
rm -rf vnu
mkdir vnu
cd vnu
rm -rf "$BASE"
mkdir "$BASE"
cd "$BASE"
wget "$RELEASES/download/$VERSION/vnu.jar_$VERSION.zip" -O vnu.zip
unzip vnu.zip
;;

validate)
"$JAVA" -jar vnu/dist/vnu.jar "$@"
run)
"$JAVA" -jar "$BASE/dist/vnu.jar" "$@"
;;
esac

0 comments on commit 07ea82c

Please sign in to comment.