22 #include "vtkLogger.h" 27 #include "vtkPythonInterpreter.h" 31 #include <vtksys/SystemTools.hxx> 41 std::vector<char*>& pythonArgs,
const char* first_unknown_arg,
int argc,
char* argv[])
44 pythonArgs.push_back(vtksys::SystemTools::DuplicateString(argv[0]));
45 if (first_unknown_arg && strcmp(first_unknown_arg,
"--") == 0)
50 else if (first_unknown_arg && strlen(first_unknown_arg) > 0)
54 if (vtksys::SystemTools::GetFilenameLastExtension(first_unknown_arg) ==
".zip")
57 vtkPythonInterpreter::PrependPythonPath(first_unknown_arg);
58 pythonArgs.push_back(vtksys::SystemTools::DuplicateString(
"-m"));
60 std::string modulename = vtksys::SystemTools::GetFilenameWithoutLastExtension(
61 vtksys::SystemTools::GetFilenameName(first_unknown_arg));
62 pythonArgs.push_back(vtksys::SystemTools::DuplicateString(modulename.c_str()));
66 pythonArgs.push_back(vtksys::SystemTools::DuplicateString(first_unknown_arg));
70 for (
int cc = 1; cc < argc; cc++)
72 pythonArgs.push_back(vtksys::SystemTools::DuplicateString(argv[cc]));
77 int Run(
int processType,
int argc,
char* argv[])
96 vtkGenericWarningMacro(
"No script specified. " 97 "Please specify a batch script or use 'pvpython'.");
123 char** remaining_argv;
127 std::vector<char*> pythonArgs;
129 pythonArgs.push_back(
nullptr);
133 vtkPythonInterpreter::SetLogVerbosity(
135 ? vtkLogger::VERBOSITY_INFO
136 : vtkLogger::VERBOSITY_TRACE);
139 vtkPythonInterpreter::Initialize();
142 vtkPythonInterpreter::PyMain(static_cast<int>(pythonArgs.size()) - 1, &*pythonArgs.begin());
145 std::vector<char*>::iterator it = pythonArgs.begin();
146 while (it != pythonArgs.end())
void LoadPluginConfigurationXMLs(const char *appname)
Called to load application-specific configuration xml.
virtual char * GetUnknownArgument()
In case of unknown argument, set this variable with the unknown argument.
void ProcessArgsForPython(std::vector< char *> &pythonArgs, const char *first_unknown_arg, int argc, char *argv[])
static vtkIdType ConnectToSelf(int timeout=60)
These are static helper methods that help create standard ParaView sessions.
int GetPartitionId()
Returns the local process id.
int ProcessRMIs(int reportErrors, int dont_loop=0)
static void Finalize()
Finalizes the server manager.
static vtkSmartPointer< T > New()
static vtkProcessModule * GetProcessModule()
Provides access to the global ProcessModule.
void ParaView_paraview_plugins_initialize()
void GetRemainingArguments(int *argc, char **argv[])
virtual int GetHelpSelected()
Was help selected?
static void SetApplicationName(const std::string &appName)
Sets the name of the application.
virtual bool GetSymmetricMPIMode()
Returns true if ParaView is to be run in symmetric mode.
static vtkPVPluginTracker * GetInstance()
Provides access to the singleton.
virtual int GetPrintMonitors()
Should this process just print monitor information and exit?
vtkMultiProcessController * GetGlobalController()
Provides access to the global MPI controller, if any.
static void Initialize(const char *executable, int type)
Initializes the server manager.
virtual int GetLogStdErrVerbosity()
Returns the verbosity level for stderr output chosen.
int Run(int processType, int argc, char *argv[])
virtual int GetTellVersion()
Should this run print the version numbers and exit.
void vtkPVInitializePythonModules()
process initialization and management core for ParaView processes.
bool UnRegisterSession(vtkIdType sessionID)
Unregister a session given its ID.