当前位置: 动力学知识库 > 问答 > 编程问答 >

How to check if an executable or any of its libraries has been changed with Python

问题描述:

I use some python scripts to test changes I make to a (external) program written in C++. I have several versions of this external program and I have to compare the output of these versions. As the external program takes rather long to run, I'd like to run only those versions which have been changed since the last run of my test. So I need a way to check if the program (or any of its library) has changed.

As I am working under Linux, I suppose I could call 'ldd' and by (recursively) parsing the output, I would get a list of all linked libraries. If I then calculate a hashsum over the program and all the libraries, I probably could get a value which tells me if the program has changed or not.

Now I'd like to know if this is a suitable way and if there is a better (more pythonic) way, probably without having to use the external tool ldd.

分享给朋友:
您可能感兴趣的文章:
随机阅读: