blob: 8bb68ea613c81d73fee0f76b73eff8f97a339722 [file] [log] [blame]
commit-queue@webkit.org026ee042018-01-04 07:18:18 +00001#!/usr/bin/env python
rniwa@webkit.org9b2a8d22012-04-03 18:58:21 +00002#
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
27
28import optparse
29import os
30import subprocess
31import sys
32import urllib
33
34
35def main():
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")
40
41 options, (url, ) = parser.parse_args()
42
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)
47
48 if sys.platform == 'win32': # curl is not availble on Windows (outside of cygwin)
49 urllib.urlretrieve(url, archivePath)
50 return 0
51
52 return subprocess.call(["curl", "--fail", "--output", archivePath, url])
53
54
55if __name__ == '__main__':
56 sys.exit(main())