[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /usr/bin/django-admin in python-django



* Brian May <brian@microcomaustralia.com.au>, 2014-07-20, 11:47:
Or, another words, ideally we want all these to work:

python2 /usr/bin/django-admin - python2
python3 /usr/bin/django-admin - python3
/usr/bin/django-admin - autodetect.

One possibility is to write a shell script that is also valid Python code. PoC:

#!/bin/sh
sh=''''
if command -v python3 > /dev/null; then
	exec python3 "$0" "$@"
else
	exec python "$0" "$@"
fi
' '''
import sys
print("I'm Python %d.%d!" % sys.version_info[:2])


Another possibility is to create the django-admin symlink in maintainer scripts, with the target depending on which of python*-django packages are installer. This is how src:sphinx manages its /usr/bin/sphinx-* symlinks.

--
Jakub Wilk


Reply to: