File tree 1 file changed +18
-4
lines changed
1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 38
38
from _pygit2 import GIT_OPT_SET_CACHE_MAX_SIZE
39
39
from _pygit2 import GIT_OPT_SET_SSL_CERT_LOCATIONS
40
40
41
+ from .errors import GitError
42
+
41
43
42
44
__metaclass__ = type # make all classes new-style by default
43
45
@@ -59,11 +61,23 @@ class Settings:
59
61
_search_path = SearchPathList ()
60
62
61
63
def __init__ (self ):
64
+ """Initialize global pygit2 and libgit2 settings."""
65
+ self ._initialize_tls_certificate_locations ()
66
+
67
+ def _initialize_tls_certificate_locations (self ):
68
+ """Set up initial TLS file and directory lookup locations."""
62
69
self ._default_tls_verify_paths = get_default_verify_paths ()
63
- self .set_ssl_cert_locations (
64
- self ._default_tls_verify_paths .cafile ,
65
- self ._default_tls_verify_paths .capath ,
66
- )
70
+ try :
71
+ self .set_ssl_cert_locations (
72
+ self ._default_tls_verify_paths .cafile ,
73
+ self ._default_tls_verify_paths .capath ,
74
+ )
75
+ except GitError as git_err :
76
+ valid_msg = "TLS backend doesn't support certificate locations"
77
+ if str (git_err ) != valid_msg :
78
+ raise
79
+ self ._ssl_cert_file = self ._default_tls_verify_paths .cafile
80
+ self ._ssl_cert_dir = self ._default_tls_verify_paths .capath
67
81
68
82
@property
69
83
def search_path (self ):
You canβt perform that action at this time.
0 commit comments