Esempio n. 1
0
  def _ParseArgs(self):
    parser = optparse.OptionParser()
    parser.add_option(
        '-d', '--outdir', type='string', default=None,
        help='Directory in which to setup. This is typically the directory '
             'where the binaries would go when compiled from source.')
    parser.add_option(
        '-p', '--platform', type='string',
        default=pyauto_utils.GetCurrentPlatform(),
        help='Platform. Valid options: win, mac, linux32, linux64. '
             'Default: current platform (%s)' %
             pyauto_utils.GetCurrentPlatform())
    self._options, self._args = parser.parse_args()
    if not self._options.outdir:
      print >>sys.stderr, 'Need output directory: -d/--outdir'
      sys.exit(1)
    if not self._args:
      print >>sys.stderr, 'Need download url'
      sys.exit(2)
    self._outdir = self._options.outdir
    self._url = self._args[0]

    # Determine name of zip.
    if not self._options.platform.startswith('linux'):
      self._chrome_zip_name = 'chrome-%s' % { 'mac': 'mac',
                                              'win': 'win32'
                                            }[self._options.platform]
    else:
      linux_32_names = ['linux', 'lucid32bit']
      linux_64_names = ['linux64', 'lucid64bit']
      linux_names = { 'linux': linux_32_names + linux_64_names,
                      'linux32': linux_32_names,
                      'linux64': linux_64_names
                    }[self._options.platform]
      for name in linux_names:
        zip_name = 'chrome-' + name
        if self._DoesURLExist('%s/%s.zip' % (self._url, zip_name)):
          self._chrome_zip_name = zip_name
          break
      else:
        raise RuntimeError('Could not find chrome zip at ' + self._url)

    # Setup urls to download.
    self._chrome_zip_url = '%s/%s.zip' % (self._url, self._chrome_zip_name)
    self._it2me_zip_url = self._url + '/' + 'remoting-it2me.zip'
    chrome_test_url = '%s/%s.test' % (self._url, self._chrome_zip_name)
    self._pyautolib_py_url = '%s/pyautolib.py' % chrome_test_url
    if self._options.platform == 'win':
      self._pyautolib_so_name = '_pyautolib.pyd'
      self._chromedriver_name = 'chromedriver.exe'
    else:
      self._pyautolib_so_name = '_pyautolib.so'
      self._chromedriver_name = 'chromedriver'
    self._pyautolib_so_url = chrome_test_url + '/' + self._pyautolib_so_name
    self._chromedriver_url = chrome_test_url + '/' + self._chromedriver_name
    def _ParseArgs(self):
        parser = optparse.OptionParser()
        parser.add_option(
            '-d',
            '--outdir',
            type='string',
            default=None,
            help='Directory in which to setup. This is typically the directory '
            'where the binaries would go when compiled from source.')
        parser.add_option(
            '-p',
            '--platform',
            type='string',
            default=pyauto_utils.GetCurrentPlatform(),
            help='Platform. Valid options: win, mac, linux32, linux64. '
            'Default: current platform (%s)' %
            pyauto_utils.GetCurrentPlatform())
        self._options, self._args = parser.parse_args()
        if not self._options.outdir:
            print >> sys.stderr, 'Need output directory: -d/--outdir'
            sys.exit(1)
        if not self._args:
            print >> sys.stderr, 'Need download url'
            sys.exit(2)
        self._outdir = self._options.outdir
        self._url = self._args[0]

        # Setup urls to download
        self._chrome_zip_name = 'chrome-%s' % {
            'linux64': 'linux64bit',
            'linux32': 'linux32bit',
            'mac': 'mac',
            'win': 'win32'
        }[self._options.platform]
        self._chrome_zip_url = '%s/%s.zip' % (self._url, self._chrome_zip_name)
        chrome_test_url = '%s/%s.test' % (self._url, self._chrome_zip_name)
        self._pyautolib_py_url = '%s/pyautolib.py' % chrome_test_url
        self._pyautolib_so_url = '%s/%s' % (chrome_test_url, {
            'linux64': 'lib.target/_pyautolib.so',
            'linux32': 'lib.target/_pyautolib.so',
            'mac': '_pyautolib.so',
            'win': '_pyautolib.pyd',
        }[self._options.platform])
Esempio n. 3
0
    def _ParseArgs(self):
        parser = optparse.OptionParser()
        parser.add_option(
            '-d',
            '--outdir',
            type='string',
            default=None,
            help='Directory in which to setup. This is typically the directory '
            'where the binaries would go when compiled from source.')
        parser.add_option(
            '-p',
            '--platform',
            type='string',
            default=pyauto_utils.GetCurrentPlatform(),
            help='Platform. Valid options: win, mac, linux32, linux64. '
            'Default: current platform (%s)' %
            pyauto_utils.GetCurrentPlatform())
        parser.add_option(
            '-l',
            '--latest',
            action='store_true',
            default=False,
            help='Download the latest chromium build from commondatastorage. '
            '[default=False]')
        self._options, self._args = parser.parse_args()
        if self._options.latest:
            self._url = self._GetLastestDownloadURL(self._options.platform)
        elif not self._args:
            print >> sys.stderr, 'Need download url'
            sys.exit(2)
        else:
            self._url = self._args[0]
        if not self._options.outdir:
            print >> sys.stderr, 'Need output directory: -d/--outdir'
            sys.exit(1)
        self._outdir = self._options.outdir
        # Chromium continuous build archive has a non-standard format.
        if 'index.html?path=' in self._url:
            self._url = self._url.replace('index.html?path=', '')
        self._url = self._url.rstrip('/')
        # Determine name of zip.
        if not self._options.platform.startswith('linux'):
            self._chrome_zip_name = 'chrome-%s' % {
                'mac': 'mac',
                'win': 'win32'
            }[self._options.platform]
        else:
            linux_32_names = ['linux', 'lucid32bit']
            linux_64_names = ['linux64', 'lucid64bit']
            linux_names = {
                'linux': linux_32_names + linux_64_names,
                'linux32': linux_32_names,
                'linux64': linux_64_names
            }[self._options.platform]
            for name in linux_names:
                zip_name = 'chrome-' + name
                if self._DoesURLExist('%s/%s.zip' % (self._url, zip_name)):
                    self._chrome_zip_name = zip_name
                    break
            else:
                raise RuntimeError('Could not find chrome zip at ' + self._url)

        # Setup urls to download.
        self._chrome_zip_url = '%s/%s.zip' % (self._url, self._chrome_zip_name)
        self._remoting_zip_url = self._url + '/' + 'remoting-webapp.zip'
        chrome_test_url = '%s/%s.test' % (self._url, self._chrome_zip_name)
        self._pyautolib_py_url = '%s/pyautolib.py' % chrome_test_url
        if self._options.platform == 'win':
            self._pyautolib_so_name = '_pyautolib.pyd'
            self._chromedriver_name = 'chromedriver.exe'
        else:
            self._pyautolib_so_name = '_pyautolib.so'
            self._chromedriver_name = 'chromedriver'
        if self._options.platform == 'mac':
            self._ffmpegsumo_so_name = 'ffmpegsumo.so'
            self._ffmpegsumo_so_url = chrome_test_url + '/' + self._ffmpegsumo_so_name
        self._pyautolib_so_url = chrome_test_url + '/' + self._pyautolib_so_name
        self._chromedriver_url = chrome_test_url + '/' + self._chromedriver_name