1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

55 Commits

Author SHA1 Message Date
Andrew Bartlett
5950fc66e0 build: Make Python 3.6 the minimum to build now oss-fuzz is upgraded
The exception to allow building, but not operating, with Python 3.5
was only because oss-fuzz provided only Python 3.5 on Ubuntu 16.04.

Ubuntu 20.04 is now the base image provided, so this exception can
be removed.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2021-09-13 04:53:32 +00:00
Andrew Bartlett
40511af091 build: Remove Python2 handling in SAMBA_CHECK_PYTHON_HEADERS()
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2020-10-01 01:18:38 +00:00
Andrew Bartlett
3e48825507 build: Remove Python2 support from the build
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14488

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2020-10-01 01:18:38 +00:00
Andrew Bartlett
ee5c07cb0f build: Allow a fuzzing build with Python 3.5
The Python 3.6 changes are only in actual .py files, not in the build system
nor the C side of things, so relax this so we can still build on oss-fuzz
which is based on Ubuntu 16.04 for now.

REF: https://github.com/google/oss-fuzz/issues/3505
REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21189

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2020-03-19 20:46:42 +00:00
Andrew Bartlett
609c990347 Require Python 3.6 for Samba 4.13
This allows Samba to use formatted string literals, which
are quite handy.

REF: https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-pep498

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-09 22:03:26 +00:00
Andrew Bartlett
96184c10b8 build: Skip build of python bindings when in fuzzing mode
This will just save a bit of time and space.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-12-10 07:50:29 +00:00
Andrew Bartlett
b76bf7afd0 build: Raise minimum python version to 3.5.0 for Samba 4.12
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Sep  2 01:14:05 UTC 2019 on sn-devel-184
2019-09-02 01:14:05 +00:00
Andrew Bartlett
a574e8f517 build: Standardise on calling conf.SAMBA_CHECK_PYTHON() in libraries
We do this by removing the confusing mandatory option to
conf.SAMBA_CHECK_PYTHON{,_HEADERS}(), instead just use the value of
--disable-python internally

This follows the default minimum of Python 3.4 and keeps things consistent
with the main Samba build where --disable-python is required to skip building
python bindings.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-03-21 04:06:16 +00:00
Andrew Bartlett
63d20d7822 build: Set default minimum python version to 3.4.0
This is the current minimum, but this may change before the 4.11 release.

Python 2.x support is no longer available except to build using --disable-python.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-03-21 04:06:15 +00:00
Andrew Bartlett
760b176d86 build: Do not make python mandatory to build
Clearly we have python or else we would not be running, so this is about if
we have a new enough version.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-03-21 04:06:15 +00:00
Andrew Bartlett
fdb6305c86 build: Remove bld.gen_python_environments()
This was part of --extra-python support.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-03-21 04:06:14 +00:00
Andrew Bartlett
270d04e4ea build: Remove --extra-python
This option is quite invasive in waf and was mainly for the python3 transition.

Testing with multiple python versions can be done by testing a full compile against
multiple versions, likewise multiple different binding versions can be created
the same way.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-03-21 04:06:14 +00:00
Andrew Bartlett
90f0460c69 buildtools/wafsamba: Ensure default python picked up is python3
1) set the default python searched for samba waf to be python3
2) remove default setting of PYTHON variable if not defined (not needed)

Signed-off-by: Noel Power <npower@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-14 00:51:33 +01:00
Noel Power
bae5364bf3 buildtools/wafsamba: re-write shebang for delivered python scripts
Can't see how the orig code would have worked though
a)
  task.env["PYTHON"] is a list
b) task.env["PYTHON_SPECIFIED"] can (and is in our case false) looks
   like it would only be true for python2 but in anycase no harm we
   always rewrite the shebang

So now it works as follows,

1. PYTHON (which is where the shebang is got) is set to python3 by default
2. To override the default you need to set PYTHON (e.g. to build with python2)
3. If you give a full path in PYTHON then shebang is of the format
   "#!{FULL_PYTHON_INTERPRETER_PATH)
4. If you specify PYTHON=python or PYTHON=python2 etc. shebang format is
   "#!!/usr/bin/env python", "#!!/usr/bin/env python2" etc.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-14 00:51:33 +01:00
Noel Power
2fb74e6ad3 buildtools/wafsamba: Support --extra-python with python2
Relax restriction on extra_python version

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-10 10:38:25 +01:00
Noel Power
19ac50ba2d buildtools/wafsamba: Ensure we detect the correct python.
In order to support a default python3 build we need to ensure
we detect python3 if no PYTHON env variable is set up.

Currently we detect python with

conf.find_program('python', var='PYTHON', mandatory=mandatory)

which uses PYTHON as as hint and falls back to the program name
'python' otherwise

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-10 10:38:25 +01:00
Alexander Bokovoy
31f8945aa6 wafsamba: install Python modules back to bin/python, not bin/python_modules
Partially revert 80fce353e7 which started
installing generated Python modules into python_modules directory back
in 2013. This, unfortunately, does not work anymore as Python gets quite
confused with our setup even when both bin/python and bin/python_modules
directories are part of sys.path.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-05 06:37:27 +02:00
Alexander Bokovoy
4e65b33c1d third_party:waf: update to upstream 2.0.4 release
Update third_party/waf/ to 2.0.4 to bring us closer to Python 3

This change requires a number of changes in buildtools/ too.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-05 06:37:22 +02:00
Thomas Nagy
8077f462c9 build:wafsamba: Build on waf 1.9
Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-05 06:37:21 +02:00
Uri Simchoni
2606c99ed3 build: allow adding cflags to end of python module build command
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-11-22 10:20:20 +01:00
Stefan Metzmacher
d1b88c6a6e wafsamba: move -L/some/path from LINKFLAGS_PYEMBED to LIBPATH_PYEMBED
LINKFLAGS should not have path components.

This fixes the build on systems like FreeBSD where python
is located in /usr/local/lib.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12724

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Apr  4 16:10:18 CEST 2017 on sn-devel-144
2017-04-04 16:10:18 +02:00
Ian Stakenvicius
5bbcd09382 waf: disable-python - add option globally to build system
This commit adds --disable-python as an option to the build system.
It adds PYTHON_BUILD_IS_ENABLED() to bld, to be used with enabled=
on other modules, and adjusts SAMBA_PYTHON() to set enabled=False
if PYTHON_BUILD_IS_ENABLED() is false.

Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-03-10 07:31:12 +01:00
Andrew Bartlett
f5cafee0c7 talloc: use the system pytalloc-util for python3 as well
This involves installing a .pc file for the python3 library as well

To get the .pc file generated and installed is quite a mission, we
have to rework the talloc build system to ensure that the second 'env'
created for EXTRA_PYTHON has everything set up on it, the
TALLOC_VERSION in particular.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

Incorportaing fixes by Petr Viktorin <pviktori@redhat.com>

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
2017-03-10 07:31:10 +01:00
Andrew Bartlett
78e9f1effb build: Add space before -D option
This ensures that it is not concatonated with the previous option

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jan  8 02:36:47 CET 2016 on sn-devel-144
2016-01-08 02:36:47 +01:00
Andrew Bartlett
46b8d7fc52 python: Assert that we use Py_ssize_t consistently for PyParseArgs*()
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2016-01-07 23:33:10 +01:00
Thomas Nagy
db99742d8b build:wafsamba: Waf 1.8 compatible declaration of 'mandatory' configuration tests
The configuration tests raise exceptions by default in later Waf versions,
but the samba tests do not specify whether the errors should be raised or
not. This changes lifts the ambiguity.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Nov 16 14:50:39 CET 2015 on sn-devel-104
2015-11-16 14:50:38 +01:00
Thomas Nagy
2666d06f29 build:wafsamba: removed most import * statements
The 'import *' statements make it more difficult to reason about
the modules and tends to conceal bugs. These changes enable running
pyflakes against most of the build scripts.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
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): Wed Oct 28 12:52:17 CET 2015 on sn-devel-104
2015-10-28 12:52:17 +01:00
Petr Viktorin
5090d491af buildtools: Fix crash on invalid --extra-python option
Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-07-21 19:04:15 +02:00
Petr Viktorin
5a4e5d7cbf buildtools: Don't configure Python more than once
Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-07-21 19:04:14 +02:00
Thomas Nagy
21f98e58da Remove PYTHONDIR and PYTHONARCHDIR in a single place 2015-06-26 02:10:12 +02:00
Stefan Metzmacher
86671dbd9f wafsamba: remove unused allow_warnings=True from SAMBA_PYTHON()
This is not needed anymore all python bindings build without wawrnings now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-06-12 17:08:20 +02:00
Petr Viktorin
91b407fc94 buildtools: Add a helper for running Python tests
Add the function samba_utils.RUN_PYTHON_TESTS for running a Python
test. When building for multiple Python versions, all are tested.

Also, add the list of configured Python interpreters to build config.

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-05-19 19:28:19 +02:00
Petr Viktorin
6f490000c6 buildtools: Add a helper to iterate through Python environments
This prevents code duplication to ensure the "extrapython" build
is the same as the normal one.

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-05-19 19:28:19 +02:00
Petr Viktorin
616dfae8ff buildtools: Add --extra-python configure option
This allows building Python support for two different Python versions
at the same time.

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-05-19 19:28:18 +02:00
Petr Viktorin
13a91e5427 buildtools: Expose the Python 3 ABI tag
Expose the tag in the env to allow using it in pkg-config files

Add a "pyembed_libname" function to correctly form library names.
(This can't be done automatically in SAMBA_LIBRARY because the name
could be used as a dependency for another library)

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-05-19 19:28:18 +02:00
Petr Viktorin
50311c7606 wafsamba: Add install argument to SAMBA_PYTHON
This allows building Python modules that are only used for testing.

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-By: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2015-04-24 01:50:11 +02:00
Stefan Metzmacher
e1ec1f5d8d wafsamba: explicitly use allow_warnings=True for SAMBA_PYTHON()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Apr  2 11:04:36 CEST 2014 on sn-devel-104
2014-04-02 11:04:36 +02:00
Andrew Bartlett
7955bf473f build: Raise minimum python version to 2.5.0 for samba build
RHEL5 has a python26 package for a modern python, and was the main reason we
kept python 2.5 support.

However, this support never actually worked for AD DC installations,
as samba-tool uses a feature only in 2.5 and above.  Very few folks
noticed and those were on RHEL5, and moving to 2.5 allows us to remove
some other workarounds.

Andrew Bartlett

Reviewed-by: Matthieu Patou <mat@matws.net>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-04-11 16:44:46 +10:00
Andrew Bartlett
58e3c5323e build: Replace #!/usr/bin/env python with passed in PYTHON=
This means that if we were forced to use a specific python for the build, we
will put that binary into the top of samba-tool, so it continues to work
after the install.

Andrew Bartlett

Reviewed-by: Michael Adam <obnox@samba.org>
2013-04-10 00:13:45 +02:00
Andrew Bartlett
80fce353e7 build: Change bin/default/python -> bin/python symlink to bin/default/python_modules
This avoids a collision with the new top level python directory.

Andrew Bartlett
2013-03-02 02:16:52 +01:00
Simo Sorce
e21029a270 waf: Fix mispelling
Autobuild-User: Simo Sorce <idra@samba.org>
Autobuild-Date: Thu Apr 19 17:36:41 CEST 2012 on sn-devel-104
2012-04-19 17:36:41 +02:00
Jelmer Vernooij
af5c6fba68 waf: Simplify handling of python modules. 2011-11-13 18:06:06 +01:00
Jelmer Vernooij
312fd94002 waf: Don't link python modules against libpython2.x, consistent with other Python modules.
Rather, rely just on waf's pyext feature. This fixes a warning from dh_python2.
2011-11-13 18:06:06 +01:00
Andrew Tridgell
46a3588d3f waf: use PYTHONARCHDIR for installing python shared libs
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Fri Jan 14 08:19:40 CET 2011 on sn-devel-104
2011-01-14 08:19:39 +01:00
Matthieu Patou
8733738357 build: introduce SAMBA_CHECK_PYTHON_HEADERS
This function is a wrapper around waf's check_python_header.
It avoids searching more than once for the headers bringing a small
speed improvement and a better lisibility of the logs.

But it's mainly to avoid a nasty bug when python libraries are in path
pointed by python_LIBPL (ie. /usr/local/lib/python2.6/config/) instead
of python_LIBDIR (ie. /usr/local/lib).

On the first call waf will correctly find that in order to link with
python libs it needs to add -L$python_LIBPL.

But on the next calls of check_python_headers, waf will use both the
current library path value (ie. -L/usr/local/lib/python2.6/config) and
-L$python_LIBDIR (ie. /usr/local/lib/) which will make him beleive that
python libraries are in $python_LIBDIR which at the end will make the
final link test fails in check_python_headers as it will not use the
good directory.

So by avoiding calling check_python_headers more than once we avoid
making waf fooling itself.
2010-12-10 02:07:18 +03:00
Jelmer Vernooij
c15e919a09 wafsamba: Clarify needs_python argument name, use pyembed/pyext where
applicable.

Allow using both pyembed and pyext, to prevent unresolved symbols.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sun Oct 10 03:54:01 UTC 2010 on sn-devel-104
2010-10-10 03:54:01 +00:00
Andrew Tridgell
6dbf576e81 build: only link install targets at install time 2010-04-06 20:27:22 +10:00
Andrew Tridgell
d87b77e649 build: reuse SAMBA_LIBRARY() to build python modules
This allows the rpath logic to be shared, and simplifies the install
logic
2010-04-06 20:27:15 +10:00
Andrew Tridgell
c64ce3cd03 build: mark python rules as being part of the "main" group 2010-04-06 20:27:11 +10:00
Andrew Tridgell
307ac977a2 build: install build python modules correctly 2010-04-06 20:27:09 +10:00