vp-build/common/environment/setup/python.sh
Alessio Sergi 4e6576e7a4 xbps-src: add support for python3 pkgs
- python_module build style now builds modules for python2/3 by default
- new python2_module and python3_module build styles for building
  python2-only and python3-only packages respectively
- no more python_versions
- no need to define pycompile_version for Python modules anymore
  (still needed for non-Python modules though)
- Python version and paths are now guessed automatically and a set of
  useful variables can now be used in templates
- #!/usr/bin/python2 and #!/usr/bin/python3 are now the default shebangs
- /usr/bin/foo2 and /usr/bin/foo3 are now the default names for bin
  scripts (for use with alternatives)
2016-10-16 16:59:31 +02:00

19 lines
970 B
Bash

#
# Useful variables for determining Python version and paths.
#
__python2="/usr/bin/python2"
__python3="/usr/bin/python3"
if [ -x ${__python2} ]; then
py2_ver="$(${__python2} -c 'import sys; print(sys.version[:3])')"
py2_lib="$(${__python2} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib(0, 1))')"
py2_sitelib="$(${__python2} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
py2_inc="$(${__python2} -c 'from distutils.sysconfig import get_python_inc; print(get_python_inc())')"
fi
if [ -x ${__python3} ]; then
py3_ver="$(${__python3} -c 'import sys; print(sys.version[:3])')"
py3_lib="$(${__python3} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib(0, 1))')"
py3_sitelib="$(${__python3} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
py3_inc="$(${__python3} -c 'from distutils.sysconfig import get_python_inc; print(get_python_inc())')"
fi