MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / getRunArguments

Method getRunArguments

src/plugins/python/python/pythongenerator.cpp:118–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118RunCommandInfo PythonGenerator::getRunArguments(const ProjectInfo &projectInfo, const QString &currentFile)
119{
120 bool isRunCurrentFile = projectInfo.currentProgram() == exeCurrent;
121
122 RunCommandInfo runCommandInfo;
123
124 auto programOfProject = ConfigUtil::instance()->getConfigureParamPointer()->pythonVersion.path;
125 if(programOfProject.isEmpty()) // if this project has not set interpret of project. use default set
126 runCommandInfo.program = OptionManager::getInstance()->getPythonToolPath();
127 else
128 runCommandInfo.program = programOfProject;
129
130 // TODO(Mozart): program got failed, use default version.
131 if (runCommandInfo.program.isEmpty()) {
132 runCommandInfo.program = "python";
133 }
134 runCommandInfo.workingDir = projectInfo.workspaceFolder();
135 // get run file path.
136 QString runFilePath = currentFile;
137 if (!isRunCurrentFile) {
138 QString entryFilePath = getEntryFilePath(projectInfo.workspaceFolder());
139 if (!entryFilePath.isEmpty()) {
140 runFilePath = entryFilePath;
141 }
142 }
143 runCommandInfo.arguments << "-u" << runFilePath; // -u : Process the output immediately without caching.
144 runCommandInfo.runInTerminal = ConfigUtil::instance()->getConfigureParamPointer()->runInTerminal;
145
146 return runCommandInfo;
147}

Callers

nothing calls this directly

Calls 4

getEntryFilePathFunction · 0.85
getPythonToolPathMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected