MCPcopy Create free account
hub / github.com/RedisGears/RedisGears / PythonRequirementCtx_Free

Function PythonRequirementCtx_Free

plugins/python/redisgears_python.c:349–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347 RedisModule_Assert(false);
348}
349static void PythonRequirementCtx_Free(PythonRequirementCtx* reqCtx){
350 if(--reqCtx->refCount){
351 return;
352 }
353
354 PythonRequirementCtx_VerifyBasePath(reqCtx);
355 RedisGears_ExecuteCommand(NULL, "notice", "rm -rf '%s'", reqCtx->basePath);
356 if (reqCtx->isInRequirementsDict) {
357 Gears_dictDelete(RequirementsDict, reqCtx->installName);
358 } else if (reqCtx->isInstalled) {
359 // reinstall old requirement if exists
360 PythonRequirementCtx *oldReq = PythonRequirementCtx_Get(reqCtx->installName);
361 if (oldReq) {
362 PythonRequirementCtx_InstallRequirement(oldReq);
363 PythonRequirementCtx_Free(oldReq);
364 }
365 }
366 RG_FREE(reqCtx->installName);
367 RG_FREE(reqCtx->basePath);
368 if(reqCtx->wheels){
369 for(size_t i = 0 ; i < array_len(reqCtx->wheels) ; i++){
370 RG_FREE(reqCtx->wheels[i]);
371 }
372 array_free(reqCtx->wheels);
373 }
374 RG_FREE(reqCtx);
375}
376
377static char* PythonStringArray_ToStr(void* wheel){
378 char* str;

Calls 6

Gears_dictDeleteFunction · 0.85
PythonRequirementCtx_GetFunction · 0.85
array_lenFunction · 0.85
array_freeFunction · 0.85

Tested by

no test coverage detected