summaryrefslogtreecommitdiff
path: root/databases/postgresql/patches/patch-ah
blob: 0c3cafeed44bf2a1b8e64be7ce8ad5703d408249 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$NetBSD: patch-ah,v 1.10 2002/04/04 07:48:28 jlam Exp $

--- src/interfaces/python/GNUmakefile.orig	Thu Dec 13 18:39:04 2001
+++ src/interfaces/python/GNUmakefile	Tue Feb 12 17:37:45 2002
@@ -19,7 +19,14 @@
 
 override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) $(python_includespec)
 
-all: all-lib
+PY_SCRIPTS = pg.py pgdb.py
+ifeq ($(with_python_compile), yes)
+PY_COMPILED_SCRIPTS = $(PY_SCRIPTS:%.py=%.pyc) $(PY_SCRIPTS:%.py=%.pyo)
+else
+PY_COMPILED_SCRIPTS =
+endif
+
+all: all-lib $(PY_COMPILED_SCRIPTS)
 
 all-lib: libpq-all
 
@@ -27,6 +34,12 @@
 libpq-all:
 	$(MAKE) -C $(libpq_builddir) all
 
+%.pyc: %.py
+	$(PYTHON) -c "import py_compile; py_compile.compile(\"$<\")"
+
+%.pyo: %.py
+	$(PYTHON) -O -c "import py_compile; py_compile.compile(\"$<\")"
+
 install-warning-msg := { \
 echo "*** Skipping the installation of the Python interface module for lack"; \
 echo "*** of permissions.  To install it, change to the directory"; \
@@ -35,6 +48,9 @@
 
 install: all installdirs
 	@if test -w $(DESTDIR)$(python_moduleexecdir) && test -w $(DESTDIR)$(python_moduledir); then \
+	  for i in $(PY_SCRIPTS) $(PY_COMPILED_SCRIPTS); do \
+		$(INSTALL_DATA) $$i $(python_moduledir) ; \
+	  done ; \
 	  echo "$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(python_moduleexecdir)/_pgmodule$(DLSUFFIX)"; \
 	  $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(python_moduleexecdir)/_pgmodule$(DLSUFFIX); \
 	\