當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。