this repo has no description
at trunk 54 lines 1.4 kB view raw
1// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) 2#include <cwchar> 3 4#include "runtime.h" 5#include "sys-module.h" 6 7namespace py { 8 9PY_EXPORT wchar_t* Py_GetExecPrefix() { 10 if (Runtime::moduleSearchPath()[0] == L'\0') { 11 initializeRuntimePaths(Thread::current()); 12 } 13 return Runtime::execPrefix(); 14} 15 16PY_EXPORT wchar_t* Py_GetPath() { 17 if (Runtime::moduleSearchPath()[0] == L'\0') { 18 initializeRuntimePaths(Thread::current()); 19 } 20 return Runtime::moduleSearchPath(); 21} 22 23PY_EXPORT wchar_t* Py_GetPrefix() { 24 if (Runtime::moduleSearchPath()[0] == L'\0') { 25 initializeRuntimePaths(Thread::current()); 26 } 27 return Runtime::prefix(); 28} 29 30PY_EXPORT wchar_t* Py_GetProgramFullPath() { 31 UNIMPLEMENTED("Py_GetProgramFullPath"); 32} 33 34PY_EXPORT wchar_t* Py_GetProgramName() { return Runtime::programName(); } 35 36PY_EXPORT wchar_t* Py_GetPythonHome() { UNIMPLEMENTED("Py_GetPythonHome"); } 37 38PY_EXPORT void Py_SetPath(const wchar_t* path) { 39 Runtime::setPrefix(L""); 40 Runtime::setExecPrefix(L""); 41 Runtime::setModuleSearchPath(path != nullptr ? path : L""); 42} 43 44PY_EXPORT void Py_SetProgramName(const wchar_t* name) { 45 if (name != nullptr && name[0] != L'\0') { 46 Runtime::setProgramName(name); 47 } 48} 49 50PY_EXPORT void Py_SetPythonHome(const wchar_t* /* home */) { 51 UNIMPLEMENTED("Py_SetPythonHome"); 52} 53 54} // namespace py