str(CA_BUNDLE environment variable)

This commit is contained in:
c-w-m 2023-01-20 15:15:27 -07:00
parent 40a9f181a7
commit f43650ca34
6 changed files with 29 additions and 18 deletions

View File

@ -49,6 +49,7 @@ import re
import sys
import traceback
from contextlib import contextmanager
from pathlib import Path
import requests
from docopt import docopt
@ -63,6 +64,9 @@ REGEXP = [
]
CA_BUNDLE = os.environ.get("CA_BUNDLE")
if CA_BUNDLE is not None:
CA_BUNDLE = str(Path(CA_BUNDLE))
@contextmanager
def _open(filename=None, mode='r'):
@ -445,7 +449,7 @@ def init(args):
candidates = get_pkg_names(candidates)
logging.debug("Found imports: " + ", ".join(candidates))
pypi_server = "https://pypi.python.org/pypi/"
verify = None
verify = CA_BUNDLE
proxy = None
if args["--pypi-server"]:
pypi_server = args["--pypi-server"]

View File

@ -3,7 +3,7 @@
# # activate (.env38) virtual environment
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# upgrade pip
# upgrade pip (21.1.1 -> 22.3.1)
# (.env38)> python.exe -m pip install --upgrade pip
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -4,5 +4,5 @@
CA_BUNDLE=C:\your\path\and\certificates.pem
# alternatively you can set this value as an environment variable
# $ set CA_BUNDLE="C:\your\path\and\certificates.pem" # for win OS
# $ export CA_BUNDLE="C:\your\path\and\certificates.pem" # for nix OS
# $ set CA_BUNDLE=C:\your\path\and\certificates.pem # for win OS
# $ export CA_BUNDLE=C:\your\path\and\certificates.pem # for nix OS

View File

@ -1,12 +1,14 @@
asposestorage==1.0.2
beautifulsoup4==4.11.1
boto==2.49.0
docopt==0.6.2
Flask==2.2.2
ipython==8.8.0
nose==1.3.7
peewee==3.15.4
pyflakes==3.0.1
requests==2.28.2
SQLAlchemy==1.4.46
ujson==5.7.0
asposestorage
beautifulsoup4
boto
click
docopt
Flask
ipython
nose
pattern
peewee
pyflakes
requests
SQLAlchemy
ujson

View File

@ -12,13 +12,12 @@ See ./env.test.example for details.
import importlib
import os
from pathlib import Path
CA_BUNDLE = os.environ.get("CA_BUNDLE")
if CA_BUNDLE is None and importlib.find_loader("dotenv"):
# optional loading of values from .env.test file
from pathlib import Path
import dotenv
env_test_path = Path(os.path.dirname(__file__) + "/.env.test")
@ -26,3 +25,5 @@ if CA_BUNDLE is None and importlib.find_loader("dotenv"):
if config is not None:
CA_BUNDLE = config["CA_BUNDLE"]
elif CA_BUNDLE is not None:
CA_BUNDLE = str(Path(CA_BUNDLE))

View File

@ -17,13 +17,17 @@ import os
import unittest
import requests
from pathlib import Path
from pipreqs import pipreqs
CA_BUNDLE = os.environ.get("CA_BUNDLE")
if CA_BUNDLE is None:
from tests.settings import CA_BUNDLE
else:
CA_BUNDLE = str(Path(CA_BUNDLE))
class TestPipreqs(unittest.TestCase):