@@ -212,12 +212,12 @@ class DataSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
212
212
"""
213
213
214
214
# Init inputspec data attributes
215
- base_directory = Directory (desc = "Path to the base directory for storing data." )
215
+ base_directory = Str (desc = "Path to the base directory for storing data." )
216
216
container = Str (desc = "Folder within base directory in which to store output" )
217
217
parameterization = traits .Bool (
218
218
True , usedefault = True , desc = "store output in parametrized structure"
219
219
)
220
- strip_dir = Directory (desc = "path to strip out of filename" )
220
+ strip_dir = Str (desc = "path to strip out of filename" )
221
221
substitutions = InputMultiPath (
222
222
traits .Tuple (Str , Str ),
223
223
desc = (
@@ -440,24 +440,18 @@ def _check_s3_base_dir(self):
440
440
is not a valid S3 path, defaults to '<N/A>'
441
441
"""
442
442
443
- # NOTE: due to pathlib.Path in traits.Directory, S3 bucket paths
444
- # follow the format 's3:/bucket_name/...'
445
- s3_str = "s3:/"
443
+ s3_str = "s3://"
446
444
bucket_name = "<N/A>"
447
445
base_directory = self .inputs .base_directory
448
446
449
447
if not isdefined (base_directory ):
450
448
s3_flag = False
451
449
return s3_flag , bucket_name
452
450
453
- # Check for 's3:/' in base dir
454
- if base_directory .lower ().startswith (s3_str ):
455
- bucket_name = base_directory [len (s3_str ):].split ("/" )[0 ]
456
- s3_flag = True
457
- else :
458
- s3_flag = False
451
+ s3_flag = base_directory .lower ().startswith (s3_str )
452
+ if s3_flag :
453
+ bucket_name = base_directory [len (s3_str ):].partition ('/' )[0 ]
459
454
460
- # Return s3_flag
461
455
return s3_flag , bucket_name
462
456
463
457
# Function to return AWS secure environment variables
@@ -611,14 +605,12 @@ def _upload_to_s3(self, bucket, src, dst):
611
605
612
606
from botocore .exceptions import ClientError
613
607
614
- # NOTE: due to pathlib.Path in traits.Directory, S3 bucket paths
615
- # follow the format 's3:/bucket_name/...'
616
- s3_str = "s3:/"
608
+ s3_str = "s3://"
617
609
s3_prefix = s3_str + bucket .name
618
610
619
611
# Explicitly lower-case the "s3"
620
- if dst [: len ( s3_str )] .lower () == s3_str :
621
- dst = s3_str + dst [len (s3_str ) :]
612
+ if dst .lower (). startswith ( s3_str ) :
613
+ dst = s3_str + dst [len (s3_str ):]
622
614
623
615
# If src is a directory, collect files (this assumes dst is a dir too)
624
616
if os .path .isdir (src ):
0 commit comments