コード例 #1
0
ファイル: config.py プロジェクト: hobeika/click-project
 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_,
     )
コード例 #2
0
ファイル: config.py プロジェクト: hobeika/click-project
 def flow_profile(self):
     return ProfileFactory.create_preset_profile(
         "flow",
         settings=defaultdict(lambda: defaultdict(list)),
         explicit=False,
         isroot=True,
         activation_level=ActivationLevel.global_,
     )
コード例 #3
0
ファイル: config.py プロジェクト: Cosmo-Tech/click-project
 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
コード例 #4
0
ファイル: config.py プロジェクト: hobeika/click-project
 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
コード例 #5
0
ファイル: config.py プロジェクト: hobeika/click-project
 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_,
     )
コード例 #6
0
ファイル: config.py プロジェクト: hobeika/click-project
 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
コード例 #7
0
ファイル: config.py プロジェクト: hobeika/click-project
 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)
コード例 #8
0
ファイル: config.py プロジェクト: hobeika/click-project
 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