MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / getCondaVersion

Function getCondaVersion

src/test/interpreters/condaService.node.ts:109–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107
108let condaVersion: SemVer | undefined;
109async function getCondaVersion(): Promise<SemVer | undefined> {
110 if (condaVersion) {
111 return condaVersion;
112 }
113 const processService = new ProcessService();
114 const info = await getCondaInfo();
115 let versionString: string | undefined;
116 if (info && info.conda_version) {
117 versionString = info.conda_version;
118 } else {
119 const stdOut = await processService
120 .exec(await getCondaFile(), ['--version'], {})
121 .then((result) => result.stdout.trim())
122 .catch<string | undefined>(() => undefined);
123
124 versionString = stdOut && stdOut.startsWith('conda ') ? stdOut.substring('conda '.length).trim() : stdOut;
125 }
126 if (!versionString) {
127 return;
128 }
129 const version = parse(versionString, true);
130 if (version) {
131 condaVersion = version;
132 return version;
133 }
134 // Use a bogus version, at least to indicate the fact that a version was returned.
135 logger.warn(`Unable to parse Version of Conda, ${versionString}`);
136 return new SemVer('0.0.1');
137}
138
139let condaEnvironments: CondaEnvironmentInfo[] | undefined;
140async function getCondaEnvironments(): Promise<CondaEnvironmentInfo[] | undefined> {

Callers 1

isCondaAvailableFunction · 0.85

Calls 5

execMethod · 0.95
getCondaInfoFunction · 0.85
getCondaFileFunction · 0.85
warnMethod · 0.65
parseFunction · 0.50

Tested by

no test coverage detected