Mike Bayer avatar Mike Bayer committed d2b4193

- [bug] Fixed bug whereby directories inside of
the template directories, such as __pycache__
on Pypy, would mistakenly be interpreted as
files which are part of the template. #49

Comments (0)

Files changed (2)

   "alembic downgrade -1".  Courtesy 
   Atsushi Odagiri for this feature.
 
+- [bug] Fixed bug whereby directories inside of 
+  the template directories, such as __pycache__
+  on Pypy, would mistakenly be interpreted as 
+  files which are part of the template. #49
+
 0.3.2
 =====
 - [feature] Basic support for Oracle added, 

alembic/command.py

     script = ScriptDirectory(directory)
 
     for file_ in os.listdir(template_dir):
+        file_path = os.path.join(template_dir, file_)
         if file_ == 'alembic.ini.mako':
             config_file = os.path.abspath(config.config_file_name)
             if os.access(config_file, os.F_OK):
                 util.msg("File %s already exists, skipping" % config_file)
             else:
                 script._generate_template(
-                    os.path.join(template_dir, file_),
+                    file_path,
                     config_file,
                     script_location=directory
                 )
-        else:
+        elif os.path.isfile(file_path):
             output_file = os.path.join(directory, file_)
             script._copy_file(
-                os.path.join(template_dir, file_), 
+                file_path,
                 output_file
             )
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.