You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When distributed independently of Zephyr, DTSh has to re-package snapshots of the python-devicetree library, which is normally part of Zephyr's devicetree tooling (5e803eb).
Zephyr users will then end up with two instances of this library:
the one that comes with Zephyr, on which it will rely at build-time
the one installed with DTSh
This is almost harmless because Zephyr's tools that depend on the Python devicetree package will still prefer the version at zephyr/scripts/dts/python-devicetree/src, thanks to sys.path manipulations:
# This relies on this file being zephyr/scripts/foo/bar.py.# If you move this file, you'll break it, so be careful.THIS_ZEPHYR=Path(__file__).parent.parent.parentZEPHYR_BASE=Path(os.environ.get('ZEPHYR_BASE', THIS_ZEPHYR))
# FIXME we need a nicer way to handle imports from scripts and cmake than this.ZEPHYR_SCRIPTS=ZEPHYR_BASE/'scripts'ZEPHYR_CMAKE=ZEPHYR_BASE/'cmake'# Runners depend on edtlib. Make sure the copy in the tree is# available to them before trying to import any.sys.path.insert(0, str(ZEPHYR_SCRIPTS/'dts'/'python-devicetree'/'src'))
Relying on how Zephyr imports the library sounds a but ugly, though. And will break one day or another.
AFAICT, we can't properly address this issue when installing DTSh from PyPY (this would require that both Zephyr and DTSh depend on and install independently released versions of python-devicetree).
Note: DTSh could implement some ugly sys.path manipulation to also prefer the devicetree library that comes with Zephyr (e.g. when ZEPHYR_BASE is set), but then it's likely that it won't import the version of the library it's been developed and tested with. This is not a proper fix.
Thanks.
The text was updated successfully, but these errors were encountered:
dottspina
changed the title
Possible multiple different versions of python-devicetree
ci: possible multiple different versions of python-devicetree
Mar 13, 2024
The PropertySec.path API in the python-devicetree library
wrongly tells all properties originate from the top-level
binding file, which causes the cat command to show
misleading and confusing paths (see issue #5).
We've proposed a patch upstream, but its review clearly is
not a priority (the underlying issue has no consequence on
Zephyr use of the library).
Applying this patch here:
- does actually fix the cat command, and does not otherwise break DTSh
- can't break Zephyr in any way (will still use its own unpatched
version of the python-devicetree library, see issue #2)
When distributed independently of Zephyr, DTSh has to re-package snapshots of the python-devicetree library, which is normally part of Zephyr's devicetree tooling (5e803eb).
Zephyr users will then end up with two instances of this library:
This is almost harmless because Zephyr's tools that depend on the Python
devicetree
package will still prefer the version atzephyr/scripts/dts/python-devicetree/src
, thanks tosys.path
manipulations:Relying on how Zephyr imports the library sounds a but ugly, though. And will break one day or another.
AFAICT, we can't properly address this issue when installing DTSh from PyPY (this would require that both Zephyr and DTSh depend on and install independently released versions of python-devicetree).
Note: DTSh could implement some ugly
sys.path
manipulation to also prefer thedevicetree
library that comes with Zephyr (e.g. whenZEPHYR_BASE
is set), but then it's likely that it won't import the version of the library it's been developed and tested with. This is not a proper fix.Thanks.
The text was updated successfully, but these errors were encountered: