Search code examples
pythonscons

Can SCons download files on its own?


I'm researching SCons options for downloading external dependencies and I'm rather new to it. So, is there a way to download files required during the build from the network, or will I have to just write that in Python?

Thanks.


Solution

  • Yeah, downloading files you can implement only with python. With scons you can make special Action (which call you python implementation of downloading files) and set Depends to other targets/sources. But it's seems too difficult to check depends of network files. I recommend you to split it to 2 tasks. First - check files and build, second - downloading files.

    if not CheckNetworkFiles() :
        print "Network files not found, run: scons download_network_files to correct it."
        Exit(1)
    // else continue build
    
    ...
    if "download_network_files" in COMMAND_LINE_TARGETS:
        Exit( downloadNetworkFiles() ) // python code for downloading files