@@ -778,11 +778,6 @@ Method InstallOrDownloadPythonRequirements(
778778 set processType = " requirements.txt"
779779 do ..Log (processType _ " START" )
780780 write :tVerbose !
781-
782- // Clean up existing package installations before pip install
783- // This is necessary because pip with --python-version doesn't check/uninstall existing packages
784- do ..CleanupPythonInstallation (pythonRequirements , target , tVerbose )
785-
786781 set command = ..ResolvePipCaller (.pParams ) _ $listbuild (" install" , " -r" , " requirements.txt" , " -t" , target , " --python-version" , tPyVersion , " --only-binary=:all:" ) _ $listfromstring (tExtraPipFlags , " " )
787782 if tVerbose {
788783 write !, " Running "
@@ -925,69 +920,6 @@ ClassMethod DetectPipCaller(
925920 throw ##class (%Exception.General ).%New (" Could not find a suitable pip caller. Consider setting UseStandalonePip and PipCaller" )
926921}
927922
928- /// Cleans up the existing Python package installation in the specified target directory based on the given requirements.txt file
929- ClassMethod CleanupPythonInstallation (
930- filename As %String ,
931- targetDirectory As %String ,
932- verbose As %Boolean )
933- {
934- set file = ##class (%Stream.FileCharacter ).%New ()
935- set file .Filename = filename
936- while 'file .AtEnd {
937- set line = $zstrip (file .ReadLine (), " <>W" )
938- // Skip comments and empty lines
939- continue :line =" "
940- continue :$extract (line ,1 )=" #"
941-
942- // Extract package name (before any version operator)
943- set packageName = line
944- for operator = " ==" , " >=" , " <=" , " !=" , " ~=" , " >" , " <" {
945- set packageName = $piece (packageName , operator , 1 )
946- }
947- set packageName = $zstrip (packageName , " <>W" )
948-
949- if packageName '= " " {
950- // Remove package directory: <target>/<package>/
951- set packageDir = ##class (%File ).NormalizeDirectory (packageName , targetDirectory )
952- if ##class (%File ).DirectoryExists (packageDir ) {
953- set removed = ##class (%File ).RemoveDirectoryTree (packageDir )
954- if verbose && removed {
955- write !, " Removed old package directory: " , packageDir
956- }
957- }
958-
959- // Remove dist-info directories: <target>/<package>-*.dist-info/
960- set pattern = targetDirectory _ packageName _ " -*.dist-info"
961- set distInfo = $zsearch (pattern )
962- while distInfo '= " " {
963- if ##class (%File ).DirectoryExists (distInfo ) {
964- set removed = ##class (%File ).RemoveDirectoryTree (distInfo )
965- if verbose && removed {
966- write !, " Removed old dist-info: " , distInfo
967- }
968- }
969- set distInfo = $zsearch (" " )
970- }
971-
972- // Also handle underscore variant: <package>_<name>-*.dist-info/
973- set packageUnderscore = $replace (packageName , " -" , " _" )
974- if packageUnderscore '= packageName {
975- set pattern = targetDirectory _ packageUnderscore _ " -*.dist-info"
976- set distInfo = $zsearch (pattern )
977- while distInfo '= " " {
978- if ##class (%File ).DirectoryExists (distInfo ) {
979- set removed = ##class (%File ).RemoveDirectoryTree (distInfo )
980- if verbose && removed {
981- write !, " Removed old dist-info: " , distInfo
982- }
983- }
984- set distInfo = $zsearch (" " )
985- }
986- }
987- }
988- }
989- }
990-
991923Method %Validate (ByRef pParams ) As %Status
992924{
993925 // NOTE: Resource processor classes and their attributes are validated in OnBeforePhase,
0 commit comments