[tbot] [DENX] tbot: board hangs if no autoload

Harald Seiler hws at denx.de
Fri Nov 16 09:42:52 UTC 2018


On Fri, 2018-11-16 at 08:19 +0100, Heiko Schocher wrote:
> Hello Harald,
> 
> Am 16.11.2018 um 06:41 schrieb Heiko Schocher:
> > Hello Harald, Stefano,
> > 
> > Am 15.11.2018 um 19:22 schrieb Stefano Babic:
> > > Hi Harald,
> > > 
> > > On 15/11/18 16:59, Harald Seiler wrote:
> > > > Hi Stefano, Heiko,
> 
> [...]
> > > > If you want a board to work in multiple labs, you could make
> > > > the board-config check which lab was selected and use a different
> > > > base class depending on that:
> > > > 
> > > >     if tbot.selectable.LabHost.name == "pollux":
> > > >         # Use pollux specific config
> > > >         import denx
> > > >         BoardBase = denx.DenxBoard
> > > >     elif tbot.selectable.LabHost.name == "sbabic":
> > > >         # Use your personal lab config
> > > >         import sbabic
> > > >         BoardBase = sbabic.SbabicBoard
> > > >     else:
> > > >         raise NotImplementedError("Board not available on this labhost!")
> > > > 
> > > >     class Mira(BaseBoard):
> > > >         ...
> > > 
> > > Good idea, thanks, I will do in this way.
> > 
> > I try it.
> 
> Doe not work for me ...  I am a dummy pyhton user ...
> 
> I have:
> 
> class Tbot2goLab(lab.SSHLabHost):
> 
>      @property
>      def name(self) -> str:
>          return "tbot2go"
> 
>      namestr = "tbot2go"
> 
> (namestr only for testing)

Way too complex, just use

	class TBot2GoLab(lab.SSHLabHost):
	    name = "tbot2go"

	    # SSHLabHost has a few mandatory config options:
	    hostname = "raspberry.homenetwork"

	    @property
	    def workdir(self) -> "linux.Path[TBot2GoLab]":
	        # Workdir is `~/tbot-workdir`
	        return linux.Workdir.athome(self, "tbot-workdir")

> 
> If I add in your example:
> 
> print(" ======= ", tbot.selectable.LabHost.name, tbot.selectable.LabHost.namestr)

TBot has `tbot.log.message` instead of print ;)

(print also works, but doesn't get added to the log ...)

> 
> if tbot.selectable.LabHost.name == "pollux":
> 
> I see:
> 
> TBot starting ...
>   =======  <property object at 0x7f2e67756b38> tbot2go
> 
> So tbot.selectable.LabHost.name does not return the string ...
> 
> tbot.selectable.LabHost.name() also does not work:
> 
> TBot starting ...
>   =======  <property object at 0x7f8e45febb38> tbot2go
> Traceback (most recent call last):
>    File "/home/hs/.local/bin/tbot", line 12, in <module>
>      sys.exit(main())
>    File "/home/hs/.local/lib/python3.6/site-packages/tbot-0.6.0-py3.6.egg/tbot/main.py", line 177, 
> in main
>      board = loader.load_module(pathlib.Path(args.board).resolve())
>    File "/home/hs/.local/lib/python3.6/site-packages/tbot-0.6.0-py3.6.egg/tbot/loader.py", line 63, 
> in load_module
>      module_spec.loader.exec_module(module)
>    File "<frozen importlib._bootstrap_external>", line 678, in exec_module
>    File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
>    File "/home/hs/data/Entwicklung/newtbot/tbot-tbot2go/boards/k30rf.py", line 7, in <module>
>      print(" ======= ", tbot.selectable.LabHost.name())
> TypeError: 'property' object is not callable
> 
> 
> bye,
> Heiko

-- 
Harald

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-62  Fax: +49-8142-66989-80   Email: hws at denx.de


More information about the tbot mailing list