python/hooks/pythonNamespaces: fix __pycache__ logic
This commit is contained in:
committed by
Jonathan Ringer
parent
95d9ff16f3
commit
f5d9dd3050
@@ -17,17 +17,16 @@ 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"
|
||||
fi
|
||||
# remove __pycache__/ entry, can be interpreter specific. E.g. __init__.cpython-38.pyc
|
||||
# use null characters to perserve potential whitespace in filepath
|
||||
@findutils@/bin/find $pycachePath -name '__init__*' -print0 | xargs -0 rm -v
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user