|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
string path = Application.dataPath.Replace("/Assets", ""); |
|
|
|
string packagesPath = Application.dataPath.Replace("/Assets","/Library/PythonInstall/Scripts"); |
|
|
|
string packagesPath = Application.dataPath.Replace("/Assets","/Library/PythonInstall/bin"); |
|
|
|
string pathToData = PlayerPrefs.GetString(SimulationState.latestOutputDirectoryKey); |
|
|
|
#if UNITY_EDITOR_WIN
|
|
|
|
path = path.Replace("/", "\\"); |
|
|
|
|
|
|
command = $"cd \"{pathToData}\\..\" && \"{packagesPath}\\pyrception-utils.exe\" preview --data=\".\""; |
|
|
|
#elif (UNITY_EDITOR_OSX || UNITY_EDITOR_LINUX)
|
|
|
|
//command = $"cd \"{path}/DataInsightsEnv/bin\";source activate;cd \"{pathToData}/..\";\"{path}/DataInsightsEnv/bin/pyrception-utils\" preview --data=\".\"";
|
|
|
|
command = $"cd \"{pathToData}\\..\" && \"{packagesPath}\\pyrception-utils\" preview --data=\".\""; |
|
|
|
command = $"cd {pathToData}/.. ; {packagesPath}/pyrception-utils preview --data=\".\""; |
|
|
|
#endif
|
|
|
|
int ExitCode = 0; |
|
|
|
ExecuteCMD(command, ref ExitCode, waitForExit: false, displayWindow: true); |
|
|
|
|
|
|
|
|
|
|
//==============================INSTALL VIRTUALENV======================================
|
|
|
|
//EditorUtility.DisplayProgressBar("Setting up Pyrception", "Installing virtualenv...", 0 / steps);
|
|
|
|
|
|
|
|
|
|
|
|
ExitCode = 0; |
|
|
|
#if UNITY_EDITOR_WIN
|
|
|
|
//ExecuteCMD($"\"{packagesPath}\\pip3.bat\" install virtualenv", ref ExitCode);
|
|
|
|
|
|
|
ExecuteCMD($"XCOPY /E/I/Y \"{pyrceptionPath}\" \"{packagesPath}\\..\\pyrception-util\"", ref ExitCode); |
|
|
|
#elif (UNITY_EDITOR_OSX || UNITY_EDITOR_LINUX)
|
|
|
|
//ExecuteCMD($"\\cp -r \"{pyrceptionPath}\" \"{path}/DataInsightsEnv/pyrception-util\"", ref ExitCode);
|
|
|
|
ExecuteCMD($"\\cp -r \"{pyrceptionPath}\" \"{packagesPath}\\..\\pyrception-util\"", ref ExitCode); |
|
|
|
ExecuteCMD($"\\cp -r \"{pyrceptionPath}\" \"{packagesPath}/../pyrception-util\"", ref ExitCode); |
|
|
|
#endif
|
|
|
|
if (ExitCode != 0) { |
|
|
|
EditorUtility.ClearProgressBar(); |
|
|
|
|
|
|
#if UNITY_EDITOR_WIN
|
|
|
|
//ExecuteCMD($"\"{path}\\DataInsightsEnv\\Scripts\\activate\" && cd \"{path}\\DataInsightsEnv\\pyrception-util\" && \"{packagesPath}\"\\pip3 --no-cache-dir install -e . && deactivate", ref ExitCode);
|
|
|
|
ExecuteCMD($"cd \"{packagesPath}\\..\\pyrception-util\" && \"{packagesPath}\"\\pip3.bat install --no-warn-script-location --no-cache-dir -e .", ref ExitCode); |
|
|
|
|
|
|
|
|
|
|
|
ExecuteCMD($"cd \"{packagesPath}\\..\\pyrception-util\"; \"{packagesPath}\"\\pip3 --no-warn-script-location --no-cache-dir install -e ., ref ExitCode);
|
|
|
|
ExecuteCMD($"cd \"{packagesPath}/../pyrception-util\"; \"{packagesPath}\"/pip3 --no-cache-dir install -e .", ref ExitCode); |
|
|
|
#endif
|
|
|
|
if (ExitCode != 0) { |
|
|
|
EditorUtility.ClearProgressBar(); |
|
|
|
|
|
|
info.RedirectStandardError = waitForExit; |
|
|
|
|
|
|
|
Process cmd = Process.Start(info); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd.WaitForExit(); |
|
|
|
if (redirectOutput) { |
|
|
|