Browse Source

django1: Fix byte-compiled db migrations not loaded

This patches Django to load byte-compiled (.pyc) db migration scripts,
since Python scripts are often distributed in byte-compiled form in
OpenWrt packages.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lilik-openwrt-22.03
Jeffery To 5 years ago
parent
commit
b9a4286262
2 changed files with 12 additions and 1 deletions
  1. +1
    -1
      lang/python/django1/Makefile
  2. +11
    -0
      lang/python/django1/patches/001-load-byte-compiled-db-migrations.patch

+ 1
- 1
lang/python/django1/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=django1
PKG_VERSION:=1.11.29
PKG_RELEASE:=1
PKG_RELEASE:=2
PYPI_NAME:=Django
PKG_HASH:=4200aefb6678019a0acf0005cd14cfce3a5e6b9b90d06145fcdd2e474ad4329c


+ 11
- 0
lang/python/django1/patches/001-load-byte-compiled-db-migrations.patch View File

@ -0,0 +1,11 @@
--- a/django/db/migrations/loader.py
+++ b/django/db/migrations/loader.py
@@ -106,7 +106,7 @@ class MigrationLoader(object):
# Scan for .py files
migration_names = set()
for name in os.listdir(directory):
- if name.endswith(".py"):
+ if name.endswith(".py") or name.endswith(".pyc"):
import_name = name.rsplit(".", 1)[0]
if import_name[0] not in "_.~":
migration_names.add(import_name)

Loading…
Cancel
Save