def _write_env_file(self, path):
     prefix_recipe = recipe.get_recipe('default_prefix',
                                       target='prefix',
                                       fail_easy=True)
     #if prefix_recipe is None:
     #self.log.error("Could not find recipe for `{0}'".format(self.args.recipe))
     #return False
     if not sysutils.dir_is_writable(path):
         pass
     try:
         for fname, content in prefix_recipe.files.items():
             sysutils.write_file_in_subdir(
                 path, fname, prefix_recipe.var_replace_all(content))
     except:
         pass
     return True
Beispiel #2
0
 def _write_env_file(self):
     """
     Create a setup_env.sh file in the prefix
     """
     prefix_recipe = get_prefix_recipe("default_prefix")
     if prefix_recipe is None:
         self.log.error("Could not find recipe for `{0}'".format(self.args.recipe))
         return False
     path = self.prefix.prefix_dir
     if not sysutils.dir_is_writable(path):
         self.log.error("Cannot write to prefix path `{0}'.".format(path))
         return -1
     try:
         for fname, content in prefix_recipe.files.items():
             sysutils.write_file_in_subdir(path, fname, prefix_recipe.var_replace_all(content))
     except (PBException, OSError, IOError):
         return False
     return True
Beispiel #3
0
 def ensure_repo_exists(self, path):
     " Guarantee that path is a writable git repo. "
     if not sysutils.dir_is_writable(path):
         self.log.info("Creating new git cache in {path}".format(path=path))
         sysutils.mkdir_writable(path)
         self.run_git_command(['init', '--bare'])