@@ -91,17 +91,27 @@ def __init__(self, path_to_tuf_config_file):
91
91
with open (path_to_tuf_config_file ) as tuf_config_file :
92
92
tuf_config = json .load (tuf_config_file )
93
93
94
+ # Reconfigure TUF logging, we can use the pip log output
95
+ tuf .settings .ENABLE_FILE_LOGGING = tuf_config .get ('enable_logging' , False )
96
+
94
97
# NOTE: The directory where TUF metadata for *all* repositories are
95
98
# kept.
96
- tuf .settings .repositories_directory = tuf_config ['repositories_dir' ]
99
+ if os .path .is_abs (tuf_config ['repositories_dir' ]):
100
+ tuf .settings .repositories_directory = tuf_config ['repositories_dir' ]
101
+ else :
102
+ tuf .settings .repositories_directory = os .path .join (
103
+ os .path .dirname (path_to_tuf_config_file ),
104
+ tuf_config ['repositories_dir' ]
105
+ )
97
106
98
107
# NOTE: Tell TUF where SSL certificates are kept.
99
108
tuf .settings .ssl_certificates = certifi .where ()
100
109
110
+
101
111
# NOTE: The directory where the targets for *this* repository is
102
112
# cached. We hard-code this keep this to a subdirectory dedicated to
103
113
# this repository.
104
- self .__targets_dir = os .path .join (tuf_config [ 'repositories_dir' ] ,
114
+ self .__targets_dir = os .path .join (tuf . settings . repositories_directory ,
105
115
tuf_config ['repository_dir' ],
106
116
'targets' )
107
117
@@ -164,6 +174,7 @@ def download(self, target_relpath, dest_dir, dest_filename):
164
174
if 'TUF_CONFIG_FILE' in os .environ :
165
175
import certifi
166
176
import tuf .settings
177
+ tuf .settings .ENABLE_FILE_LOGGING = False
167
178
168
179
from tuf .client .updater import Updater
169
180
0 commit comments