• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tools.remove_framework_envs_from_user函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ui.UI类代码示例发布时间:2022-05-27
下一篇:
Python tools.get_current_arch函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap