Don't treat .pyc/pyo files as migrations. Refs #23237 among others.

This commit is contained in:
Andrew Godwin 2014-08-08 09:56:59 +10:00
parent f676305ece
commit 51673c146e
1 changed files with 2 additions and 2 deletions

View File

@ -89,10 +89,10 @@ class MigrationLoader(object):
six.moves.reload_module(module) six.moves.reload_module(module)
self.migrated_apps.add(app_config.label) self.migrated_apps.add(app_config.label)
directory = os.path.dirname(module.__file__) directory = os.path.dirname(module.__file__)
# Scan for .py[c|o] files # Scan for .py files
migration_names = set() migration_names = set()
for name in os.listdir(directory): for name in os.listdir(directory):
if name.endswith(".py") or name.endswith(".pyc") or name.endswith(".pyo"): if name.endswith(".py"):
import_name = name.rsplit(".", 1)[0] import_name = name.rsplit(".", 1)[0]
if import_name[0] not in "_.~": if import_name[0] not in "_.~":
migration_names.add(import_name) migration_names.add(import_name)