3 # Copyright (C) 2009 Apple Inc. All rights reserved.
4 # Copyright (C) 2012 Google Inc. All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
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.
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.
36 parser = optparse.OptionParser("usage: %prog [options] [url]")
37 parser.add_option("--platform", dest="platform")
38 parser.add_option("--debug", action="store_const", const="debug", dest="configuration")
39 parser.add_option("--release", action="store_const", const="release", dest="configuration")
41 options, (url, ) = parser.parse_args()
43 archiveDir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "WebKitBuild"))
44 if not os.path.isdir(archiveDir):
45 os.makedirs(archiveDir)
46 archivePath = os.path.join(archiveDir, "%s.zip" % options.configuration)
48 if sys.platform == 'win32': # curl is not availble on Windows (outside of cygwin)
49 urllib.urlretrieve(url, archivePath)
52 return subprocess.call(["curl", "--fail", "--output", archivePath, url])
55 if __name__ == '__main__':