Esempio n. 1
0
 def globalpreset_profile(self):
     return ProfileFactory.create_preset_profile(
         "globalpreset",
         settings={
             "recipe": {
                 name: json.loads(open(self.global_profile.link_location(name), "rb").read().decode("utf-8"))
                 for name in self.global_profile.recipe_link_names
             },
             "launchers": {
                 "gdb": ["gdb", "--quiet", "--args"],
                 "gdb-jvm": ["gdb", "--quiet", "--eval-command=handle SIGSEGV nostop noprint pass", "--args"],
                 "lldb": ["lldb", "--"],
                 "memcheck": ["valgrind", "--tool=memcheck", "--leak-check=full"],
                 "callgrind": ["valgrind", "--tool=callgrind", "--separate-callers=2"],
                 "massif": ["valgrind", "--tool=massif"],
                 "heaptrack": ["heaptrack"],
                 "perf-record": ["perf", "record", "-e", "cpu-clock", "--call-graph", "dwarf", "-F", "99"],
                 "xvfb": ["xvfb-run", "-a", "--server-args", "-screen 0 1024x768x24 -extension RANDR"],
                 "time": ["time", "-v"],
                 "gdbserver": ["gdbserver", "localhost:9999"],
             },
             "customcommands": self._get_custom_command_paths(self.global_profile),
             "alias": {},
         },
         explicit=False,
         isroot=True,
         activation_level=ActivationLevel.global_,
     )
Esempio n. 2
0
 def flow_profile(self):
     return ProfileFactory.create_preset_profile(
         "flow",
         settings=defaultdict(lambda: defaultdict(list)),
         explicit=False,
         isroot=True,
         activation_level=ActivationLevel.global_,
     )
Esempio n. 3
0
 def global_profile(self):
     if self._global_profile is None:
         self._global_profile = ProfileFactory.get(
             self.app_dir,
             name="global",
             app_name=self.app_name
         )
     return self._global_profile
Esempio n. 4
0
 def workgroup_profile(self):
     if not self._workgroup_profile:
         name = self.main_command.path
         self._workgroup_profile = ProfileFactory.get(
             os.path.dirname(self.project) + '/.{}'.format(name),
             name="workgroup",
             app_name=self.app_name,
         ) if self.project else None
     return self._workgroup_profile
Esempio n. 5
0
 def global_profile(self):
     return ProfileFactory.create_or_get_by_location(
         self.app_dir,
         name="global",
         app_name=self.app_name,
         explicit=True,
         isroot=True,
         activation_level=ActivationLevel.global_,
         default_color="fg-cyan",
     )
Esempio n. 6
0
 def local_profile(self):
     if not self._local_profile:
         self._local_profile = ProfileFactory.get(
             os.path.join(
                 self.project,
                 "." + self.main_command.path
             ),
             name="local",
             app_name=self.app_name,
         ) if self.project else None
     return self._local_profile
Esempio n. 7
0
 def localpreset_profile(self):
     if self.project:
         return ProfileFactory.create_preset_profile(
             "localpreset",
             settings={},
             explicit=False,
             isroot=True,
             activation_level=ActivationLevel.local,
         )
     else:
         return None
Esempio n. 8
0
 def distribution_profile(self):
     if self.distribution_profile_location is not None:
         return ProfileFactory.create_or_get_by_location(
             self.distribution_profile_location,
             name="distribution",
             app_name=self.app_name,
             explicit=False,
             isroot=True,
             activation_level=ActivationLevel.global_,
             readonly=True,
         )
     else:
         return None
Esempio n. 9
0
 def workspace_profile(self):
     if self.project:
         return ProfileFactory.create_or_get_by_location(
             os.path.dirname(self.project) + '/.{}'.format(self.main_command.path),
             name="workspace",
             app_name=self.app_name,
             explicit=True,
             isroot=True,
             activation_level=ActivationLevel.local,
             default_color="fg-magenta",
         )
     else:
         return None
Esempio n. 10
0
 def localpreset_profile(self):
     if self.project:
         return ProfileFactory.create_preset_profile(
             "localpreset",
             settings={
                 "customcommands": self._get_custom_command_paths(self.local_profile)
             },
             explicit=False,
             isroot=True,
             activation_level=ActivationLevel.local,
         )
     else:
         return None
Esempio n. 11
0
 def currentdirectorypreset_profile(self):
     settings = {}
     proj = self.guess_project()
     if proj:
         settings["parameters"] = {
                 self.main_command.path: ["--project", proj]
             }
     return ProfileFactory.create_preset_profile(
         "currentdirectorypreset",
         settings=settings,
         explicit=False,
         isroot=True,
         activation_level=ActivationLevel.global_,
     )
Esempio n. 12
0
 def workspacepreset_profile(self):
     if self.project:
         return ProfileFactory.create_preset_profile(
             "workspacepreset",
             settings={
                 "recipe": {
                     name: json.loads(open(self.workspace_profile.link_location(name), "rb").read().decode("utf-8"))
                     for name in self.workspace_profile.recipe_link_names
                 }
             },
             explicit=False,
             isroot=True,
             activation_level=ActivationLevel.local,
         )
     else:
         return None
Esempio n. 13
0
 def local_profile(self):
     if self.project:
         return ProfileFactory.create_or_get_by_location(
             os.path.join(
                 self.project,
                 "." + self.main_command.path
             ),
             name="local",
             app_name=self.app_name,
             explicit=True,
             isroot=True,
             activation_level=ActivationLevel.local,
             default_color="fg-green",
         )
     else:
         return None
Esempio n. 14
0
 def add_profile(profile, explicit=True):
     if profile is None:
         return
     res.append(profile)
     for recipe in self.sorted_recipes(profile.recipes):
         res.append(
             ProfileFactory.create_preset_profile(
                 f"{recipe.name}preset",
                 settings={
                     "customcommands": self._get_custom_command_paths(recipe)
                 },
                 explicit=False,
                 isroot=False,
                 isrecipe=True,
                 activation_level=ActivationLevel.global_,
             )
         )
         res.append(recipe)
Esempio n. 15
0
 def env_profile(self):
     profile = ProfileFactory.create_preset_profile(
         "env",
         settings=defaultdict(lambda: defaultdict(list)),
         explicit=True,
         isroot=True,
         activation_level=ActivationLevel.global_,
         default_color="bold-True"
     )
     parameters_prefix = f"{self.app_name}_P_".upper()
     profile.settings["parameters"] = {
         key[len(parameters_prefix):].replace("__", "-").replace("_", ".").lower(): shlex.split(value)
         for key, value in os.environ.items()
         if key.startswith(parameters_prefix)
     }
     recipes_prefix = f"{self.app_name}_R_".upper()
     profile.settings["recipe"] = {
         key[len(recipes_prefix):]: json.loads(value)
         for key, value in os.environ.items()
         if key.startswith(recipes_prefix)
     }
     return profile