@@ -97,6 +97,7 @@ def __call__(project=None,
97
97
jobs = 'auto' ,
98
98
dataset = None ):
99
99
100
+
100
101
ds = require_dataset (
101
102
dataset , check_installed = True , purpose = 'update' )
102
103
@@ -161,6 +162,7 @@ def __call__(project=None,
161
162
# go with a single big one
162
163
subjects = [None ]
163
164
from datalad_xnat .parser import parse_xnat
165
+ from unittest .mock import patch
164
166
for sub in subjects :
165
167
try :
166
168
# all this tempfile madness is only needed because windows
@@ -189,16 +191,31 @@ def __call__(project=None,
189
191
# corresponds to the header field 'filename' in the csv table
190
192
filename = '{filename}'
191
193
filenameformat = f"{ pathfmt } { filename } "
192
- ds .addurls (
193
- str (addurls_table_fname ), '{url}' , filenameformat ,
194
- ifexists = ifexists ,
195
- fast = True if reckless == 'fast'
196
- else False ,
197
- save = True ,
198
- jobs = jobs ,
199
- cfg_proc = None if platform .credential_name == 'anonymous'
200
- else 'xnat_dataset' ,
201
- result_renderer = 'default' )
194
+ # shoehorn essential info into the ENV to make it
195
+ # accessible to the config procedure
196
+ # TODO maybe alter the config procedure to pull this info
197
+ # from a superdataset, if it finds the dataset at hand
198
+ # unconfigured.
199
+ env_prefix = f'DATALAD_XNAT_{ xnat_cfg_name .upper ()} '
200
+ env = {
201
+ 'DATALAD_XNAT_DEFAULT__NAME' : xnat_cfg_name ,
202
+ f'{ env_prefix } _URL' : platform .url ,
203
+ }
204
+ if platform .credential_name != 'anonymous' :
205
+ env [f'{ env_prefix } _CREDENTIAL__NAME' ] = \
206
+ platform .credential_name
207
+ with patch .dict ('os.environ' , env ):
208
+ ds .addurls (
209
+ str (addurls_table_fname ), '{url}' , filenameformat ,
210
+ ifexists = ifexists ,
211
+ fast = True if reckless == 'fast'
212
+ else False ,
213
+ save = True ,
214
+ jobs = jobs ,
215
+ cfg_proc = None
216
+ if platform .credential_name == 'anonymous'
217
+ else 'xnat_dataset' ,
218
+ result_renderer = 'default' )
202
219
finally :
203
220
if addurls_table_fname .exists ():
204
221
addurls_table_fname .unlink ()
0 commit comments