Whne your Python skills are not there

More
3 years 3 months ago #275767 by Cant do this anymore bye all
Been helping out with Litex-CNC and because 2.9 no longer defines EMC2_RTLIB_DIR, well config.h is no longer in the include directory for the dev package, there was a need to parse Makefile.modinc and cos my python is poor this is what I cam up with.
Code:
modinc_result = subprocess.run(["sed -n '/RUN_IN_PLACE/, /endif/{/EXTRA/d;/^LIB/d;/^prefix/d;s/[[:blank:]]:=//;s/=no/ 0/;s/=yes/ 1/;s/^R/#define R/;s/ifeq.*/#if RUN_IN_PLACE == 1/;s/^endif/#endif/;s/^else/#else/;s/RTLIBDIR /EMC2_RTLIB_DIR \"/;/EMC2/ s/$/\"/;p}' `halcompile --print-modinc`"], shell=True, capture_output=True, text=True)

If you look at it as all on one line you'll see the true horror that it is. And apparently I've forgooten how to English today as well.

Please Log in to join the conversation.

Time to create page: 0.130 seconds
Powered by Kunena Forum