summaryrefslogtreecommitdiff
path: root/python/samba/compat.py
Commit message (Collapse)AuthorAgeFilesLines
* python: Port tests of samba.messaging to Python 3 compatible form.Lumir Balhar2017-10-231-0/+5
| | | | | | | | | Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlet <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon Oct 23 15:40:48 CEST 2017 on sn-devel-144
* python: Make top-level samba modules Python 3 compatibleLumir Balhar2017-03-101-0/+22
New file compat.py will help with porting to Python 3. For now, it contains only PY3 variable based on six.PY3 which simplifies condition mentioned below. The added `if not PY3` conditions enable us to bootstrap running tests with Python 3 even if most modules are not ported yet. The plan is to move modules outside this condition as they are ported. The `PY3` condition is currently used only in tests and for the samba._ldb module which is not ported yet and has a lot of dependencies. The other changes are related to differences between Python 2 and 3. Python 2.6 introduced the `0o` prefix for octal literals as an alternative to plain `0`. In Python 3, support for plain `0` is dropped and octal literals have to start with `0o` prefix. Python 2.6 introduced a clearer `except` syntax: `except ExceptionType as target:` instead of `except ExceptionType, target:`. In Python 3, the old syntax is no longer allowed. Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>