diff options
author | Jeffery To <jeffery.to@gmail.com> | 2020-02-22 04:45:28 +0800 |
---|---|---|
committer | Jeffery To <jeffery.to@gmail.com> | 2020-03-14 04:35:00 +0800 |
commit | b9a4286262bfd118b367898ce8dda9f56894d04c (patch) | |
tree | a595dd949df70ac72aa6ec22efd8c1f67d3d23ee | |
parent | 5eccf7e582e9795ab0b7736953fe099c0f64e9b8 (diff) |
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>
-rw-r--r-- | lang/python/django1/Makefile | 2 | ||||
-rw-r--r-- | lang/python/django1/patches/001-load-byte-compiled-db-migrations.patch | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lang/python/django1/Makefile b/lang/python/django1/Makefile index c7d3bbcf6..db260a208 100644 --- a/lang/python/django1/Makefile +++ b/lang/python/django1/Makefile @@ -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 diff --git a/lang/python/django1/patches/001-load-byte-compiled-db-migrations.patch b/lang/python/django1/patches/001-load-byte-compiled-db-migrations.patch new file mode 100644 index 000000000..e347e5534 --- /dev/null +++ b/lang/python/django1/patches/001-load-byte-compiled-db-migrations.patch @@ -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) |