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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
|
To: vim_dev@googlegroups.com
Subject: Patch 7.3.062
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.062
Problem: Python doesn't work properly when installed in another directory
than expected.
Solution: Figure out home directory in configure and use Py_SetPythonHome()
at runtime. (Roland Puntaier)
Files: src/configure.in, src/auto/configure, src/if_python.c,
src/if_python3.c
*** ../vim-7.3.061/src/configure.in 2010-11-03 22:32:18.000000000 +0100
--- src/configure.in 2010-11-16 17:47:36.000000000 +0100
***************
*** 891,899 ****
PYTHON_LIBS="${vi_cv_path_python_plibs}"
if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
else
! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}"
fi
PYTHON_SRC="if_python.c"
dnl For Mac OSX 10.2 config.o is included in the Python library.
--- 891,899 ----
PYTHON_LIBS="${vi_cv_path_python_plibs}"
if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
else
! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
fi
PYTHON_SRC="if_python.c"
dnl For Mac OSX 10.2 config.o is included in the Python library.
***************
*** 905,911 ****
if test "${vi_cv_var_python_version}" = "1.4"; then
PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
fi
! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
dnl On FreeBSD linking with "-pthread" is required to use threads.
dnl _THREAD_SAFE must be used for compiling then.
--- 905,911 ----
if test "${vi_cv_var_python_version}" = "1.4"; then
PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
fi
! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
dnl On FreeBSD linking with "-pthread" is required to use threads.
dnl _THREAD_SAFE must be used for compiling then.
***************
*** 1063,1071 ****
PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
else
! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}"
fi
PYTHON3_SRC="if_python3.c"
dnl For Mac OSX 10.2 config.o is included in the Python library.
--- 1063,1071 ----
PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
else
! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
fi
PYTHON3_SRC="if_python3.c"
dnl For Mac OSX 10.2 config.o is included in the Python library.
***************
*** 1143,1151 ****
if test "$python_ok" = yes && test "$python3_ok" = yes; then
AC_DEFINE(DYNAMIC_PYTHON)
AC_DEFINE(DYNAMIC_PYTHON3)
! AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL)
cflags_save=$CFLAGS
! CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -ldl"
AC_RUN_IFELSE([
--- 1143,1151 ----
if test "$python_ok" = yes && test "$python3_ok" = yes; then
AC_DEFINE(DYNAMIC_PYTHON)
AC_DEFINE(DYNAMIC_PYTHON3)
! AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python)
cflags_save=$CFLAGS
! CFLAGS="$CFLAGS $PYTHON_CFLAGS"
ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -ldl"
AC_RUN_IFELSE([
***************
*** 1156,1170 ****
* Only the first pyhton version used will be switched on.
*/
! int no_rtl_global_needed_for(char *python_instsoname)
{
int needed = 0;
void* pylib = dlopen(python_instsoname, RTLD_LAZY);
if (pylib != 0)
{
void (*init)(void) = dlsym(pylib, "Py_Initialize");
int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
void (*final)(void) = dlsym(pylib, "Py_Finalize");
(*init)();
needed = (*simple)("import termios") == -1;
(*final)();
--- 1156,1172 ----
* Only the first pyhton version used will be switched on.
*/
! int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
{
int needed = 0;
void* pylib = dlopen(python_instsoname, RTLD_LAZY);
if (pylib != 0)
{
+ void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
void (*init)(void) = dlsym(pylib, "Py_Initialize");
int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
void (*final)(void) = dlsym(pylib, "Py_Finalize");
+ (*pfx)(prefix);
(*init)();
needed = (*simple)("import termios") == -1;
(*final)();
***************
*** 1176,1188 ****
int main(int argc, char** argv)
{
int not_needed = 0;
! if (no_rtl_global_needed_for("libpython2.7.so.1.0") && no_rtl_global_needed_for("libpython3.1.so.1.0"))
not_needed = 1;
return !not_needed;
}],
[AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
CFLAGS=$cflags_save
LDFLAGS=$ldflags_save
PYTHON_SRC="if_python.c"
PYTHON_OBJ="objects/if_python.o"
PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
--- 1178,1237 ----
int main(int argc, char** argv)
{
int not_needed = 0;
! if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}"))
not_needed = 1;
return !not_needed;
}],
[AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
+
CFLAGS=$cflags_save
LDFLAGS=$ldflags_save
+
+ AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3)
+ cflags_save=$CFLAGS
+ CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
+ ldflags_save=$LDFLAGS
+ LDFLAGS="$LDFLAGS -ldl"
+ AC_RUN_IFELSE([
+ #include <dlfcn.h>
+ #include <wchar.h>
+ /* If this program fails, then RTLD_GLOBAL is needed.
+ * RTLD_GLOBAL will be used and then it is not possible to
+ * have both python versions enabled in the same vim instance.
+ * Only the first pyhton version used will be switched on.
+ */
+
+ int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
+ {
+ int needed = 0;
+ void* pylib = dlopen(python_instsoname, RTLD_LAZY);
+ if (pylib != 0)
+ {
+ void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
+ void (*init)(void) = dlsym(pylib, "Py_Initialize");
+ int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
+ void (*final)(void) = dlsym(pylib, "Py_Finalize");
+ (*pfx)(prefix);
+ (*init)();
+ needed = (*simple)("import termios") == -1;
+ (*final)();
+ dlclose(pylib);
+ }
+ return !needed;
+ }
+
+ int main(int argc, char** argv)
+ {
+ int not_needed = 0;
+ if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}"))
+ not_needed = 1;
+ return !not_needed;
+ }],
+ [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
+
+ CFLAGS=$cflags_save
+ LDFLAGS=$ldflags_save
+
PYTHON_SRC="if_python.c"
PYTHON_OBJ="objects/if_python.o"
PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
*** ../vim-7.3.061/src/auto/configure 2010-11-03 22:32:18.000000000 +0100
--- src/auto/configure 2010-11-16 17:47:42.000000000 +0100
***************
*** 5326,5334 ****
PYTHON_LIBS="${vi_cv_path_python_plibs}"
if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
else
! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}"
fi
PYTHON_SRC="if_python.c"
if test "x$MACOSX" = "xyes"; then
--- 5326,5334 ----
PYTHON_LIBS="${vi_cv_path_python_plibs}"
if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
else
! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
fi
PYTHON_SRC="if_python.c"
if test "x$MACOSX" = "xyes"; then
***************
*** 5339,5345 ****
if test "${vi_cv_var_python_version}" = "1.4"; then
PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
fi
! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread should be used" >&5
$as_echo_n "checking if -pthread should be used... " >&6; }
--- 5339,5345 ----
if test "${vi_cv_var_python_version}" = "1.4"; then
PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
fi
! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread should be used" >&5
$as_echo_n "checking if -pthread should be used... " >&6; }
***************
*** 5601,5609 ****
PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
else
! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}"
fi
PYTHON3_SRC="if_python3.c"
if test "x$MACOSX" = "xyes"; then
--- 5601,5609 ----
PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
else
! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
fi
PYTHON3_SRC="if_python3.c"
if test "x$MACOSX" = "xyes"; then
***************
*** 5708,5717 ****
$as_echo "#define DYNAMIC_PYTHON3 1" >>confdefs.h
! { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL" >&5
! $as_echo_n "checking whether we can do without RTLD_GLOBAL... " >&6; }
cflags_save=$CFLAGS
! CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -ldl"
if test "$cross_compiling" = yes; then :
--- 5708,5717 ----
$as_echo "#define DYNAMIC_PYTHON3 1" >>confdefs.h
! { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python" >&5
! $as_echo_n "checking whether we can do without RTLD_GLOBAL for Python... " >&6; }
cflags_save=$CFLAGS
! CFLAGS="$CFLAGS $PYTHON_CFLAGS"
ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -ldl"
if test "$cross_compiling" = yes; then :
***************
*** 5730,5744 ****
* Only the first pyhton version used will be switched on.
*/
! int no_rtl_global_needed_for(char *python_instsoname)
{
int needed = 0;
void* pylib = dlopen(python_instsoname, RTLD_LAZY);
if (pylib != 0)
{
void (*init)(void) = dlsym(pylib, "Py_Initialize");
int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
void (*final)(void) = dlsym(pylib, "Py_Finalize");
(*init)();
needed = (*simple)("import termios") == -1;
(*final)();
--- 5730,5746 ----
* Only the first pyhton version used will be switched on.
*/
! int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
{
int needed = 0;
void* pylib = dlopen(python_instsoname, RTLD_LAZY);
if (pylib != 0)
{
+ void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
void (*init)(void) = dlsym(pylib, "Py_Initialize");
int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
void (*final)(void) = dlsym(pylib, "Py_Finalize");
+ (*pfx)(prefix);
(*init)();
needed = (*simple)("import termios") == -1;
(*final)();
***************
*** 5750,5756 ****
int main(int argc, char** argv)
{
int not_needed = 0;
! if (no_rtl_global_needed_for("libpython2.7.so.1.0") && no_rtl_global_needed_for("libpython3.1.so.1.0"))
not_needed = 1;
return !not_needed;
}
--- 5752,5758 ----
int main(int argc, char** argv)
{
int not_needed = 0;
! if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}"))
not_needed = 1;
return !not_needed;
}
***************
*** 5767,5774 ****
--- 5769,5844 ----
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
+
CFLAGS=$cflags_save
LDFLAGS=$ldflags_save
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python3" >&5
+ $as_echo_n "checking whether we can do without RTLD_GLOBAL for Python3... " >&6; }
+ cflags_save=$CFLAGS
+ CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
+ ldflags_save=$LDFLAGS
+ LDFLAGS="$LDFLAGS -ldl"
+ if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ as_fn_error "cannot run test program while cross compiling
+ See \`config.log' for more details." "$LINENO" 5; }
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+ #include <dlfcn.h>
+ #include <wchar.h>
+ /* If this program fails, then RTLD_GLOBAL is needed.
+ * RTLD_GLOBAL will be used and then it is not possible to
+ * have both python versions enabled in the same vim instance.
+ * Only the first pyhton version used will be switched on.
+ */
+
+ int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
+ {
+ int needed = 0;
+ void* pylib = dlopen(python_instsoname, RTLD_LAZY);
+ if (pylib != 0)
+ {
+ void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
+ void (*init)(void) = dlsym(pylib, "Py_Initialize");
+ int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
+ void (*final)(void) = dlsym(pylib, "Py_Finalize");
+ (*pfx)(prefix);
+ (*init)();
+ needed = (*simple)("import termios") == -1;
+ (*final)();
+ dlclose(pylib);
+ }
+ return !needed;
+ }
+
+ int main(int argc, char** argv)
+ {
+ int not_needed = 0;
+ if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}"))
+ not_needed = 1;
+ return !not_needed;
+ }
+ _ACEOF
+ if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ $as_echo "yes" >&6; };$as_echo "#define PY3_NO_RTLD_GLOBAL 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ $as_echo "no" >&6; }
+ fi
+ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+ fi
+
+
+ CFLAGS=$cflags_save
+ LDFLAGS=$ldflags_save
+
PYTHON_SRC="if_python.c"
PYTHON_OBJ="objects/if_python.o"
PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
*** ../vim-7.3.061/src/if_python.c 2010-10-23 14:02:48.000000000 +0200
--- src/if_python.c 2010-11-16 17:07:00.000000000 +0100
***************
*** 102,108 ****
# include <dlfcn.h>
# define FARPROC void*
# define HINSTANCE void*
! # ifdef PY_NO_RTLD_GLOBAL
# define load_dll(n) dlopen((n), RTLD_LAZY)
# else
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
--- 102,108 ----
# include <dlfcn.h>
# define FARPROC void*
# define HINSTANCE void*
! # if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)
# define load_dll(n) dlopen((n), RTLD_LAZY)
# else
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
***************
*** 168,173 ****
--- 168,174 ----
# define Py_BuildValue dll_Py_BuildValue
# define Py_FindMethod dll_Py_FindMethod
# define Py_InitModule4 dll_Py_InitModule4
+ # define Py_SetPythonHome dll_Py_SetPythonHome
# define Py_Initialize dll_Py_Initialize
# define Py_Finalize dll_Py_Finalize
# define Py_IsInitialized dll_Py_IsInitialized
***************
*** 226,231 ****
--- 227,233 ----
static PyObject*(*dll_Py_BuildValue)(char *, ...);
static PyObject*(*dll_Py_FindMethod)(struct PyMethodDef[], PyObject *, char *);
static PyObject*(*dll_Py_InitModule4)(char *, struct PyMethodDef *, char *, PyObject *, int);
+ static void(*dll_Py_SetPythonHome)(char *home);
static void(*dll_Py_Initialize)(void);
static void(*dll_Py_Finalize)(void);
static int(*dll_Py_IsInitialized)(void);
***************
*** 310,315 ****
--- 312,318 ----
# else
{"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4},
# endif
+ {"Py_SetPythonHome", (PYTHON_PROC*)&dll_Py_SetPythonHome},
{"Py_Initialize", (PYTHON_PROC*)&dll_Py_Initialize},
{"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize},
{"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized},
***************
*** 349,355 ****
{
int i;
! #if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON3)
/* Can't have Python and Python3 loaded at the same time.
* It cause a crash, because RTLD_GLOBAL is needed for
* standard C extension libraries of one or both python versions. */
--- 352,358 ----
{
int i;
! #if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3)
/* Can't have Python and Python3 loaded at the same time.
* It cause a crash, because RTLD_GLOBAL is needed for
* standard C extension libraries of one or both python versions. */
***************
*** 543,548 ****
--- 546,555 ----
}
#endif
+ #ifdef PYTHON_HOME
+ Py_SetPythonHome(PYTHON_HOME);
+ #endif
+
init_structs();
#if !defined(MACOS) || defined(MACOS_X_UNIX)
*** ../vim-7.3.061/src/if_python3.c 2010-10-23 14:02:48.000000000 +0200
--- src/if_python3.c 2010-11-16 17:07:26.000000000 +0100
***************
*** 80,86 ****
# include <dlfcn.h>
# define FARPROC void*
# define HINSTANCE void*
! # ifdef PY_NO_RTLD_GLOBAL
# define load_dll(n) dlopen((n), RTLD_LAZY)
# else
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
--- 80,86 ----
# include <dlfcn.h>
# define FARPROC void*
# define HINSTANCE void*
! # if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)
# define load_dll(n) dlopen((n), RTLD_LAZY)
# else
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
***************
*** 132,137 ****
--- 132,138 ----
# define PyType_Ready py3_PyType_Ready
#undef Py_BuildValue
# define Py_BuildValue py3_Py_BuildValue
+ # define Py_SetPythonHome py3_Py_SetPythonHome
# define Py_Initialize py3_Py_Initialize
# define Py_Finalize py3_Py_Finalize
# define Py_IsInitialized py3_Py_IsInitialized
***************
*** 170,175 ****
--- 171,177 ----
* Pointers for dynamic link
*/
static int (*py3_PySys_SetArgv)(int, wchar_t **);
+ static void (*py3_Py_SetPythonHome)(wchar_t *home);
static void (*py3_Py_Initialize)(void);
static PyObject* (*py3_PyList_New)(Py_ssize_t size);
static PyGILState_STATE (*py3_PyGILState_Ensure)(void);
***************
*** 254,259 ****
--- 256,262 ----
} py3_funcname_table[] =
{
{"PySys_SetArgv", (PYTHON_PROC*)&py3_PySys_SetArgv},
+ {"Py_SetPythonHome", (PYTHON_PROC*)&py3_Py_SetPythonHome},
{"Py_Initialize", (PYTHON_PROC*)&py3_Py_Initialize},
{"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
{"PyList_New", (PYTHON_PROC*)&py3_PyList_New},
***************
*** 336,342 ****
int i;
void *ucs_from_string, *ucs_from_string_and_size;
! # if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON)
/* Can't have Python and Python3 loaded at the same time.
* It cause a crash, because RTLD_GLOBAL is needed for
* standard C extension libraries of one or both python versions. */
--- 339,345 ----
int i;
void *ucs_from_string, *ucs_from_string_and_size;
! # if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON)
/* Can't have Python and Python3 loaded at the same time.
* It cause a crash, because RTLD_GLOBAL is needed for
* standard C extension libraries of one or both python versions. */
***************
*** 539,544 ****
--- 542,552 ----
init_structs();
+
+ #ifdef PYTHON3_HOME
+ Py_SetPythonHome(PYTHON3_HOME);
+ #endif
+
/* initialise threads */
PyEval_InitThreads();
*** ../vim-7.3.061/src/version.c 2010-11-16 16:25:46.000000000 +0100
--- src/version.c 2010-11-16 17:12:40.000000000 +0100
***************
*** 716,717 ****
--- 716,719 ----
{ /* Add new patch number below this line */
+ /**/
+ 62,
/**/
--
ARTHUR: CHARGE!
[The mighty ARMY charges. Thundering noise of feet. Clatter of coconuts.
Shouts etc. Suddenly there is a wail of a siren and a couple of police
cars roar round in front of the charging ARMY and the POLICE leap out and
stop them. TWO POLICEMAN and the HISTORIAN'S WIFE. Black Marias skid up
behind them.]
HISTORIAN'S WIFE: They're the ones, I'm sure.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|