I am developing a custom component that obtains several points (coordinates) and calculate which of them is closest to my location.
I have been using an iterative method to calculate distance, good enough for one use, but if I want to use it several times it is slow and computational costly O(n).
I have researched possibility to use scipy package and KD-Tree which is O(log n) and therefore less costly.
But in my Rasperry Pi, scipy does not compile. Neither with fresh install of raspbian or hassio.
Is there any way to include conditional dependencies on
manifest.json on my custom component to indicate that if hardware is RPI do not even try to compile scipy package and if hardware is other use the scipy package.
In my code I have solved (manually rigth now) but it should be easy to detect hw automatically
class distances(): def __init__(self, hw_used='RPI'): self.calculate_distance = self._calculate_distance_kdtree if hw_used == 'RPI': self.calculate_distance = self._calculate_distance_iterate def _calculate_distance_kdtree(self, point, list_points): (...) def _calculate_distance_iterate(self, point, list_points): (...)