mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
PY-29869 Improve skeletons generation for Docker Compose service based Python interpreter
Use Docker Compose container running the idle script (the infinite loop) and perform subsequent calls to skeleton generator script using Docker `exec` command with the created container.
This commit is contained in:
10
python/helpers/idle.py
Normal file
10
python/helpers/idle.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import sys
|
||||
import time
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) > 0:
|
||||
started_message = sys.argv[1]
|
||||
print(started_message)
|
||||
|
||||
while True:
|
||||
time.sleep(100)
|
||||
@@ -149,6 +149,24 @@ public class PySkeletonGenerator {
|
||||
String binaryPath, String extraSyspath)
|
||||
throws InvalidSdkException {
|
||||
final String parent_dir = new File(binaryPath).getParent();
|
||||
List<String> commandLine = buildSkeletonGeneratorCommandLine(modname, modfilename, assemblyRefs, binaryPath, extraSyspath);
|
||||
|
||||
final Map<String, String> extraEnv = PythonSdkType.getVirtualEnvExtraEnv(binaryPath);
|
||||
final Map<String, String> env = new HashMap<>(extraEnv != null ? PySdkUtil.mergeEnvVariables(myEnv, extraEnv) : myEnv);
|
||||
|
||||
if (myPrebuilt) {
|
||||
env.put("IS_PREGENERATED_SKELETONS", "1");
|
||||
}
|
||||
|
||||
return getProcessOutput(parent_dir, ArrayUtil.toStringArray(commandLine), env, MINUTE * 10);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected final List<String> buildSkeletonGeneratorCommandLine(@NotNull String modname,
|
||||
@Nullable String modfilename,
|
||||
@Nullable List<String> assemblyRefs,
|
||||
@NotNull String binaryPath,
|
||||
@Nullable String extraSyspath) {
|
||||
List<String> commandLine = new ArrayList<>();
|
||||
commandLine.add(binaryPath);
|
||||
commandLine.add(PythonHelpersLocator.getHelperPath(GENERATOR3));
|
||||
@@ -169,15 +187,7 @@ public class PySkeletonGenerator {
|
||||
if (modfilename != null) {
|
||||
commandLine.add(modfilename);
|
||||
}
|
||||
|
||||
final Map<String, String> extraEnv = PythonSdkType.getVirtualEnvExtraEnv(binaryPath);
|
||||
final Map<String, String> env = new HashMap<>(extraEnv != null ? PySdkUtil.mergeEnvVariables(myEnv, extraEnv) : myEnv);
|
||||
|
||||
if (myPrebuilt) {
|
||||
env.put("IS_PREGENERATED_SKELETONS", "1");
|
||||
}
|
||||
|
||||
return getProcessOutput(parent_dir, ArrayUtil.toStringArray(commandLine), env, MINUTE * 10);
|
||||
return commandLine;
|
||||
}
|
||||
|
||||
protected ProcessOutput getProcessOutput(String homePath, String[] commandLine, Map<String, String> extraEnv,
|
||||
|
||||
Reference in New Issue
Block a user