diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh')
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh index 50f21819d176..15d2bd0eb34c 100644 --- a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh @@ -17,16 +17,17 @@ pythonNamespacesHook() { for pathSegment in ${pathSegments[@]}; do constructedPath=${constructedPath}/${pathSegment} pathToRemove=${constructedPath}/__init__.py - pycachePath=${constructedPath}/__pycache__/__init__* + pycachePath=${constructedPath}/__pycache__/ + # remove __init__.py if [ -f "$pathToRemove" ]; then - echo "Removing $pathToRemove" - rm "$pathToRemove" + rm -v "$pathToRemove" fi - if [ -f "$pycachePath" ]; then - echo "Removing $pycachePath" - rm "$pycachePath" + # remove __pycache__/ entry, can be interpreter specific. E.g. __init__.cpython-38.pyc + # use null characters to perserve potential whitespace in filepath + if [ -d "$pycachePath" ]; then + @findutils@/bin/find "$pycachePath" -name '__init__*' -exec rm -v "{}" + fi done done |