waf: allow overriding uploader script with custom uploader script

This commit is contained in:
bugobliterator 2021-07-07 17:38:00 +05:30 committed by Andrew Tridgell
parent 4ed0b03f35
commit a5d3dade67

View File

@ -56,6 +56,10 @@ class upload_fw(Task.Task):
upload_tools = self.env.get_flat('UPLOAD_TOOLS')
upload_port = self.generator.bld.options.upload_port
src = self.inputs[0]
# Refer Tools/scripts/macos_remote_upload.sh for details
if 'AP_OVERRIDE_UPLOAD_CMD' in os.environ:
cmd = "{} '{}'".format(os.environ['AP_OVERRIDE_UPLOAD_CMD'], src.abspath())
else:
cmd = "{} '{}/uploader.py' '{}'".format(self.env.get_flat('PYTHON'), upload_tools, src)
if upload_port is not None:
cmd += " '--port' '%s'" % upload_port