Last year I was faced with the daunting task of converting a large amount of Bash scripts to C-code. A terrible thing to do since we did a lot of stdio processing/redirecting which is simple to do in Bash but horrible in C. The reason for this atrocity was the fact that Bash did not work on our uClinux platform and none of the clones implemented enough feature to be compatible with our rather complicated scripts.
I went with a multicall binary in order to reduce the flash storage footprint and the end result is 100% compatible with the original scripts. On the downside the SLOC increased nearly four times and it was a PITA to implement.
Recently Kristian recommended that I should take a look at Python. At first I was skeptical for several reasons. If Bash wasn’t portable to uClinux then why would Python be considering it has so many more features. I’m also very careful about adding large complex software packages to an already sensitive platform.
A couple of weeks ago I had some time over and was terribly bored so I decided to give cross-compiling Python a go. As it turns out their build system isn’t cross-compile-aware at all but I did manage to build a working interpreter. Today Kristian found a guide on how to cross-compile the modules as well and so we were able to build a complete Python distribution. Surprisingly it seems to be working very well and so far memory consumption is within reasonable boundaries which is impressive. I’m not sure I want to port all the already converted Bash-scripts to Python right now but at least it is a perfectly viable option and would most likely increase code quality significantly in the long run.