From 32e0000268f76ee4a071c845c904fd1ef7d0d2a0 Mon Sep 17 00:00:00 2001 From: Florian Scherf Date: Thu, 4 Feb 2016 00:09:45 +0100 Subject: python3-django: fix migrations Signed-off-by: Florian Scherf Signed-off-by: Michael Olbrich --- .../0002-MigrationLoader-search-for-.py-c.patch | 36 ++++++++++++++++++++++ patches/Django-1.8.7/series | 1 + 2 files changed, 37 insertions(+) create mode 100644 patches/Django-1.8.7/0002-MigrationLoader-search-for-.py-c.patch (limited to 'patches') diff --git a/patches/Django-1.8.7/0002-MigrationLoader-search-for-.py-c.patch b/patches/Django-1.8.7/0002-MigrationLoader-search-for-.py-c.patch new file mode 100644 index 000000000..a1dc20dff --- /dev/null +++ b/patches/Django-1.8.7/0002-MigrationLoader-search-for-.py-c.patch @@ -0,0 +1,36 @@ +From 65d28e3e9a47ad270e7017b6b2b269978c01c428 Mon Sep 17 00:00:00 2001 +From: Florian Scherf +Date: Wed, 3 Feb 2016 17:32:32 +0100 +Subject: [PATCH] MigrationLoader: search for *.py(c) + +The MigrationLoader originally searchs for *.py but we +are running *.pyc only. +Without this patch "./manage.py migrate" will crash. + +Signed-off-by: Florian Scherf +--- + django/db/migrations/loader.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py +index bbd60a6..77b50fd 100644 +--- a/django/db/migrations/loader.py ++++ b/django/db/migrations/loader.py +@@ -88,10 +88,12 @@ class MigrationLoader(object): + six.moves.reload_module(module) + self.migrated_apps.add(app_config.label) + directory = os.path.dirname(module.__file__) +- # Scan for .py files ++ # Scan for .py(c) files + migration_names = set() + for name in os.listdir(directory): +- if name.endswith(".py"): ++ root, ext = os.path.splitext(name) ++ ++ if ext in ['.py', '.pyc']: + import_name = name.rsplit(".", 1)[0] + if import_name[0] not in "_.~": + migration_names.add(import_name) +-- +2.7.0.rc3 + diff --git a/patches/Django-1.8.7/series b/patches/Django-1.8.7/series index 3f7010a4a..c644f907c 100644 --- a/patches/Django-1.8.7/series +++ b/patches/Django-1.8.7/series @@ -1 +1,2 @@ 0001-Fixed-25322-Lazily-compiled-core.validators-regular-.patch +0002-MigrationLoader-search-for-.py-c.patch -- cgit v1.2.3