fixup_python: avoid directory shadowing problems
Packages can ship with the following layout:
package/ module.py module/resources
The old search pattern would be told "look for package.module
and try
the extensions to install what is needed. However, this would end up
installing module.py
twice: once when package/module/
is found and
again when package/module.py
is found.
This is normally fine as a double install would just replace the same
content. However, if the directory is named MODULE
and the filesystem
is case-insensitive (such as macOS and Windows), module.py
gets
installed as MODULE.py
. When the second install comes around, the
case-preserving nature of these filesystems will keep the uppercase
variant. This ends up causing all kinds of fun later.
To fix this:
- check for directory-ness first
- if a file was found, skip the directory check