Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev provision: Improve CentOS support. #11004

Closed
wants to merge 6 commits into from
Prev

setup_venv: Uninstall typing on Python >3.4.

Otherwise this causes an error
```
AttributeError: type object 'Callable' has no attribute '_abc_registry'
```
on 3.7. While the error is specific to 3.7, it is safer to uninstall
typing for all the versions that don't require a pip-provided typing
library.
  • Loading branch information...
rht committed Dec 17, 2018
commit 014dd61104ccfbff83d17ce9bd37a1dd8637a520
@@ -2,6 +2,7 @@
import os
import shutil
import subprocess
import sys
from scripts.lib.zulip_tools import run, ENDC, WARNING, parse_lsb_release
from scripts.lib.hash_reqs import expand_reqs

@@ -338,4 +339,15 @@ def do_setup_virtualenv(venv_path, requirements_file, virtualenv_args):
# Might be a failure due to network connection issues. Retrying...
print(WARNING + "`pip install` failed; retrying..." + ENDC)
install_venv_deps(requirements_file)

# The typing module has been included in stdlib since 3.5.
# Installing a pypi version of it has been harmless until a bug
# "AttributeError: type object 'Callable' has no attribute
# '_abc_registry'" happens in 3.7. And so just to be safe, it is
# disabled from now on for all >= 3.5 versions.
# Remove this once 3.4 is no longer supported.
at_least_35 = (sys.version_info.major == 3) and (sys.version_info.minor >= 5)
if at_least_35 and ('python2.7' not in virtualenv_args):
run(["pip", "uninstall", "-y", "typing"])

run(["sudo", "chmod", "-R", "a+rX", venv_path])
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.