mirror of
https://github.com/openwrt/packages.git
synced 2025-12-23 10:14:32 +04:00
django1: Add python3-django1 package
This adds a Python 3 version of the django1 package. This also adds a python-django1-common package that contains a django-admin script based on the one in Debian[1]. This allows python-django1 and python3-django1 to be installed at the same time. python3-django conflicts with python-django1 (via python-django1-common) and python3-django1. This also updates older Python 3 Django plugin packages to depend on python3-django1, and newer plugin packages to depend on "django", which both python3-django and python3-django1 provide. Because of this dependency on either version of Django, the MDEPENDS for Python 3 Django plugin packages no longer functions correctly and has been removed. [1]: https://salsa.debian.org/python-team/modules/python-django/blob/debian/buster/debian/django-admin Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=django1
|
||||
PKG_VERSION:=1.11.28
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PYPI_NAME:=Django
|
||||
PKG_HASH:=b33ce35f47f745fea6b5aa3cf3f4241069803a3712d423ac748bd673a39741eb
|
||||
@@ -22,6 +22,7 @@ PKG_CPE_ID:=cpe:/a:djangoproject:django
|
||||
include ../pypi.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../python-package.mk
|
||||
include ../python3-package.mk
|
||||
|
||||
define Package/django1/Default
|
||||
SUBMENU:=Python
|
||||
@@ -29,27 +30,62 @@ define Package/django1/Default
|
||||
CATEGORY:=Languages
|
||||
TITLE:=The web framework for perfectionists with deadlines.
|
||||
URL:=https://www.djangoproject.com/
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/python-django1
|
||||
$(call Package/django1/Default)
|
||||
DEPENDS:= \
|
||||
+PACKAGE_python-django1:python \
|
||||
+PACKAGE_python-django1:python-pytz
|
||||
+PACKAGE_python-django1:python-pytz \
|
||||
+PACKAGE_python-django1:python-django1-common
|
||||
VARIANT:=python
|
||||
CONFLICTS:=python3-django
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/python-django1/description
|
||||
The web framework for perfectionists with deadlines (LTS 1.11 series).
|
||||
Python2 only.
|
||||
The web framework for perfectionists with deadlines (LTS 1.11 series).
|
||||
endef
|
||||
|
||||
define Package/python3-django1
|
||||
$(call Package/django1/Default)
|
||||
DEPENDS:= \
|
||||
+PACKAGE_python3-django1:python3 \
|
||||
+PACKAGE_python3-django1:python3-pytz \
|
||||
+PACKAGE_python3-django1:python-django1-common
|
||||
VARIANT:=python3
|
||||
PROVIDES:=django
|
||||
endef
|
||||
|
||||
define Package/python3-django1/description
|
||||
$(call Package/python-django1/description)
|
||||
.
|
||||
(Variant for Python3)
|
||||
endef
|
||||
|
||||
define Package/python-django1-common
|
||||
$(call Package/django1/Default)
|
||||
endef
|
||||
|
||||
define Package/python-django1-common/description
|
||||
$(call Package/python-django1/description)
|
||||
.
|
||||
This package contains files common to both Python 2.7 and Python 3.
|
||||
endef
|
||||
|
||||
PyPackage/python-django1/install:=:
|
||||
Py3Package/python3-django1/install:=:
|
||||
|
||||
define Package/python-django1-common/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) ./files/django-admin $(1)/usr/bin
|
||||
endef
|
||||
|
||||
$(eval $(call PyPackage,python-django1))
|
||||
define Package/python-django1-src +=
|
||||
|
||||
MDEPENDS:=python-django1
|
||||
endef
|
||||
$(eval $(call BuildPackage,python-django1))
|
||||
$(eval $(call BuildPackage,python-django1-src))
|
||||
|
||||
$(eval $(call Py3Package,python3-django1))
|
||||
$(eval $(call BuildPackage,python3-django1))
|
||||
$(eval $(call BuildPackage,python3-django1-src))
|
||||
|
||||
$(eval $(call BuildPackage,python-django1-common))
|
||||
|
||||
23
lang/python/django1/files/django-admin
Normal file
23
lang/python/django1/files/django-admin
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
shell_code=''' '
|
||||
# shell code
|
||||
if command -v python3.8 > /dev/null && test -e /usr/lib/python3.8/site-packages/django/bin/django-admin.pyc
|
||||
then
|
||||
exec python3.8 "$0" "$@"
|
||||
elif command -v python2.7 > /dev/null && test -e /usr/lib/python2.7/site-packages/django/bin/django-admin.pyc
|
||||
then
|
||||
exec python2.7 "$0" "$@"
|
||||
else
|
||||
echo "Cannot find installed version of python-django1 or python3-django1." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python_code='''
|
||||
# python code
|
||||
# ONLY use DOUBLE quotes <"> after this line
|
||||
from django.core import management
|
||||
|
||||
if __name__ == "__main__":
|
||||
management.execute_from_command_line()
|
||||
|
||||
# End of Python code. Do not modify this line. #'
|
||||
Reference in New Issue
Block a user