Skip to content

Commit

Permalink
Require cython when building from git clone only (#3189)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov authored Aug 20, 2018
1 parent d036e38 commit 168e3f0
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 9 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ install:
- git submodule update --init --recursive

- "tools/build.cmd %PYTHON%\\python.exe -m pip install -U pip wheel setuptools"
- "tools/build.cmd %PYTHON%\\python.exe -m pip install -r requirements/cython.txt"
- "tools/build.cmd %PYTHON%\\python.exe -m pip install -r requirements/ci.txt"

build: false
Expand Down
14 changes: 12 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ python:

install:
- &upgrade_python_toolset pip install --upgrade pip wheel setuptools
- pip install -r requirements/cython.txt
- pip install -r requirements/ci.txt

script:
Expand Down Expand Up @@ -43,7 +44,7 @@ _helpers:
<<: *_lint_base
install:
- *upgrade_python_toolset
- pip install -U -r requirements/ci.txt -r requirements/doc.txt -r requirements/doc-spelling.txt
- pip install -U -r requirements/doc.txt -r requirements/doc-spelling.txt
after_failure: cat docs/_build/spelling/output.txt
addons:
apt:
Expand Down Expand Up @@ -152,12 +153,20 @@ jobs:
- <<: *_doc_base
env:
- TARGET=towncrier
install:
- *upgrade_python_toolset
- pip install -r requirements/cython.txt
- pip install -r requirements/ci.txt
- pip install -r requirements/towncrier.txt
script:
- towncrier --yes

- <<: *_lint_base
env:
- TARGET=flake8
install:
- *upgrade_python_toolset
- pip install -r requirements/flake.txt
script:
- flake8 aiohttp examples tests

Expand All @@ -166,7 +175,8 @@ jobs:
- TARGET="'dist setup check'"
install:
- *upgrade_python_toolset
- pip install -r requirements/doc.txt
- pip install -r requirements/cython.txt
- pip install -r requirements/ci.txt -r requirements/doc.txt
script:
- python setup.py check --metadata --restructuredtext --strict --verbose

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

all: test

.install-deps: $(shell find requirements -type f)
install-cython:
@pip install -r requirements/cython.txt

.install-deps: $(shell find requirements -type f) install-cython
@pip install -U -r requirements/dev.txt
@touch .install-deps

Expand Down
2 changes: 2 additions & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ Tf
timestamps
toolbar
toplevel
towncrier
tp
tuples
UI
Expand Down Expand Up @@ -302,3 +303,4 @@ WSMsgType
wss
www
xxx
yarl
6 changes: 2 additions & 4 deletions requirements/ci-wheel.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-r flake.txt
attrs==18.1.0
async-generator==1.10
async-timeout==3.0.0
Expand All @@ -6,17 +7,14 @@ cchardet==2.1.1
chardet==3.0.4
coverage==4.5.1
cython==0.28.5
flake8==3.5.0
gunicorn==19.8.1
isort==4.3.4
pyflakes==2.0.0
multidict==4.3.1
pytest==3.7.1
pytest-cov==2.5.1
pytest-mock==1.10.0
pytest-xdist==1.22.5
towncrier==18.6.0
tox==3.2.1
tox==3.1.3
twine==1.11.0
yarl==1.2.6

Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
setuptools-git==1.2
mypy==0.620; implementation_name=="cpython"

-r doc.txt
-r ci-wheel.txt
-r doc.txt
-e .
1 change: 1 addition & 0 deletions requirements/cython.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cython==0.28.5
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-r ci.txt
-r towncrier.txt
ipdb==0.11
pytest-sugar==0.9.1
ipython==6.5.0
Expand Down
2 changes: 2 additions & 0 deletions requirements/flake.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flake8==3.5.0
isort==4.3.4
1 change: 1 addition & 0 deletions requirements/towncrier.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
towncrier==18.6.0
16 changes: 15 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,28 @@
if sys.version_info < (3, 5, 3):
raise RuntimeError("aiohttp 3.x requires Python 3.5.3+")

here = pathlib.Path(__file__).parent

try:
from Cython.Build import cythonize
USE_CYTHON = True
except ImportError:
USE_CYTHON = False

if (here / '.git').exists() and not USE_CYTHON:
print("Install cython when building from git clone", file=sys.stderr)
print("Hint:", file=sys.stderr)
print(" pip install cython", file=sys.stderr)
sys.exit(1)


if (here / '.git').exists() and not (here / 'vendor/http-parser/README.md'):
print("Install submodules when building from git clone", file=sys.stderr)
print("Hint:", file=sys.stderr)
print(" git submodule update --init", file=sys.stderr)
sys.exit(2)


ext = '.pyx' if USE_CYTHON else '.c'


Expand Down Expand Up @@ -62,7 +77,6 @@ def build_extension(self, ext):
raise BuildFailed()


here = pathlib.Path(__file__).parent

txt = (here / 'aiohttp' / '__init__.py').read_text('utf-8')
try:
Expand Down
2 changes: 2 additions & 0 deletions tools/build-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ echo
echo
echo "Compile wheels"
for PYTHON in ${PYTHON_VERSIONS}; do
/opt/python/${PYTHON}/bin/pip install -r /io/requirements/cython.txt
/opt/python/${PYTHON}/bin/pip install -r /io/requirements/wheel.txt
/opt/python/${PYTHON}/bin/pip wheel /io/ -w /io/dist/
done
Expand Down Expand Up @@ -59,6 +60,7 @@ for PYTHON in ${PYTHON_VERSIONS}; do
echo
echo -n "Test $PYTHON: "
/opt/python/${PYTHON}/bin/python -c "import platform; print('Building wheel for {platform} platform.'.format(platform=platform.platform()))"
/opt/python/${PYTHON}/bin/pip install -r /io/requirements/cython.txt
/opt/python/${PYTHON}/bin/pip install -r /io/requirements/ci-wheel.txt
/opt/python/${PYTHON}/bin/pip install "$package_name" --no-index -f file:///io/dist
/opt/python/${PYTHON}/bin/py.test /io/tests
Expand Down

0 comments on commit 168e3f0

Please sign in to comment.