[bugfix] support Namespace packages in version.py
[bugfix] support Namespace packages in version.py

As per PEP420:
- Namespace packages have no __file__ attribute
- Namespace packages' __path__ attribute is a read-only iterable of strings

In this case __file__ exists and is None.

Add logic to handle also such case.
Some paths have been converted to pathlib.Path() objects instead of str.

Bug: T265946
Change-Id: Iaf57d005c0c8b3d2db3b90ce93105786ef817cc8

wikimedia/pywikibot-core,wikimedia/pywikibot-core