Exemplo n.º 1
0
    def get_download_url(self):
        """ Read the addon.ini file and get the URL of the XPI. """

        filename = None

        # Get the platform the script is running on
        if sys.platform in ("cygwin", "win32"):
            platform = "win"
        elif sys.platform in ("darwin"):
            platform = "mac"
        elif sys.platform in ("linux2", "sunos5"):
            platform = "linux"
        else:
            platform = None

        try:
            filename = os.path.join(self.repository_path, self._addon_path,
                                    "addon.ini")
            config = ConfigParser.RawConfigParser()
            config.read(filename)

            return config.get("download", platform)
        except Exception, e:
            raise errors.NotFoundException('Could not read URL settings',
                                           filename)
Exemplo n.º 2
0
    def _set_binary(self, build):
        """ Sets the list of binaries to test. """
        self._binary = None

        build = os.path.abspath(build)

        if not os.path.exists(build):
            raise errors.NotFoundException('Path cannot be found', build)

        # Check if it's an installer or an already installed build
        # We have to custom checks via application.is_app_folder as long as
        # mozinstall can't check for an installer (bug 795288)
        if application.is_installer(build, self.options.application) or \
                application.is_app_folder(build):
            self._binary = build
            return

        # Otherwise recursivily scan the folder and select the first found build
        for root, dirs, files in os.walk(build):
            # Ensure we select the build by alphabetical order
            files.sort()

            for f in files:
                if not f in [".DS_Store"] and \
                        application.is_installer(f, self.options.application):
                    self._binary = os.path.abspath(os.path.join(root, f))
                    return
Exemplo n.º 3
0
 def channel_prefs_path(self):
     """ Returns the channel prefs path. """
     for pref_folder in ('preferences', 'pref'):
         pref_path = os.path.join(self.folder, 'defaults', pref_folder,
                                  'channel-prefs.js')
         if os.path.exists(pref_path):
             return pref_path
     raise errors.NotFoundException('Channel prefs not found.', pref_path)
Exemplo n.º 4
0
    def read(self):
        if not os.path.isfile(self.filename):
            raise errors.NotFoundException('Specified file cannot be found.',
                                           self.filename)

        try:
            f = open(self.filename, 'r')
            return json.loads(f.read())
        finally:
            f.close()
Exemplo n.º 5
0
    def get_download_url(self):
        """ Read the addon.ini file and get the URL of the XPI. """

        filename = None

        try:
            filename = os.path.join(self.repository.path, self._addon_path, "addon.ini")
            config = ConfigParser.RawConfigParser()
            config.read(filename)

            # Get the platform to download platform specific add-ons
            platform = 'linux' if mozinfo.os in ['bsd', 'unix'] else mozinfo.os

            return config.get("download", platform)
        except Exception:
            raise errors.NotFoundException('Could not read URL settings', filename)