download-built-product 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/python
  2. #
  3. # Copyright (C) 2009 Apple Inc. All rights reserved.
  4. # Copyright (C) 2012 Google Inc. All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions
  8. # are met:
  9. #
  10. # 1. Redistributions of source code must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. # 2. Redistributions in binary form must reproduce the above copyright
  13. # notice, this list of conditions and the following disclaimer in the
  14. # documentation and/or other materials provided with the distribution.
  15. #
  16. # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  17. # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  20. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  25. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. import optparse
  27. import os
  28. import subprocess
  29. import sys
  30. import urllib
  31. def main():
  32. parser = optparse.OptionParser("usage: %prog [options] [url]")
  33. parser.add_option("--platform", dest="platform")
  34. parser.add_option("--debug", action="store_const", const="debug", dest="configuration")
  35. parser.add_option("--release", action="store_const", const="release", dest="configuration")
  36. options, (url, ) = parser.parse_args()
  37. archiveDir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "WebKitBuild"))
  38. if not os.path.isdir(archiveDir):
  39. os.makedirs(archiveDir)
  40. archivePath = os.path.join(archiveDir, "%s.zip" % options.configuration)
  41. if sys.platform == 'win32': # curl is not availble on Windows (outside of cygwin)
  42. urllib.urlretrieve(url, archivePath)
  43. return 0
  44. return subprocess.call(["curl", "--fail", "--output", archivePath, url])
  45. if __name__ == '__main__':
  46. sys.exit(main())