Skip to content

Commit 1f7e520

Browse files
committed
call Py_SetProgramName() when building for conda env
1 parent ac328cd commit 1f7e520

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

build/gnumake-mac-gcc.inc

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ ifndef PY_CONDA_ROOT
2626
$(error PY_CONDA_ROOT is undefined)
2727
endif
2828

29+
DEFS += -DPY_INTERPRETER=$(PY_CONDA_ROOT)/bin/python
2930
LIBS += $(PY_CONDA_ROOT)/lib/libpython$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION).dylib
3031
INCPATH += -I$(PY_CONDA_ROOT)/include
3132
INCPATH += -I$(PY_CONDA_ROOT)/include/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)

source/pybase.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ WARRANTIES, see the file, "license.txt," in this distribution.
1515
#include <ApplicationServices/ApplicationServices.h>
1616
#endif
1717

18+
#define STRINGIFY(x) #x
19+
#define TOSTRING(x) STRINGIFY(x)
20+
1821
static PyMethodDef StdOut_Methods[] =
1922
{
2023
{ "write", pybase::StdOut_Write, 1 },
@@ -99,8 +102,17 @@ void initsymbol();
99102
void initsamplebuffer();
100103
void initbundle();
101104

105+
106+
102107
void pybase::lib_setup()
103-
{
108+
{
109+
#ifdef PY_INTERPRETER
110+
{
111+
static char py_program_name[] = TOSTRING(PY_INTERPRETER);
112+
Py_SetProgramName(py_program_name);
113+
}
114+
#endif
115+
104116
post("");
105117
post("------------------------------------------------");
106118
post("py/pyext %s - python script objects",PY__VERSION);

0 commit comments

Comments
 (0)