[Samba] Samba4 with python2.7 and python3
Paul Kölle
paul at subsignal.org
Mon Jan 17 09:36:22 MST 2011
Am 15.01.2011 00:57, schrieb Ng Oon-Ee:
[ snipp... ]
> I recall from my distro ML that there's no 'accepted' way of dealing
> with this, we're pioneering it in some sense. From a user's perspective,
> simply 'assuming' that python = python2 doesn't make much sense,
> especially when the software will not compile with python3.
Since there is no standard (this is linux after all) it's pretty hard to
fix it cross-platform. IMO, your code below will break debian as it has
python[major].[minor] i.e. /usr/bin/python2.5
I assume Arch *does* link some python version to /usr/bin/python, so the
only thing samba has to do is check version and abort if it's not 2.x
PY_VER=$(python -c "import sys; print sys.version.split()[0]")
or from a .py file:
import sys
major, minor, patch = sys.version.split()[0].split('.')
cheers
Paul
>
> In any case, here's the sed lines I used. Some could probably be tweaked
> further, but I've got an AGM to attend in a moment, sorry. For
> reference, 'srcdir' and '_realver' are env variables (in my case they
> contain the path to the samba4 source and the version 4.0.0alpha13.
>
> sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \
> -e "s|python-config|python2-config|" \
> -e "s|bin/python|bin/python2|" \
> $(find ${srcdir}/samba-${_realver} -name '*.py')
> sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \
> $(find ${srcdir}/samba-${_realver} -name 'wscript*')
> sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \
> -e "s|python-config|python2-config|" \
> -e "s|bin/python|bin/python2|" \
> $(find ${srcdir}/samba-${_realver} -name 'configure.ac')
> sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \
> $(find ${srcdir}/samba-${_realver} -name 'upgrade_from_s3')
> sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \
> $(find ${srcdir}/samba-${_realver} -name 'provision')
> sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \
> -e "s|python-config|python2-config|" \
> -e "s|bin/python|bin/python2|" \
> $(find ${srcdir}/samba-${_realver}/buildtools -type f)
> sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \
> -e "s|python-config|python2-config|" \
> -e "s|bin/python|bin/python2|" \
> $(find ${srcdir}/samba-${_realver}/source4/scripting -type f)
> export PYTHON=/usr/bin/python2
>
>
>
More information about the samba-technical
mailing list