Skip to content

Commit

Permalink
Make the extension makefiles closer to being able to build against a …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
msullivan authored Sep 18, 2024
1 parent 160a2aa commit be2759b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
7 changes: 5 additions & 2 deletions edb/tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import click

from edb import buildmeta
from edb.common import devmode
from edb.tools.edb import edbcommands


Expand All @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions tests/extension-testing/ext_test/Makefile
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 5 additions & 5 deletions tests/extension-testing/exts.mk
Original file line number Diff line number Diff line change
@@ -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))
Expand Down

0 comments on commit be2759b

Please sign in to comment.