build python module without binreloc, add dummy argv[0] to initialize bprogname.

This commit is contained in:
2011-02-21 13:13:08 +00:00
parent ef60ae9521
commit 9ef0eed4b6
7 changed files with 30 additions and 15 deletions

View File

@@ -669,6 +669,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
#ifdef WITH_PYTHON_MODULE
#include "BLI_storage.h"
/* TODO, reloading the module isnt functional at the moment. */
extern int main_python(int argc, const char **argv);
@@ -687,9 +688,16 @@ static struct PyModuleDef bpy_proxy_def = {
PyMODINIT_FUNC
PyInit_bpy(void)
{
int argc= 0;
const char *argv[]={NULL};
int argc= 1;
char *argv[2]={NULL, NULL};
/* give the CWD as the first arg, blender uses */
char path[240]= "";
BLI_getwdN(path, sizeof(path));
BLI_join_dirfile(path, sizeof(path), path, "bpy");
argv[0]= path;
/* done with cwd */
main_python(argc, argv);
/* initialized in BPy_init_modules() */