configure: don't assume python3, create $PYTHON var.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Vincenzo Palazzo
parent
8e2e7b1c51
commit
e3b1549b64
8
Makefile
8
Makefile
@@ -368,7 +368,7 @@ ifneq ($(RUST),0)
|
||||
include cln-grpc/Makefile
|
||||
|
||||
$(MSGGEN_GENALL)&: doc/schemas/*.request.json doc/schemas/*.schema.json
|
||||
PYTHONPATH=contrib/msggen python3 contrib/msggen/msggen/__main__.py
|
||||
PYTHONPATH=contrib/msggen $(PYTHON) contrib/msggen/msggen/__main__.py
|
||||
|
||||
# The compiler assumes that the proto files are in the same
|
||||
# directory structure as the generated files will be. Since we
|
||||
@@ -384,8 +384,8 @@ GRPC_GEN = \
|
||||
ALL_TEST_GEN += $(GRPC_GEN)
|
||||
|
||||
$(GRPC_GEN)&: cln-grpc/proto/node.proto cln-grpc/proto/primitives.proto
|
||||
python3 -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/node.proto --python_out=$(GRPC_PATH)/ --grpc_python_out=$(GRPC_PATH)/ --experimental_allow_proto3_optional
|
||||
python3 -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/primitives.proto --python_out=$(GRPC_PATH)/ --experimental_allow_proto3_optional
|
||||
$(PYTHON) -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/node.proto --python_out=$(GRPC_PATH)/ --grpc_python_out=$(GRPC_PATH)/ --experimental_allow_proto3_optional
|
||||
$(PYTHON) -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/primitives.proto --python_out=$(GRPC_PATH)/ --experimental_allow_proto3_optional
|
||||
find $(GRPC_DIR)/ -type f -name "*.py" -print0 | xargs -0 sed -i'.bak' -e 's/^import \(.*\)_pb2 as .*__pb2/from pyln.grpc import \1_pb2 as \1__pb2/g'
|
||||
find $(GRPC_DIR)/ -type f -name "*.py.bak" -delete
|
||||
endif
|
||||
@@ -421,7 +421,7 @@ mkdocs.yml: $(MANPAGES:=.md)
|
||||
find doc -maxdepth 1 -name '*\.[0-9]\.md' | \
|
||||
cut -b 5- | LC_ALL=C sort | \
|
||||
sed 's/\(.*\)\.\(.*\).*\.md/- "\1": "\1.\2.md"/' | \
|
||||
python3 devtools/blockreplace.py mkdocs.yml manpages --language=yml --indent " " \
|
||||
$(PYTHON) devtools/blockreplace.py mkdocs.yml manpages --language=yml --indent " " \
|
||||
)
|
||||
|
||||
|
||||
|
||||
34
configure
vendored
34
configure
vendored
@@ -69,11 +69,25 @@ default_cwarnflags()
|
||||
echo "$F"
|
||||
}
|
||||
|
||||
default_python()
|
||||
{
|
||||
PYTHON_BINS="python3 python"
|
||||
for p in $PYTHON_BINS; do
|
||||
if [ "$(which $p)" != "" ] ; then
|
||||
if $p --version 2>&1 | grep -q "Python 3."; then
|
||||
echo "$p"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Takes PYTHON var
|
||||
default_pytest()
|
||||
{
|
||||
# Since we just checked that we have python3 we give that one the
|
||||
# most priority and then fall back to some common aliases.
|
||||
PYTEST_BINS="python3 -m pytest,pytest,py.test,pytest3,pytest-3"
|
||||
PYTEST_BINS="$1 -m pytest,pytest,py.test,pytest3,pytest-3"
|
||||
IFS=','
|
||||
for p in $PYTEST_BINS; do
|
||||
# If it is a combined command such as `python3 -m pytest` we
|
||||
@@ -87,16 +101,10 @@ default_pytest()
|
||||
fi
|
||||
done
|
||||
|
||||
PYTHON_BINS="python python3"
|
||||
for p in $PYTHON_BINS; do
|
||||
if [ "$(which $p)" != "" ] ; then
|
||||
$p --version 2>&1 | grep -q "Python 3." || continue
|
||||
if $p -c "import pytest" 2>/dev/null ; then
|
||||
echo "$p -m pytest"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if $1 -c "import pytest" 2>/dev/null; then
|
||||
echo "$1 -m pytest"
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
check_command()
|
||||
@@ -170,7 +178,8 @@ set_defaults()
|
||||
CSANFLAGS="$CSANFLAGS $FUZZFLAGS"
|
||||
fi
|
||||
echo CSANFLAGS = $CSANFLAGS
|
||||
PYTEST=${PYTEST-$(default_pytest)}
|
||||
PYTHON=${PYTHON-$(default_python)}
|
||||
PYTEST=${PYTEST-$(default_pytest $PYTHON)}
|
||||
COPTFLAGS=${COPTFLAGS-$(default_coptflags "$DEBUGBUILD")}
|
||||
CONFIGURATOR_CC=${CONFIGURATOR_CC-$CC}
|
||||
VALGRIND=${VALGRIND:-$(default_valgrind_setting)}
|
||||
@@ -526,6 +535,7 @@ add_var HAVE_LOWDOWN "$HAVE_LOWDOWN"
|
||||
add_var SHA256SUM "$SHA256SUM"
|
||||
add_var FUZZING "$FUZZING"
|
||||
add_var RUST "$RUST"
|
||||
add_var PYTHON "$PYTHON"
|
||||
|
||||
# Hack to avoid sha256 name clash with libwally: will be fixed when that
|
||||
# becomes a standalone shared lib.
|
||||
|
||||
@@ -235,7 +235,7 @@ doc/index.rst: $(MANPAGES:=.md)
|
||||
find doc -maxdepth 1 -name '*\.[0-9]\.md' | \
|
||||
cut -b 5- | LC_ALL=C sort | \
|
||||
sed "s/\(.*\)\.\(.*\).*\.md/\1 <\1.\2.md>/" | \
|
||||
python3 devtools/blockreplace.py doc/index.rst manpages --language=rst --indent " " \
|
||||
$(PYTHON) devtools/blockreplace.py doc/index.rst manpages --language=rst --indent " " \
|
||||
)
|
||||
|
||||
# Overridden by GH CI if necessary.
|
||||
|
||||
Reference in New Issue
Block a user