Repository: aio-libs/aiohttp

Issue:
sdist build gets crashed under pip>=19 in dev mode
## Long story short

We have `cython` as an optional dependency. That's why we install it as a pre-requisite in the CI, as a separate step.
New pip creates a separate build virtualenv which doesn't have access to the place with cython installed which causes it to crash.

## Expected behaviour

It succeeds

## Actual behaviour

It tracebacks

## Steps to reproduce

* https://travis-ci.com/aio-libs/aiohttp/jobs/172249543#L198-L219
* https://ci.appveyor.com/project/aio-libs/aiohttp/build/job/uppd0qqw2sbisqtn#L46

## Your environment

Travis CI (doesn't really matter actually)


Discussion:
[GitMate.io](https://gitmate.io) thinks the contributor most likely able to help you is @asvetlov.

Possibly related issues are https://github.com/aio-libs/aiohttp/issues/3413 (ServerDisconnectedError with get compress=True), https://github.com/aio-libs/aiohttp/issues/3241 (Failed building wheel for aiohttp==3.4.3), https://github.com/aio-libs/aiohttp/issues/117 (HTTP GET + compress=True = 501), https://github.com/aio-libs/aiohttp/issues/2907 (Random crash occurs), and https://github.com/aio-libs/aiohttp/issues/469 (how to get the post data).
Temporary workaround: 9e23cf85.

@asvetlov I strongly recommend not doing any releases until this is addressed properly. I didn't add a change note because I hope that it'll be reverted by the time of release.
`pip install -U 'pip<19'` doesn't work for some reason under Windows: https://ci.appveyor.com/project/aio-libs/aiohttp/build/job/26xnep0pwnpb8ttk#L9. But that workaround at least fixed Travis CI so it's usable now.
> pip install -U 'pip<19' doesn't work for some reason under Windows: 

Addressed with d5d5d167c65e9b7dbeaa9769634cb5ae37dfbd8a
@pradyunsg could you please link the upstream issue here?
Yeps! pypa/pip#6144
FTR. Solution PoC: https://github.com/aio-libs/aiohttp/pull/3589

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -14,18 +14,6 @@
 
 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)
@@ -34,26 +22,21 @@
     sys.exit(2)
 
 
-ext = '.pyx' if USE_CYTHON else '.c'
+# NOTE: makefile cythonizes all Cython modules
 
-
-extensions = [Extension('aiohttp._websocket', ['aiohttp/_websocket' + ext]),
+extensions = [Extension('aiohttp._websocket', ['aiohttp/_websocket.c']),
               Extension('aiohttp._http_parser',
-                        ['aiohttp/_http_parser' + ext,
+                        ['aiohttp/_http_parser.c',
                          'vendor/http-parser/http_parser.c',
                          'aiohttp/_find_header.c'],
                         define_macros=[('HTTP_PARSER_STRICT', 0)],
                         ),
               Extension('aiohttp._frozenlist',
-                        ['aiohttp/_frozenlist' + ext]),
+                        ['aiohttp/_frozenlist.c']),
               Extension('aiohttp._helpers',
-                        ['aiohttp/_helpers' + ext]),
+                        ['aiohttp/_helpers.c']),
               Extension('aiohttp._http_writer',
-                        ['aiohttp/_http_writer' + ext])]
-
-
-if USE_CYTHON:
-    extensions = cythonize(extensions)
+                        ['aiohttp/_http_writer.c'])]
 
 
 class BuildFailed(Exception):


Test patch: