Example #1
0
    def __install(self, config):
        remove_common_prefix = (config.has('remove_common_prefix') and
                                config.is_affirmative('remove_common_prefix'))
        destination = config.get(
            'target', self.directory.install_directory(self.feature_name))
        url_type = config.get('type', config.get('url'))
        try:
            if url_type.endswith("tar.gz") or url_type.endswith(
                    "tar.bz2") or url_type.endswith("tar"):
                lib.extract_targz(config.get('url'),
                                  destination,
                                  remove_common_prefix=remove_common_prefix)

            elif config.get('type', config.get('url')).endswith("zip"):
                lib.extract_zip(config.get('url'),
                                destination,
                                remove_common_prefix=remove_common_prefix)

            elif config.get('type', config.get('url')).endswith("dmg"):
                if not system.is_osx():
                    self.logger.warn(
                        "Non OSX based distributions can not install a dmg!")
                else:
                    lib.extract_dmg(config.get('url'),
                                    destination,
                                    remove_common_prefix=remove_common_prefix)
        except ExtractException:
            self.logger.warn("Unable to extract file for feature %s" %
                             self.feature_name)
Example #2
0
 def integrate_dmg(self):
     """ Test if the dmg install works """
     test_dir = tempfile.mkdtemp()
     try:
         lib.extract_dmg("https://dl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg", test_dir)
         assert os.path.exists(os.path.join(test_dir, "Google Chrome.app")), "app was not extracted!"
     finally:
         shutil.rmtree(test_dir)
Example #3
0
 def integrate_dmg(self):
     """ Test if the dmg install works """
     test_dir = tempfile.mkdtemp()
     try:
         lib.extract_dmg("https://dl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg", test_dir)
         assert os.path.exists(os.path.join(test_dir, "Google Chrome.app")), "app was not extracted!"
     finally:
         shutil.rmtree(test_dir)
Example #4
0
 def __install_p4v_osx(self, url, overwrite=False):
     """ Install perforce applications and binaries for mac """
     package_exists = False
     root_dir = os.path.expanduser(os.path.join("~", "Applications"))
     package_exists = len([x for x in P4V_APPLICATIONS if os.path.exists(os.path.join(root_dir, x))])
     if not package_exists or overwrite:
         lib.extract_dmg(url, root_dir)
     else:
         self.logger.warn("P4V exists already in %s! Not overwriting..." % root_dir)
     return True
Example #5
0
 def integrate_dmg_with_overwrite(self):
     """ Test if the dmg install works, with an overwrite """
     test_dir = tempfile.mkdtemp()
     try:
         os.mkdir(os.path.join(test_dir, "sprinter"))
         lib.extract_targz(TEST_TARGZ, test_dir, remove_common_prefix=True)
         assert not os.path.exists(os.path.join(test_dir, "sprinter", "sprinter"))
         lib.extract_targz(TEST_TARGZ, test_dir, remove_common_prefix=True, overwrite=True)
         assert os.path.exists(os.path.join(test_dir, "sprinter", "formulas"))
         lib.extract_dmg("https://dl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg", test_dir, overwrite=True)
         assert os.path.exists(os.path.join(test_dir, "Google Chrome.app")), "app was not extracted!"
     finally:
         shutil.rmtree(test_dir)
Example #6
0
 def integrate_dmg_with_overwrite(self):
     """ Test if the dmg install works, with an overwrite """
     test_dir = tempfile.mkdtemp()
     try:
         os.mkdir(os.path.join(test_dir, "sprinter"))
         lib.extract_targz(TEST_TARGZ, test_dir, remove_common_prefix=True)
         assert not os.path.exists(os.path.join(test_dir, "sprinter", "sprinter"))
         lib.extract_targz(TEST_TARGZ, test_dir, remove_common_prefix=True, overwrite=True)
         assert os.path.exists(os.path.join(test_dir, "sprinter", "formulas"))
         lib.extract_dmg("https://dl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg", test_dir, overwrite=True)
         assert os.path.exists(os.path.join(test_dir, "Google Chrome.app")), "app was not extracted!"
     finally:
         shutil.rmtree(test_dir)
Example #7
0
    def __install(self, config):
        remove_common_prefix = config.has("remove_common_prefix") and config.is_affirmative("remove_common_prefix")
        destination = config.get("target", self.directory.install_directory(self.feature_name))
        try:
            if config.get("type", config.get("url")).endswith("tar.gz"):
                lib.extract_targz(config.get("url"), destination, remove_common_prefix=remove_common_prefix)

            elif config.get("type", config.get("url")).endswith("zip"):
                lib.extract_zip(config.get("url"), destination, remove_common_prefix=remove_common_prefix)

            elif config.get("type", config.get("url")).endswith("dmg"):
                if not self.system.isOSX():
                    self.logger.warn("Non OSX based distributions can not install a dmg!")
                else:
                    lib.extract_dmg(config.get("url"), destination, remove_common_prefix=remove_common_prefix)
        except ExtractException:
            self.logger.warn("Unable to extract file for feature %s" % self.feature_name)
Example #8
0
    def __install(self, config):
        remove_common_prefix = (config.has('remove_common_prefix') and
                                config.is_affirmative('remove_common_prefix'))
        url_type = config.get('type', config.get('url'))
        try:
            if url_type.endswith("tar.gz") or url_type.endswith("tar.bz2") or url_type.endswith("tar"):
                lib.extract_targz(config.get('url'), self._get_destination(),
                                  remove_common_prefix=remove_common_prefix)

            elif config.get('type', config.get('url')).endswith("zip"):
                lib.extract_zip(config.get('url'), self._get_destination(),
                                remove_common_prefix=remove_common_prefix)

            elif config.get('type', config.get('url')).endswith("dmg"):
                if not system.is_osx():
                    self.logger.warn("Non OSX based distributions can not install a dmg!")
                else:
                    lib.extract_dmg(config.get('url'), self._get_destination(),
                                    remove_common_prefix=remove_common_prefix)
        except ExtractException:
            self.logger.warn("Unable to extract file for feature %s" % self.feature_name)