3609: Correctly recognize and rewrite directory names in collections.
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 31 Oct 2014 20:37:47 +0000 (16:37 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 31 Oct 2014 20:37:47 +0000 (16:37 -0400)
sdk/python/arvados/commands/run.py

index 411b9977fd1f8679e1f83e9ae1d3c0723acdf781..f2bf0f353bbd146ece4775da7b6094d654ed0d04 100644 (file)
@@ -92,6 +92,12 @@ def statfile(prefix, fn):
             else:
                 # trim leading '/' for path prefix test later
                 return UploadFile(prefix, absfn[1:])
+        if stat.S_ISDIR(st.st_mode):
+            sp = os.path.split(absfn)
+            (pdh, branch) = is_in_collection(sp[0], sp[1])
+            if pdh:
+                return ArvFile(prefix, "$(dir %s/%s/)" % (pdh, branch))
+
     return prefix+fn
 
 def main(arguments=None):
@@ -208,7 +214,7 @@ def main(arguments=None):
         print("Upload local files: \"%s\"" % '" "'.join([c.fn for c in files]))
 
         if args.dry_run:
-            print("cd %s" % pathprefix)
+            print("$(input) is %s" % pathprefix.rstrip('/'))
             pdh = "$(input)"
         else:
             files = sorted(files, key=lambda x: x.fn)