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
44
45
46
47
|
$NetBSD: patch-ah,v 1.9 2001/12/06 03:46:22 jlam Exp $
--- src/interfaces/python/GNUmakefile.orig Sun Mar 25 14:44:03 2001
+++ src/interfaces/python/GNUmakefile
@@ -12,9 +12,22 @@
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
-all: Makefile pgmodule.c libpq-all
+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: Makefile pgmodule.c libpq-all $(PY_COMPILED_SCRIPTS)
$(MAKE) -f Makefile
+%.pyc: %.py
+ $(PYTHON) -c "import py_compile; py_compile.compile(\"$<\")"
+
+%.pyo: %.py
+ $(PYTHON) -O -c "import py_compile; py_compile.compile(\"$<\")"
+
.PHONY: libpq-all
libpq-all:
$(MAKE) -C $(libpq_builddir) all
@@ -28,13 +41,16 @@
Setup.in: Setup.in.raw
sed -e 's,@libpq_srcdir@,$(libpq_srcdir),g' \
-e 's,@libpq_builddir@,$(libpq_builddir),g' \
- -e 's%@EXTRA_LIBS@%$(filter -L%, $(LDFLAGS)) $(LIBS)%g' \
+ -e 's,@libpq@,$(libpq),g' \
+ -e 's%@EXTRA_LIBS@%$(filter -L%, $(LDFLAGS)) $(filter -Wl%, $(LDFLAGS)) $(LIBS)%g' \
-e 's%@INCLUDES@%$(filter -I%, $(CPPFLAGS))%g' \
$< > $@
install: all
@echo "Installing Python module"
- @if ( $(INSTALL_DATA) pg.py $(python_moduledir) && \
+ @if ( ( for i in $(PY_SCRIPTS) $(PY_COMPILED_SCRIPTS); do \
+ $(INSTALL_DATA) $$i $(python_moduledir); \
+ done ) && \
$(MAKE) -f Makefile install ); then : ; else \
echo "*****" ;\
echo "* Skipping the installation of the Python interface module for lack"; \
|