[Python] failure with setuptools >= 80

Currently each dune subpackage (i.e. module) adds a dune/data folder containing metadata. In python/dune/packagemetadata.py line 544 we then rely on

import dune.data
for metadataPath in dune.data.__path__:

to collect this metadata. For this to work dune.data.__path__ must contain the full list of paths to all dune modules. With setuptools version 80 this does not work anymore. Only dune-common is found this way. We are possibly relying on undefined behavior here with each subpackage having the same folder and assuming those will be all collected into one package. Possibly we need to add the metadata file directly to each subpackage and then use something like

import glob
from importlib import metadata as md
result = {}
for p in md.packages_distributions()["dune"]:
    metadataPath = md.distribution(p).locate_file("dune/data")
    for metaDataFile in glob.glob(os.path.join(metadataPath, "*.cmake")):
        print(metaDataFile)
        with open(metaDataFile, "r") as mdFile:
            ...

This seems not to find dune.common but we know about that dune module anyway. This needs testing and perhaps there is some better approach.

Edited by Andreas Dedner