Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions contrib/aifun/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
EXTENSION = aifun
DATA = aifun--1.0.sql
CONTROL = aifun.control

# Python 3 executable
PYTHON3=$(shell which python3)

# Python code directories
PYTHON_DIR = $(srcdir)/aifun
PG_PYTHON_DIR = $(libdir)/python/aifun

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

# ------------------------------------------------------------------
# Custom install section for Python handler files
# ------------------------------------------------------------------

install: python-install

python-install:
@echo "Installing Python handler files to $(DESTDIR)$(PG_PYTHON_DIR)"
mkdir -p '$(DESTDIR)$(PG_PYTHON_DIR)'
cp -a $(PYTHON_DIR)/*.py '$(DESTDIR)$(PG_PYTHON_DIR)/'
cp -a $(PYTHON_DIR)/providers '$(DESTDIR)$(PG_PYTHON_DIR)/'
cp $(srcdir)/requirements.txt '$(DESTDIR)$(PG_PYTHON_DIR)/'
$(PYTHON3) -m pip install --user --upgrade -r '$(DESTDIR)$(PG_PYTHON_DIR)/requirements.txt'

uninstall: python-uninstall

python-uninstall:
@echo "Removing Python handler files from $(DESTDIR)$(PG_PYTHON_DIR)"
rm -rf '$(DESTDIR)$(PG_PYTHON_DIR)'
Loading
Loading