@@ -1991,7 +1991,25 @@ def Deploy_Binaries_For_Bundle(config, parameters):
19911991 cmd06 = "rm -rf %s" % binTarget
19921992
19931993 cmd07 = "mkdir %s" % sitepackagesTarget
1994- cmd08 = "cp -RL %s/{*distutils*,pip*,pkg_resources,setuptools*,wheel*} %s" % (sitepackagesSource , sitepackagesTarget )
1994+ # cmd08 = "cp -RL %s/{*distutils*,pip*,pkg_resources,setuptools*,wheel*} %s" % (sitepackagesSource, sitepackagesTarget)
1995+ # Updated for compatibility with modern Python environments (e.g., pip 26.0.1+).
1996+ # Since 'pkg_resources' and other legacy paths may be absent in recent setuptools,
1997+ # we use a loop to copy only available directories while suppressing errors.
1998+ # Define patterns for essential packages to be bundled
1999+ patterns = ['*distutils*' , 'pip*' , 'pkg_resources*' , 'setuptools*' , 'wheel*' ]
2000+ sources = []
2001+
2002+ # Collect only existing paths to avoid "No such file or directory" errors,
2003+ # especially for 'pkg_resources' which is deprecated and often missing in Python 3.11+.
2004+ for p in patterns :
2005+ sources .extend (glob .glob (os .path .join (sitepackagesSource , p )))
2006+
2007+ if sources :
2008+ # Join all existing paths into a single string for the 'cp' command
2009+ cmd08 = "cp -RL %s %s" % (" " .join (sources ), sitepackagesTarget )
2010+ else :
2011+ # Fallback or log if no packages are found
2012+ cmd08 = "echo 'No matching site-packages found to copy; skipping.'"
19952013
19962014 shell_commands = list ()
19972015 shell_commands .append (cmd01 )
0 commit comments