Pretty much all of the scripts are python2+3 compatible.
Check and allow using python3, while adjusting the PYTHON2 refs.
Note:
- python3.4 is used as it's the earliest supported version
- python2 chosen prior to python3
v2: use python2 by default
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
AC_PROG_NM
AM_PROG_AS
AX_CHECK_GNU_MAKE
-AM_PATH_PYTHON([2.7],, [:])
-PYTHON2=$PYTHON
-AC_SUBST([PYTHON2])
+AM_PATH_PYTHON([2.7],, [AM_PATH_PYTHON([3.4],, [:])])
AC_PROG_SED
AC_PROG_MKDIR_P
AX_CHECK_PYTHON_MAKO_MODULE($PYTHON_MAKO_REQUIRED)
-if test "$PYTHON2" = ":"; then
+if test "$PYTHON" = ":"; then
if test ! -f "$srcdir/src/util/format_srgb.c"; then
AC_MSG_ERROR([Python not found - unable to generate sources])
fi
echo " LLVM_LDFLAGS: $LLVM_LDFLAGS"
echo ""
fi
-echo " PYTHON2: $PYTHON2"
+echo " PYTHON: $PYTHON"
echo ""
echo " Run '${MAKE-make}' to build Mesa"
ver_req = distutils.version.LooseVersion('$1')
ver_act = distutils.version.LooseVersion(mako.__version__)
sys.exit(int(ver_req > ver_act))
- " | $PYTHON2 -
+ " | $PYTHON -
if test $? -ne 0 ; then
AC_MSG_RESULT(no)
.PHONY: git_sha1.h
git_sha1.h:
@echo "updating $@"
- @$(PYTHON2) $(top_srcdir)/bin/git_sha1_gen.py --output $@
+ @$(PYTHON) $(top_srcdir)/bin/git_sha1_gen.py --output $@
BUILT_SOURCES = git_sha1.h
CLEANFILES = $(BUILT_SOURCES)
common/sid_tables.h: $(srcdir)/common/sid_tables.py $(srcdir)/common/sid.h $(srcdir)/common/gfx9d.h
$(AM_V_at)$(MKDIR_P) $(@D)
- $(AM_V_GEN) $(PYTHON2) $(srcdir)/common/sid_tables.py $(srcdir)/common/sid.h $(srcdir)/common/gfx9d.h > $@
+ $(AM_V_GEN) $(PYTHON) $(srcdir)/common/sid_tables.py $(srcdir)/common/sid.h $(srcdir)/common/gfx9d.h > $@
BUILT_SOURCES = $(AMD_GENERATED_FILES)
radv_entrypoints.c: radv_entrypoints_gen.py radv_extensions.py $(vulkan_api_xml)
$(MKDIR_GEN)
- $(AM_V_GEN)$(PYTHON2) $(srcdir)/radv_entrypoints_gen.py \
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/radv_entrypoints_gen.py \
--xml $(vulkan_api_xml) \
--outdir $(builddir)
radv_entrypoints.h: radv_entrypoints.c
radv_extensions.c: radv_extensions.py \
$(vulkan_api_xml)
$(MKDIR_GEN)
- $(AM_V_GEN)$(PYTHON2) $(srcdir)/radv_extensions.py \
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/radv_extensions.py \
--xml $(vulkan_api_xml) \
--out-c radv_extensions.c \
--out-h radv_extensions.h
vk_format_table.c: vk_format_table.py \
vk_format_parse.py \
vk_format_layout.csv
- $(PYTHON2) $(srcdir)/vk_format_table.py $(srcdir)/vk_format_layout.csv > $@
+ $(PYTHON) $(srcdir)/vk_format_table.py $(srcdir)/vk_format_layout.csv > $@
BUILT_SOURCES = $(VULKAN_GENERATED_FILES)
CLEANFILES = $(BUILT_SOURCES) dev_icd.json radeon_icd.@host_cpu@.json
noinst_DATA = dev_icd.json
dev_icd.json : radv_extensions.py radv_icd.py
- $(AM_V_GEN)$(PYTHON2) $(srcdir)/radv_icd.py \
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/radv_icd.py \
--lib-path="${abs_top_builddir}/${LIB_DIR}" --out $@
radeon_icd.@host_cpu@.json : radv_extensions.py radv_icd.py
- $(AM_V_GEN)$(PYTHON2) $(srcdir)/radv_icd.py \
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/radv_icd.py \
--lib-path="${libdir}" --out $@
include $(top_srcdir)/install-lib-links.mk
qpu/meson.build
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
include Makefile.genxml.am
include Makefile.cle.am
meson.build
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
include Makefile.spirv.am
TESTS_ENVIRONMENT= \
export abs_builddir=$(abs_builddir); \
- export PYTHON2=$(PYTHON2); \
+ export PYTHON=$(PYTHON); \
export PYTHON_FLAGS=$(PYTHON_FLAGS);
check_PROGRAMS += \
abs_builddir=`pwd`/../../../
fi
-$PYTHON2 $srcdir/glsl/glcpp/tests/glcpp_test.py $abs_builddir/glsl/glcpp/glcpp $srcdir/glsl/glcpp/tests --unix --windows --oldmac --bizarro
+$PYTHON $srcdir/glsl/glcpp/tests/glcpp_test.py $abs_builddir/glsl/glcpp/glcpp $srcdir/glsl/glcpp/tests --unix --windows --oldmac --bizarro
#!/bin/sh
-$PYTHON2 $srcdir/glsl/tests/optimization_test.py --test-runner $abs_builddir/glsl/glsl_test
+$PYTHON $srcdir/glsl/tests/optimization_test.py --test-runner $abs_builddir/glsl/glsl_test
#!/bin/sh
-$PYTHON2 $srcdir/glsl/tests/warnings_test.py --glsl-compiler $abs_builddir/glsl_compiler --test-directory $srcdir/glsl/tests/warnings/
+$PYTHON $srcdir/glsl/tests/warnings_test.py --glsl-compiler $abs_builddir/glsl_compiler --test-directory $srcdir/glsl/tests/warnings/
generate/egl.xml generate/eglFunctionList.py generate/genCommon.py \
generate/egl_other.xml
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
g_egldispatchstubs.c: $(GLVND_GEN_DEPS)
$(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py source \
$(top_srcdir)/src/egl/generate/eglFunctionList.py \
endif
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
indices/u_indices_gen.c: indices/u_indices_gen.py
$(MKDIR_GEN)
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
ir3/ir3_nir_trig.c: ir3/ir3_nir_trig.py $(top_srcdir)/src/compiler/nir/nir_algebraic.py
$(MKDIR_GEN)
- $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/ir3/ir3_nir_trig.py -p $(top_srcdir)/src/compiler/nir > $@ || ($(RM) $@; false)
+ $(AM_V_GEN) $(PYTHON) $(PYTHON_FLAGS) $(srcdir)/ir3/ir3_nir_trig.py -p $(top_srcdir)/src/compiler/nir > $@ || ($(RM) $@; false)
noinst_LTLIBRARIES = libfreedreno.la
egd_tables.h: $(srcdir)/egd_tables.py $(srcdir)/evergreend.h
$(AM_V_at)$(MKDIR_P) $(@D)
- $(AM_V_GEN) $(PYTHON2) $(srcdir)/egd_tables.py $(srcdir)/evergreend.h > $@
+ $(AM_V_GEN) $(PYTHON) $(srcdir)/egd_tables.py $(srcdir)/evergreend.h > $@
BUILT_SOURCES = $(R600_GENERATED_FILES)
AM_CFLAGS = \
$(top_srcdir)/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h \
$(srcdir)/driinfo_radeonsi.h
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
MERGE_DRIINFO = $(top_srcdir)/src/util/merge_driinfo.py
si_driinfo.h: $(MERGE_DRIINFO) $(GEN_DRIINFO_INPUTS)
rasterizer/core/backends/gen_rasterizer.hpp
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
gen_swr_context_llvm.h: rasterizer/codegen/gen_llvm_types.py rasterizer/codegen/templates/gen_llvm.hpp swr_context.h
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_llvm_types.py \
$(VISIBILITY_CXXFLAGS)
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
lib_LTLIBRARIES =
check_LTLIBRARIES =
compiler/brw_nir_trig_workarounds.c: compiler/brw_nir_trig_workarounds.py \
$(top_srcdir)/src/compiler/nir/nir_algebraic.py
$(MKDIR_GEN)
- $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/compiler/brw_nir_trig_workarounds.py -p $(top_srcdir)/src/compiler/nir > $@ || ($(RM) $@; false)
+ $(AM_V_GEN) $(PYTHON) $(PYTHON_FLAGS) $(srcdir)/compiler/brw_nir_trig_workarounds.py -p $(top_srcdir)/src/compiler/nir > $@ || ($(RM) $@; false)
EXTRA_DIST += \
compiler/brw_nir_trig_workarounds.py
vulkan/anv_extensions.py \
$(vulkan_api_xml)
$(MKDIR_GEN)
- $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_entrypoints_gen.py \
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/vulkan/anv_entrypoints_gen.py \
--xml $(vulkan_api_xml) \
--outdir $(builddir)/vulkan
vulkan/anv_entrypoints.h: vulkan/anv_entrypoints.c
vulkan/anv_extensions.py \
$(vulkan_api_xml)
$(MKDIR_GEN)
- $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_extensions_gen.py \
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/vulkan/anv_extensions_gen.py \
--xml $(vulkan_api_xml) \
--out-c $@
vulkan/anv_extensions.py \
$(vulkan_api_xml)
$(MKDIR_GEN)
- $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_extensions_gen.py \
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/vulkan/anv_extensions_gen.py \
--xml $(vulkan_api_xml) \
--out-h $@
vulkan/dev_icd.json : vulkan/anv_extensions.py vulkan/anv_icd.py
$(MKDIR_GEN)
- $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_icd.py \
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/vulkan/anv_icd.py \
--lib-path="${abs_top_builddir}/${LIB_DIR}" --out $@
vulkan/intel_icd.@host_cpu@.json : vulkan/anv_extensions.py vulkan/anv_icd.py
$(MKDIR_GEN)
- $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_icd.py \
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/vulkan/anv_icd.py \
--lib-path="${libdir}" --out $@
if HAVE_INTEL_VULKAN
include Makefile.sources
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
glapi_gen_mapi_deps := \
mapi_abi.py \
COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
######################################################################
$(BUILT_SOURCES) \
program/program_parse.tab.h
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
main/get_hash.h: ../mapi/glapi/gen/gl_and_es_API.xml main/get_hash_params.py \
main/get_hash_generator.py
meson.build
brw_oa_metrics.c: brw_oa.py $(i965_oa_xml_FILES)
- $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/brw_oa.py \
+ $(PYTHON) $(PYTHON_FLAGS) $(srcdir)/brw_oa.py \
--code=$(builddir)/brw_oa_metrics.c \
--header=$(builddir)/brw_oa_metrics.h \
$(i965_oa_xml_FILES:%=$(srcdir)/%)
sha1/README \
meson.build
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
format_srgb.c: format_srgb.py
$(PYTHON_GEN) $(srcdir)/format_srgb.py > $@
# Default target options.h
LOCALEDIR := .
options.h: t_options.h $(MOS)
- $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/gen_xmlpool.py $(srcdir)/t_options.h $(LOCALEDIR) $(LANGS) > options.h
+ $(AM_V_GEN) $(PYTHON) $(PYTHON_FLAGS) $(srcdir)/gen_xmlpool.py $(srcdir)/t_options.h $(LOCALEDIR) $(LANGS) > options.h
# Update .mo files from the corresponding .po files.
%/LC_MESSAGES/options.mo: %.po
vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
EXTRA_DIST = \
util/gen_enum_to_str.py \