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


Python PackageManager.add_wralea_path方法代码示例

本文整理汇总了Python中openalea.core.pkgmanager.PackageManager.add_wralea_path方法的典型用法代码示例。如果您正苦于以下问题:Python PackageManager.add_wralea_path方法的具体用法?Python PackageManager.add_wralea_path怎么用?Python PackageManager.add_wralea_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openalea.core.pkgmanager.PackageManager的用法示例。


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

示例1: valid_search_path

# 需要导入模块: from openalea.core.pkgmanager import PackageManager [as 别名]
# 或者: from openalea.core.pkgmanager.PackageManager import add_wralea_path [as 别名]
    def valid_search_path(self):
        """ Set the search path in the package manager """

        pkgmanager = PackageManager()

        pkgmanager.user_wralea_path.clear()

        for i in xrange(self.pathList.count()):
            path = self.pathList.item(i).text()
            pkgmanager.add_wralea_path(os.path.abspath(str(path)), pkgmanager.user_wralea_path)

        pkgmanager.write_config()
开发者ID:shiva16,项目名称:openalea,代码行数:14,代码来源:dialogs.py

示例2: test_case_1

# 需要导入模块: from openalea.core.pkgmanager import PackageManager [as 别名]
# 或者: from openalea.core.pkgmanager.PackageManager import add_wralea_path [as 别名]
    def test_case_1(self):

        metainfo = {'version': '0.0.1',
                  'license': 'CECILL-C',
                  'authors': 'OpenAlea Consortium',
                  'institutes': 'INRIA/CIRAD',
                  'description': 'Base library.',
                  'url': 'http://openalea.gforge.inria.fr',
                  'icon': ''}

        path = os.path.join(os.path.curdir, "tstpkg")
        mypackage = UserPackage("DummyPkg", metainfo, path)


        factory = mypackage.create_user_node("TestFact",
                                             "category test",
                                             "this is a test",
                                             gen_port_list(3),
                                             gen_port_list(2))
        assert path in factory.search_path
        assert len(factory.inputs)==3
        assert len(factory.outputs)==2

        assert os.path.exists("tstpkg/TestFact.py")
        execfile("tstpkg/TestFact.py")

        mypackage.write()
        assert os.path.exists("tstpkg/__wralea__.py")
        assert os.path.exists("tstpkg/__init__.py")
        execfile("tstpkg/__wralea__.py")

        # Test_clone_package
        path = os.path.join(os.path.curdir, "clonepkg")
        pkg2 = UserPackage("ClonePkg", metainfo, path)
        print pkg2.wralea_path


        # todo this is not working !!
        from openalea.core.pkgmanager import PackageManager
        pm = PackageManager()
        pm.add_wralea_path(path, pm.temporary_wralea_paths)
        pm.init()
        pkg2.clone_from_package(mypackage)
        pkg2.write()

        assert len(pkg2) == 1
        assert len(pkg2["TestFact"].inputs) == 3
        assert id(pkg2["TestFact"]) != id(mypackage["TestFact"])
        assert os.path.exists(path)
        assert os.path.exists(os.path.join(path, '__wralea__.py'))
        assert os.path.exists(os.path.join(path, '__init__.py'))
        assert os.path.exists(os.path.join(path, 'TestFact.py'))
开发者ID:VirtualPlants,项目名称:openalea,代码行数:54,代码来源:test_package.py

示例3: test_wraleapath

# 需要导入模块: from openalea.core.pkgmanager import PackageManager [as 别名]
# 或者: from openalea.core.pkgmanager.PackageManager import add_wralea_path [as 别名]
def test_wraleapath():
    """test wraleapath"""
    pkgman = PackageManager()

# this option (include_namespace has been removed)
#    assert bool(openalea.__path__[0] in  \
#      pkgman.get_wralea_path()) == pkgman.include_namespace

    if(os.name == 'posix'):
        pkgman.add_wralea_path("/usr/bin", \
            pkgman.user_wralea_path)
        assert "/usr/bin" in pkgman.get_wralea_path()
    else:
        pkgman.add_wralea_path("C:\\Windows", \
            pkgman.user_wralea_path)
        assert "C:\\Windows" in pkgman.get_wralea_path()
开发者ID:VirtualPlants,项目名称:openalea,代码行数:18,代码来源:test_packagemanager.py


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