Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: results of pip show are not properly parsed #70

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private List<Map<String, Object>> getDependenciesImpl(String pathToRequirements,
String[] deps = freeze.split(System.lineSeparator());
String depNames = Arrays.stream(deps).map(PythonControllerBase::getDependencyName).collect(Collectors.joining(" "));
String pipShowOutput = Operations.runProcessGetOutput(pythonEnvironmentDir, pipBinaryLocation, "show", depNames);
List<String> allPipShowLines = Arrays.stream(pipShowOutput.split("---")).collect(Collectors.toList());
List<String> allPipShowLines = splitPipShowLines(pipShowOutput);
Map<StringInsensitive,String> CachedTree = new HashMap<>();
List<String> linesOfRequirements;
try {
Expand Down Expand Up @@ -312,4 +312,8 @@ private static int getFirstSign(int rightTriangleBracket, int leftTriangleBrack
equalsSign = equalsSign == -1 ? 999 : equalsSign;
return equalsSign < leftTriangleBracket && equalsSign < rightTriangleBracket ? equalsSign : (leftTriangleBracket < equalsSign && leftTriangleBracket < rightTriangleBracket ? leftTriangleBracket : rightTriangleBracket);
}

static List<String> splitPipShowLines(String pipShowOutput) {
return Arrays.stream(pipShowOutput.split(System.lineSeparator() + "---" + System.lineSeparator())).collect(Collectors.toList());
}
}
Loading