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

ENH: handle ST_MotionStage/DUT_MotionStage rename and aliasing #308

Closed ZLLentz closed 1 year ago

ZLLentz commented 1 year ago

In https://github.com/pcdshub/lcls-twincat-motion/pull/163, one of the things I do is rename DUT_-prefixed structs to ST_ to be in-line with naming conventions. I leave the DUT_ version behind as a deprecated alias of the ST_ version, so as far as PLC projects go this is pretty transparent: leaving the code as-is gives a warning but continues to work, update the name to get rid of the warning.

This caused a problem here in pytmc where we ascribe specific meaning to DUT_MotionStage. This is actually the second time we've had such a problem.

This PR renames DUT_MotionStage support to ST_MotionStage and adds a mechanism for symbols to define a list of aliases, adding DUT_MotionStage as an alias of ST_MotionStage.

This did help my open demo/example PR include all the previously missing motors. See here for the source code where I have a mix of both symbol names and here for the difference after using this diff.

I've added and adjusted unit tests as appropriate, including adding a real motion lib project for completeness.

In addition, I made a small tweak to the version file. I'm using PYTHONPATH munging with some symbolic link magic to test this and I noticed that the git version checker doesn't resolve the link. This caused an issue because the ads-ioc Makefile checks the pytmc version.