@@ -546,5 +546,23 @@ if [[ "$target_platform" == linux-* ]]; then
546546 rm ${PREFIX} /include/uuid.h
547547fi
548548
549- # See ${RECIPE_DIR}/sitecustomize.py
550- cp " ${RECIPE_DIR} /sitecustomize.py" " ${PREFIX} /lib/python${VERABI_NO_DBG} /sitecustomize.py"
549+ # Workaround for https://github.com/conda/conda/issues/14053
550+ # Older conda versions install noarch: python packages in wrong places.
551+ # For example python3.1 because older conda assumed python minor version
552+ # will have only one digit. noarhc pkgs for freethreading builds are supposed
553+ # to be installed into <prefix>/lib/python3.13t/site-packages, but conda
554+ # installs them to <prefix>/lib/python3.13/site-packages.
555+ # The workaround is to add all these wrong paths to sys.path using
556+ # site.addsitedir so that cpython and other tools like pip know about these
557+ # locations to check when importing packages and uninstalling packages.
558+ # When installing packages, pip will use the correct location
559+ # <prefix>/lib/python3.13t/site-packages.
560+ SP_DIR=" ${PREFIX} /lib/python${PY_VER} {THREAD}/site-packages"
561+ if [[ ${PY_FREETHREADING} == yes ]]; then
562+ echo " ${PREFIX} /lib/python${PY_VER} /site-packages" >> $SP_DIR /conda-site.pth
563+ fi
564+ # Workaround for https://github.com/conda/conda/issues/10969
565+ echo " ${PREFIX} /lib/python3.1/site-packages" >> $SP_DIR /conda-site.pth
566+ # A python version independent directory that ABI3 and noarch packages can use.
567+ # This is unused at the moment, but keeping it here for experimentation.
568+ echo " ${PREFIX} /lib/python/site-packages" >> $SP_DIR /conda-site.pth
0 commit comments