mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 12:05:33 +00:00
str(CA_BUNDLE environment variable)
This commit is contained in:
parent
40a9f181a7
commit
f43650ca34
@ -49,6 +49,7 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from docopt import docopt
|
from docopt import docopt
|
||||||
@ -63,6 +64,9 @@ REGEXP = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
CA_BUNDLE = os.environ.get("CA_BUNDLE")
|
CA_BUNDLE = os.environ.get("CA_BUNDLE")
|
||||||
|
if CA_BUNDLE is not None:
|
||||||
|
CA_BUNDLE = str(Path(CA_BUNDLE))
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def _open(filename=None, mode='r'):
|
def _open(filename=None, mode='r'):
|
||||||
@ -445,7 +449,7 @@ def init(args):
|
|||||||
candidates = get_pkg_names(candidates)
|
candidates = get_pkg_names(candidates)
|
||||||
logging.debug("Found imports: " + ", ".join(candidates))
|
logging.debug("Found imports: " + ", ".join(candidates))
|
||||||
pypi_server = "https://pypi.python.org/pypi/"
|
pypi_server = "https://pypi.python.org/pypi/"
|
||||||
verify = None
|
verify = CA_BUNDLE
|
||||||
proxy = None
|
proxy = None
|
||||||
if args["--pypi-server"]:
|
if args["--pypi-server"]:
|
||||||
pypi_server = args["--pypi-server"]
|
pypi_server = args["--pypi-server"]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# # activate (.env38) virtual environment
|
# # activate (.env38) virtual environment
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
# upgrade pip
|
# upgrade pip (21.1.1 -> 22.3.1)
|
||||||
# (.env38)> python.exe -m pip install --upgrade pip
|
# (.env38)> python.exe -m pip install --upgrade pip
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
CA_BUNDLE=C:\your\path\and\certificates.pem
|
CA_BUNDLE=C:\your\path\and\certificates.pem
|
||||||
|
|
||||||
# alternatively you can set this value as an environment variable
|
# alternatively you can set this value as an environment variable
|
||||||
# $ set CA_BUNDLE="C:\your\path\and\certificates.pem" # for win 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
|
# $ export CA_BUNDLE=C:\your\path\and\certificates.pem # for nix OS
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
asposestorage==1.0.2
|
asposestorage
|
||||||
beautifulsoup4==4.11.1
|
beautifulsoup4
|
||||||
boto==2.49.0
|
boto
|
||||||
docopt==0.6.2
|
click
|
||||||
Flask==2.2.2
|
docopt
|
||||||
ipython==8.8.0
|
Flask
|
||||||
nose==1.3.7
|
ipython
|
||||||
peewee==3.15.4
|
nose
|
||||||
pyflakes==3.0.1
|
pattern
|
||||||
requests==2.28.2
|
peewee
|
||||||
SQLAlchemy==1.4.46
|
pyflakes
|
||||||
ujson==5.7.0
|
requests
|
||||||
|
SQLAlchemy
|
||||||
|
ujson
|
||||||
|
@ -12,13 +12,12 @@ See ./env.test.example for details.
|
|||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
CA_BUNDLE = os.environ.get("CA_BUNDLE")
|
CA_BUNDLE = os.environ.get("CA_BUNDLE")
|
||||||
|
|
||||||
if CA_BUNDLE is None and importlib.find_loader("dotenv"):
|
if CA_BUNDLE is None and importlib.find_loader("dotenv"):
|
||||||
# optional loading of values from .env.test file
|
# optional loading of values from .env.test file
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import dotenv
|
import dotenv
|
||||||
|
|
||||||
env_test_path = Path(os.path.dirname(__file__) + "/.env.test")
|
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:
|
if config is not None:
|
||||||
CA_BUNDLE = config["CA_BUNDLE"]
|
CA_BUNDLE = config["CA_BUNDLE"]
|
||||||
|
elif CA_BUNDLE is not None:
|
||||||
|
CA_BUNDLE = str(Path(CA_BUNDLE))
|
||||||
|
@ -17,13 +17,17 @@ import os
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from pipreqs import pipreqs
|
from pipreqs import pipreqs
|
||||||
|
|
||||||
CA_BUNDLE = os.environ.get("CA_BUNDLE")
|
CA_BUNDLE = os.environ.get("CA_BUNDLE")
|
||||||
|
|
||||||
|
|
||||||
if CA_BUNDLE is None:
|
if CA_BUNDLE is None:
|
||||||
from tests.settings import CA_BUNDLE
|
from tests.settings import CA_BUNDLE
|
||||||
|
else:
|
||||||
|
CA_BUNDLE = str(Path(CA_BUNDLE))
|
||||||
|
|
||||||
|
|
||||||
class TestPipreqs(unittest.TestCase):
|
class TestPipreqs(unittest.TestCase):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user