From be2759b2d842f5edf87ce3e8b9e462306efe466e Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Wed, 18 Sep 2024 15:27:43 -0700 Subject: [PATCH] Make the extension makefiles closer to being able to build against a nightly (#7768) Get the makefile to do it by making PYTHON configurable and invoking `edb config` via `$(PYTHON) -m edb.tools`. It doesn't actually work though, because the bundled postgres doesn't include the development headers. --- edb/tools/config.py | 7 +++++-- tests/extension-testing/ext_test/Makefile | 7 +++++++ tests/extension-testing/exts.mk | 10 +++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/edb/tools/config.py b/edb/tools/config.py index 7e821439fe7..20cb2a28a7e 100644 --- a/edb/tools/config.py +++ b/edb/tools/config.py @@ -23,6 +23,7 @@ import click from edb import buildmeta +from edb.common import devmode from edb.tools.edb import edbcommands @@ -41,10 +42,12 @@ def config(make_include: bool, pg_config: bool) -> None: '''Query certain parameters about an edgedb environment''' if make_include: share = buildmeta.get_extension_dir_path() + base = share.parent.parent.parent # XXX: It should not be here. + if not devmode.is_in_dev_mode(): + base = base / 'data' mk = ( - share.parent.parent.parent / 'tests' / - 'extension-testing' / 'exts.mk' + base / 'tests' / 'extension-testing' / 'exts.mk' ) print(mk) if pg_config: diff --git a/tests/extension-testing/ext_test/Makefile b/tests/extension-testing/ext_test/Makefile index e710b123635..957c5f01898 100644 --- a/tests/extension-testing/ext_test/Makefile +++ b/tests/extension-testing/ext_test/Makefile @@ -1,5 +1,12 @@ # Configurable parts SQL_MODULE := sql +### Boilerplate +PYTHON := python3 +EDB := $(PYTHON) -m edb.tools $(EDBFLAGS) +MKS := $(shell $(EDB) config --make-include) +include $(MKS) +### End Boilerplate + MKS := $(shell edb config --make-include) include $(MKS) diff --git a/tests/extension-testing/exts.mk b/tests/extension-testing/exts.mk index 18b05fa6bb5..6e461ba05f7 100644 --- a/tests/extension-testing/exts.mk +++ b/tests/extension-testing/exts.mk @@ -1,13 +1,13 @@ -EXT_NAME := $(shell python3 -c 'import tomllib; f = tomllib.load(open("MANIFEST.toml", "rb")); print(f["name"])') -EXT_VERSION := $(shell python3 -c 'import tomllib; f = tomllib.load(open("MANIFEST.toml", "rb")); print(f["version"])') -EDGEQL_SRCS := $(shell python3 -c 'import tomllib; f = tomllib.load(open("MANIFEST.toml", "rb")); print(" ".join(f["files"]))') -SQL_DIR := $(shell python3 -c 'import tomllib; f = tomllib.load(open("MANIFEST.toml", "rb")); print(f["postgres_files"])') +EXT_NAME := $(shell $(PYTHON) -c 'import tomllib; f = tomllib.load(open("MANIFEST.toml", "rb")); print(f["name"])') +EXT_VERSION := $(shell $(PYTHON) -c 'import tomllib; f = tomllib.load(open("MANIFEST.toml", "rb")); print(f["version"])') +EDGEQL_SRCS := $(shell $(PYTHON) -c 'import tomllib; f = tomllib.load(open("MANIFEST.toml", "rb")); print(" ".join(f["files"]))') +SQL_DIR := $(shell $(PYTHON) -c 'import tomllib; f = tomllib.load(open("MANIFEST.toml", "rb")); print(f["postgres_files"])') # EXT_FNAME := $(EXT_NAME)--$(EXT_VERSION) -PG_CONFIG := $(shell edb config --pg-config) +PG_CONFIG := $(shell $(EDB) config --pg-config) PG_DIR := $(shell dirname $(shell dirname $(PG_CONFIG))) rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))