| Conditions | 2 |
| Total Lines | 23 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # install_certifi.py |
||
| 19 | def install_certifi(): |
||
| 20 | openssl_dir, openssl_cafile = os.path.split( |
||
| 21 | ssl.get_default_verify_paths().openssl_cafile) |
||
| 22 | |||
| 23 | print(" -- pip install --upgrade certifi") |
||
| 24 | subprocess.check_call([sys.executable, |
||
| 25 | "-E", "-s", "-m", "pip", "install", "--upgrade", "certifi"]) |
||
| 26 | |||
| 27 | import certifi |
||
| 28 | |||
| 29 | # change working directory to the default SSL directory |
||
| 30 | os.chdir(openssl_dir) |
||
| 31 | relpath_to_certifi_cafile = os.path.relpath(certifi.where()) |
||
| 32 | print(" -- removing any existing file or link") |
||
| 33 | try: |
||
| 34 | os.remove(openssl_cafile) |
||
| 35 | except FileNotFoundError: |
||
| 36 | pass |
||
| 37 | print(" -- creating symlink to certifi certificate bundle") |
||
| 38 | os.symlink(relpath_to_certifi_cafile, openssl_cafile) |
||
| 39 | print(" -- setting permissions") |
||
| 40 | os.chmod(openssl_cafile, STAT_0o775) |
||
| 41 | print(" -- update complete") |
||
| 42 | |||
| 46 |