[Scons-users] How to _decide_ the target change by a given MD5SUM.

Dirk Bächle tshortik at gmx.de
Sun Jan 18 04:23:43 EST 2015


Hi Alex,

On 18.01.2015 07:00, Xiongfei Guo wrote:
> Hi,
>
> I am writing a builder that can download the file from internet by a
> given URL.[...]
>
> but I want to give a MD5SUM value to the builder that if the _target_
> file is exist and its MD5SUM is equal to the given one, then *do
> nothing*.

this sounds to me as if you don't need a builder at all. Just say something similar to:

   import os
   import SCons.Util
   if not os.path.isfile(target) or SCons.Util.MD5filesignature(target) != "123456789abcdef":
     import urllib
     urllib.urlretrieve(url, target)

Hope this helps...

Best regards,

Dirk



More information about the Scons-users mailing list