当前位置: 首页>>代码示例>>Python>>正文


Python tools.remove_framework_envs_from_user函数代码示例

本文整理汇总了Python中umake.tools.remove_framework_envs_from_user函数的典型用法代码示例。如果您正苦于以下问题:Python remove_framework_envs_from_user函数的具体用法?Python remove_framework_envs_from_user怎么用?Python remove_framework_envs_from_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了remove_framework_envs_from_user函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_remove_user_env_no_file

    def test_remove_user_env_no_file(self, expanderusermock):
        """Remove an env from a user setup with no profile file"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        tools.remove_framework_envs_from_user("framework A")

        self.assertRaises(FileNotFoundError, open, profile_file)
开发者ID:Ubuntu420,项目名称:ubuntu-make,代码行数:7,代码来源:test_tools.py

示例2: test_remove_user_env_not_found

    def test_remove_user_env_not_found(self, expanderusermock):
        """Remove an env from a user setup with no matching content found"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, 'w').write("Foo\nBar\nexport BAR=baz")
        tools.remove_framework_envs_from_user("framework A")

        profile_content = open(profile_file).read()
        self.assertEqual(profile_content, "Foo\nBar\nexport BAR=baz")
开发者ID:Ubuntu420,项目名称:ubuntu-make,代码行数:9,代码来源:test_tools.py

示例3: test_remove_user_env_end

    def test_remove_user_env_end(self, expanderusermock):
        """Remove an env from a user setup being at the end of profile file"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, "w").write("Foo\nBar\n# Ubuntu make installation of framework A" "\nexport FOO=bar\n\n")
        tools.remove_framework_envs_from_user("framework A")

        profile_content = open(profile_file).read()
        self.assertEqual(profile_content, "Foo\nBar\n")
开发者ID:rridhan,项目名称:ubuntu-make,代码行数:9,代码来源:test_tools.py

示例4: test_remove_user_multiple_same_framework

    def test_remove_user_multiple_same_framework(self, expanderusermock):
        """Remove an env from a user setup, same framework being repeated multiple times"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, 'w').write("Foo\nBar\n# Ubuntu make installation of framework A\nexport BAR=bar\n\n"
                                      "# Ubuntu make installation of framework A\nexport FOO=bar\n\nexport BAR=baz")
        tools.remove_framework_envs_from_user("framework A")

        profile_content = open(profile_file).read()
        self.assertEqual(profile_content, "Foo\nBar\nexport BAR=baz")
开发者ID:Ubuntu420,项目名称:ubuntu-make,代码行数:10,代码来源:test_tools.py

示例5: test_remove_user_env_multiple_frameworks

    def test_remove_user_env_multiple_frameworks(self, expanderusermock):
        """Remove an env from a user setup restraining to the correct framework"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, 'w').write("Foo\nBar\n# Ubuntu make installation of framework B\nexport BAR=bar\n\n"
                                      "# Ubuntu make installation of framework A\nexport FOO=bar\n\nexport BAR=baz")
        tools.remove_framework_envs_from_user("framework A")

        profile_content = open(profile_file).read()
        self.assertEquals(profile_content, "Foo\nBar\n# Ubuntu make installation of framework B\nexport BAR=bar\n\n"
                                           "export BAR=baz")
开发者ID:champ1,项目名称:ubuntu-make,代码行数:11,代码来源:test_tools.py

示例6: test_remove_user_env_zsh

    def test_remove_user_env_zsh(self, expanderusermock):
        """Remove an env from a user setup using zsh"""
        os.environ['SHELL'] = '/bin/zsh'
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".zprofile")
        open(profile_file, 'w').write("Foo\nBar\n# Ubuntu make installation of framework A"
                                      "\nexport FOO=bar\n\nexport BAR=baz")
        tools.remove_framework_envs_from_user("framework A")

        profile_content = open(profile_file).read()
        self.assertEqual(profile_content, "Foo\nBar\nexport BAR=baz")
开发者ID:pombredanne,项目名称:ubuntu-make,代码行数:11,代码来源:test_tools.py

示例7: tearDown

 def tearDown(self):
     # don't remove on machine paths if running within a container
     if not self.in_container:
         with suppress(FileNotFoundError):
             shutil.rmtree(self.installed_path)
         # TODO: need to be finer grain in the future
         with suppress(FileNotFoundError):
             os.remove(self.conf_path)
         if self.desktop_filename:
             with suppress(FileNotFoundError):
                 os.remove(get_launcher_path(self.desktop_filename))
         remove_framework_envs_from_user(self.framework_name_for_profile)
         for dir in self.additional_dirs:
             with suppress(OSError):
                 shutil.rmtree(dir)
     super().tearDown()
开发者ID:rockwalrus,项目名称:ubuntu-make,代码行数:16,代码来源:__init__.py

示例8: tearDown

 def tearDown(self):
     # don't remove on machine paths if running within a container
     if not self.in_container:
         with suppress(FileNotFoundError):
             shutil.rmtree(self.installed_path)
         # TODO: need to be finer grain in the future
         with suppress(FileNotFoundError):
             os.remove(self.conf_path)
         if self.desktop_filename:
             with suppress(FileNotFoundError):
                 os.remove(get_launcher_path(self.desktop_filename))
         remove_framework_envs_from_user(self.framework_name_for_profile)
         for dir in self.additional_dirs:
             with suppress(OSError):
                 shutil.rmtree(dir)
     # restore original environment. Do not use the dict copy which erases the object and doesn't have the magical
     # _Environ which setenv() for subprocess
     os.environ.clear()
     os.environ.update(self.original_env)
     super().tearDown()
开发者ID:om26er,项目名称:ubuntu-make,代码行数:20,代码来源:__init__.py

示例9: remove

    def remove(self):
        """Remove current framework if installed

        Not that we only remove desktop file, launcher icon and dir content, we do not remove
        packages as they might be in used for other framework"""
        # check if it's installed and so on.
        super().remove()

        UI.display(DisplayMessage("Removing {}".format(self.name)))
        if self.desktop_filename:
            with suppress(FileNotFoundError):
                os.remove(get_launcher_path(self.desktop_filename))
        if self.icon_filename:
            with suppress(FileNotFoundError):
                os.remove(get_icon_path(self.icon_filename))
        with suppress(FileNotFoundError):
            shutil.rmtree(self.install_path)
        remove_framework_envs_from_user(self.name)
        self.remove_from_config()

        UI.delayed_display(DisplayMessage("Suppression done"))
        UI.return_main_screen()
开发者ID:collinsnji,项目名称:ubuntu-make,代码行数:22,代码来源:baseinstaller.py

示例10: reinstall

 def reinstall(self):
     logger.debug("Mark previous installation path for cleaning.")
     self._paths_to_clean.add(self.install_path)  # remove previous installation path
     self.confirm_path(self.arg_install_path)
     remove_framework_envs_from_user(self.name)
开发者ID:collinsnji,项目名称:ubuntu-make,代码行数:5,代码来源:baseinstaller.py


注:本文中的umake.tools.remove_framework_envs_from_user函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。