MCPcopy Create free account
hub / github.com/MITK/MITK / ExtractPackageName

Function ExtractPackageName

Modules/PythonInstaller/src/QmitkPipInstaller.cpp:75–87  ·  view source on GitHub ↗

Extract the package-name prefix of a requirement specifier. Stops at the first character that is not part of a PEP 508 distribution name.

Source from the content-addressed store, hash-verified

73 // Extract the package-name prefix of a requirement specifier.
74 // Stops at the first character that is not part of a PEP 508 distribution name.
75 std::string ExtractPackageName(const std::string& requirement)
76 {
77 std::size_t end = 0;
78 while (end < requirement.size())
79 {
80 char c = requirement[end];
81 if (std::isalnum(static_cast<unsigned char>(c)) || c == '_' || c == '.' || c == '-')
82 ++end;
83 else
84 break;
85 }
86 return requirement.substr(0, end);
87 }
88
89 // Check whether a requirement is a direct reference (VCS URL or PEP 508
90 // "name @ url" form) rather than a regular PyPI specifier.

Callers 1

ParseResolveReportMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected