pcdshub / pytmc

Generate EPICS IOCs and records from TwinCAT projects - along with many TwinCAT project tools
https://pcdshub.github.io/pytmc/
Other
10 stars 11 forks source link

REF: rework Box file loading #217

Closed klauer closed 4 years ago

klauer commented 4 years ago

Closes-but-not-really #187

Box files and Devices seem to be easily relocatable and impossible to find without searching. Take for example:

DEBUG:pytmc.parser:Multiple candidates for file Box 32 (EL6692).xti found. Parent: /Users/klauer/docs/Repos/lcls-plc-kfe-arbiter/Arbiter/_Config/IO/Device 1 (EtherCAT)/Box 23 (CU1128).xti:Candidates:
    /Users/klauer/docs/Repos/lcls-plc-kfe-arbiter/Arbiter/_Config/IO/Device 1 (EtherCAT)/Box 18 (CU1128)/Box 32 (EL6692).xti
    /Users/klauer/docs/Repos/lcls-plc-kfe-arbiter/Arbiter/_Config/IO/Device 1 (EtherCAT)/Box 28 (CU1128)/Box 32 (EL6692).xti
/

It seems like it should exist in "Box 23 / Box 32" but rather exists in "Box 18" and "Box 28". Which is the right one? What does Visual Studio do? I don't know, so many questions....

This refactors loading box files into a best-effort "search all IO directories, but find the match that looks closest to where my parent's file was loaded"

cc @slacAWallace

klauer commented 4 years ago

For what it's worth, this works on loading the master branch of the following repositories:

pcdshub/lcls-plc-kfe-gmd-vac
pcdshub/lcls-plc-kfe-xgmd-vac
pcdshub/lcls-plc-lfe-motion
pcdshub/lcls-plc-kfe-vac
pcdshub/lcls-plc-lfe-optics
pcdshub/lcls-plc-lfe-motion-kmono
pcdshub/lcls-plc-lfe-vac
pcdshub/lcls-plc-kfe-motion
pcdshub/lcls-plc-tmo-motion
pcdshub/lcls-plc-kfe-rix-motion
pcdshub/lcls-plc-lfe-gem
pcdshub/lcls-plc-lfe-arbiter
pcdshub/lcls-plc-vls-vac
pcdshub/lcls-plc-crixs-vac
pcdshub/lcls-plc-crixs-motion
pcdshub/lcls-plc-kfe-rix-vac
pcdshub/lcls-plc-roving-spectrometer
pcdshub/lcls-plc-kfe-arbiter
klauer commented 4 years ago

I think this is wrong. I'll rewrite this hopefully later today: