]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Fixed migration for one file
authorMax Shytikov <mshytikov@gmail.com>
Tue, 22 Apr 2014 01:09:13 +0000 (03:09 +0200)
committerMax Shytikov <mshytikov@gmail.com>
Wed, 30 Apr 2014 00:36:26 +0000 (02:36 +0200)
vcr/migration.py

index 90a2da9b28c1956339f6c5ade1163d921b82e0d3..d3e909a32058513734fd13f32f3d30a2a82865ca 100644 (file)
@@ -92,9 +92,12 @@ def main():
     path = sys.argv[1]
     if not os.path.isabs(path):
         path = os.path.abspath(path)
-    for root, dirs, files in os.walk(path):
-        for file_name in files:
-            file_path = os.path.join(root, file_name)
+    files = [path]
+    if os.path.isdir(path):
+        files = (os.path.join(root, name)
+                 for (root, dirs, files) in os.walk(path)
+                 for name in files)
+    for file_path in files:
             migrated = try_migrate(file_path)
             status = 'OK' if migrated else 'FAIL'
             sys.stderr.write("[{}] {}\n".format(status, file_path))