[Python-modules-commits] r29834 - in packages/python-django/trunk/debian (django-admin)

bam at users.alioth.debian.org bam at users.alioth.debian.org
Mon Jul 21 00:18:28 UTC 2014


    Date: Monday, July 21, 2014 @ 00:18:27
  Author: bam
Revision: 29834

Replace django-admin with script that can be run with Python or Shell.

Modified:
  packages/python-django/trunk/debian/django-admin

Modified: packages/python-django/trunk/debian/django-admin
===================================================================
--- packages/python-django/trunk/debian/django-admin	2014-07-20 19:44:43 UTC (rev 29833)
+++ packages/python-django/trunk/debian/django-admin	2014-07-21 00:18:27 UTC (rev 29834)
@@ -1,12 +1,18 @@
 #!/bin/sh
-
-if test -x /usr/bin/python3 && test -e /usr/lib/python3/dist-packages/django/bin/django-admin.py
-then
-    exec python3 /usr/lib/python3/dist-packages/django/bin/django-admin.py "$@"
-elif test -x /usr/bin/python2.7 && test -e /usr/lib/python2.7/dist-packages/django/bin/django-admin.py
-then
-    exec python2.7 /usr/lib/python2.7/dist-packages/django/bin/django-admin.py "$@"
+sh=''''
+# shell code
+if command -v python3 > /dev/null; then
+        exec python3 "$0" "$@"
 else
-    echo "Cannot find installed version of python-django or python3-django." >&2
-    exit 1
+        exec python "$0" "$@"
 fi
+' '''
+
+# python code
+import sys
+print("Using: Python %d.%d" % sys.version_info[:2])
+
+from django.core import management
+
+if __name__ == "__main__":
+    management.execute_from_command_line()




More information about the Python-modules-commits mailing list