2009/9/15 Bob Proulx <b...@proulx.com>: > Jason Heeris wrote: >> I'm using patch from with a python script, and I was thinking of parsing
> I read this as you are running 'patch' as an external system command > and capturing the output and then parsing it to determine if patches > were successfully implemented or if not what was rejected? Yep, exactly. I parse the output to extract the information: file patched, success, reject file (if applicable). >> Or a library? Text output is not strictly an API at all, let alone a >> stable one :P and I worry that the output of patch won't remain the > > If you only use standard features you will improve your portability. > > http://www.opengroup.org/onlinepubs/009695399/utilities/patch.html My only fear was that a particular error message might change, or some other detail of the text output. This seems unlikely the more I think about it. I think for now I'll just relax and make sure my parsing is as sensible as possible. >> way it is now, especially error messages. (I don't think that patch >> is translated by any major distro, so that's probably ignorable.) > > For automated parsing you might be best served by forcing a standard > locale setting with 'LC_ALL=POSIX' (aka 'LC_ALL=C') when running the > program. This is great advice, thanks, I hadn't thought of this. Cheers, Jason Heeris