python (1502:324e6e2cd624) python (1532:4b4d0c3ce94b)
1
2# Copyright (C) Valentin V. Bartenev
3# Copyright (C) Igor Sysoev
4# Copyright (C) NGINX, Inc.
5
6
7shift
8

--- 116 unchanged lines hidden (view full) ---

125if grep ^$NXT_PYTHON_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then
126 $echo
127 $echo $0: error: duplicate \"$NXT_PYTHON_MODULE\" module configured.
128 $echo
129 exit 1;
130fi
131
132
1
2# Copyright (C) Valentin V. Bartenev
3# Copyright (C) Igor Sysoev
4# Copyright (C) NGINX, Inc.
5
6
7shift
8

--- 116 unchanged lines hidden (view full) ---

125if grep ^$NXT_PYTHON_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then
126 $echo
127 $echo $0: error: duplicate \"$NXT_PYTHON_MODULE\" module configured.
128 $echo
129 exit 1;
130fi
131
132
133NXT_PYTHON_MOUNTS_HEADER=$NXT_BUILD_DIR/nxt_python_mounts.h
133NXT_PYTHON_MOUNTS_HEADER=nxt_${NXT_PYTHON_MODULE}_mounts.h
134
135$NXT_PYTHON -c 'import os.path
136import sys
137pyver = "python" + str(sys.version_info[0]) + "." + str(sys.version_info[1])
138
134
135$NXT_PYTHON -c 'import os.path
136import sys
137pyver = "python" + str(sys.version_info[0]) + "." + str(sys.version_info[1])
138
139print("static const nxt_fs_mount_t nxt_python%d%d_mounts[] = {" % (sys.version_info[0], sys.version_info[1]))
139print("static const nxt_fs_mount_t nxt_python_mounts[] = {")
140
141pattern = "{(u_char *) \"%s\", (u_char *) \"%s\", (u_char *) \"bind\", NXT_MS_BIND|NXT_MS_REC, NULL},"
142base = None
143for p in sys.path:
144 if len(p) > 0:
145 if os.path.basename(p) == pyver:
146 base = p
147

--- 4 unchanged lines hidden (view full) ---

152
153for p in sys.path:
154 if len(p) > 0:
155 if not p.startswith(base):
156 print(pattern % (p, p))
157
158print("};\n\n")
159
140
141pattern = "{(u_char *) \"%s\", (u_char *) \"%s\", (u_char *) \"bind\", NXT_MS_BIND|NXT_MS_REC, NULL},"
142base = None
143for p in sys.path:
144 if len(p) > 0:
145 if os.path.basename(p) == pyver:
146 base = p
147

--- 4 unchanged lines hidden (view full) ---

152
153for p in sys.path:
154 if len(p) > 0:
155 if not p.startswith(base):
156 print(pattern % (p, p))
157
158print("};\n\n")
159
160' >> $NXT_PYTHON_MOUNTS_HEADER
160' > $NXT_BUILD_DIR/$NXT_PYTHON_MOUNTS_HEADER
161
162
163$echo " + Python module: ${NXT_PYTHON_MODULE}.unit.so"
164
165. auto/cc/deps
166
167$echo >> $NXT_MAKEFILE
168

--- 11 unchanged lines hidden (view full) ---

180 nxt_dep=${nxt_src%.c}-$NXT_PYTHON_MODULE.dep
181 nxt_dep_flags=`nxt_gen_dep_flags`
182 nxt_dep_post=`nxt_gen_dep_post`
183 nxt_objs="$nxt_objs $NXT_BUILD_DIR/$nxt_obj"
184
185 cat << END >> $NXT_MAKEFILE
186
187$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
161
162
163$echo " + Python module: ${NXT_PYTHON_MODULE}.unit.so"
164
165. auto/cc/deps
166
167$echo >> $NXT_MAKEFILE
168

--- 11 unchanged lines hidden (view full) ---

180 nxt_dep=${nxt_src%.c}-$NXT_PYTHON_MODULE.dep
181 nxt_dep_flags=`nxt_gen_dep_flags`
182 nxt_dep_post=`nxt_gen_dep_post`
183 nxt_objs="$nxt_objs $NXT_BUILD_DIR/$nxt_obj"
184
185 cat << END >> $NXT_MAKEFILE
186
187$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
188 \$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_PYTHON_INCLUDE \\
188 \$(CC) -c \$(CFLAGS) -DNXT_PYTHON_MOUNTS_H=\"$NXT_PYTHON_MOUNTS_HEADER\" \\
189 \$(NXT_INCS) $NXT_PYTHON_INCLUDE \\
189 $nxt_dep_flags \\
190 -o $NXT_BUILD_DIR/$nxt_obj $nxt_src
191 $nxt_dep_post
192
193-include $NXT_BUILD_DIR/$nxt_dep
194
195END
196

--- 33 unchanged lines hidden ---
190 $nxt_dep_flags \\
191 -o $NXT_BUILD_DIR/$nxt_obj $nxt_src
192 $nxt_dep_post
193
194-include $NXT_BUILD_DIR/$nxt_dep
195
196END
197

--- 33 unchanged lines hidden ---