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


Python FileTreeManifest.load方法代码示例

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


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

示例1: test_tree_manifest

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import load [as 别名]
    def test_tree_manifest(self):
        tmp_dir = temp_folder()
        files = {"one.ext": "aalakjshdlkjahsdlkjahsdljkhsadljkhasljkdhlkjashd",
                 "path/to/two.txt": "asdas13123",
                 "two.txt": "asdasdasdasdasdasd",
                 "folder/damn.pyc": "binarythings",
                 "folder/damn.pyo": "binarythings2",
                 "pythonfile.pyc": "binarythings3"}
        for filename, content in files.items():
            save(os.path.join(tmp_dir, filename), content)

        manifest = FileTreeManifest.create(tmp_dir)

        manifest.save(tmp_dir)
        readed_manifest = FileTreeManifest.load(tmp_dir)

        self.assertEqual(readed_manifest.time, manifest.time)
        self.assertEqual(readed_manifest, manifest)
        # Not included the pycs or pyo
        self.assertEquals(set(manifest.file_sums.keys()),
                          set(["one.ext", "path/to/two.txt", "two.txt"]))

        for filepath, md5readed in manifest.file_sums.items():
            content = files[filepath]
            self.assertEquals(md5(content), md5readed)
开发者ID:19317362,项目名称:conan,代码行数:27,代码来源:manifest_test.py

示例2: _remove_if_outdated

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import load [as 别名]
def _remove_if_outdated(package_folder, package_ref, proxy, output):
    if os.path.exists(package_folder):
        try:  # get_conan_digest can fail, not in server
            # FIXME: This can iterate remotes to get and associate in registry
            upstream_manifest = proxy.get_package_manifest(package_ref)
        except NotFoundException:
            output.warn("Can't update, no package in remote")
        except NoRemoteAvailable:
            output.warn("Can't update, no remote defined")
        else:
            read_manifest = FileTreeManifest.load(package_folder)
            if upstream_manifest != read_manifest:
                if upstream_manifest.time > read_manifest.time:
                    output.warn("Current package is older than remote upstream one")
                    output.warn("Removing it to retrieve or build an updated one")
                    rmdir(package_folder)
                else:
                    output.warn("Current package is newer than remote upstream one")
开发者ID:19317362,项目名称:conan,代码行数:20,代码来源:package_installer.py

示例3: _failed_package_verify

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import load [as 别名]
    def _failed_package_verify(self, reference, remote="local cache"):
        self.client.run("install %s --build missing --manifests" % str(reference))
        self.assertIn("Installed manifest for 'Hello/[email protected]/stable' from %s" % remote,
                      self.client.user_io.out)
        self.assertIn("Installed manifest for 'Hello/[email protected]/stable:"
                      "5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9' from %s" % remote,
                      self.client.user_io.out)

        output_folder = os.path.join(self.client.current_folder, ".conan_manifests")
        paths = SimplePaths(output_folder)
        self.assertTrue(os.path.exists(paths.digestfile_conanfile(self.reference)))

        package_reference = PackageReference.loads("Hello/[email protected]/stable:"
                                                   "5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9")
        self.assertTrue(os.path.exists(paths.digestfile_package(package_reference)))

        client = TestClient(servers=self.servers, users={"default": [("lasote", "mypass")]})

        client.save(self.files)
        client.run("export . lasote/stable")
        client.run("install Hello/[email protected]/stable --build=missing")
        info = os.path.join(client.paths.package(package_reference), "conaninfo.txt")
        info_content = load(info)
        info_content += "# Dummy string"
        save(info, info_content)
        package_folder = client.paths.package(package_reference)
        manifest = FileTreeManifest.load(package_folder)
        manifest.file_sums["conaninfo.txt"] = md5(info_content)
        manifest.save(package_folder)

        client.run("upload %s --all" % str(self.reference))

        # now verify, with update
        self.client.run("remove Hello/[email protected]/stable -f")
        self.client.run("install %s --build missing --verify"
                        % str(self.reference),
                        ignore_error=True)
        self.assertNotIn("Manifest for 'Hello/[email protected]/stable': OK", self.client.user_io.out)
        self.assertNotIn("Manifest for '%s': OK" % str(package_reference), self.client.user_io.out)
        self.assertIn("Modified or new manifest '%s' detected" % str(package_reference),
                      self.client.user_io.out)
开发者ID:19317362,项目名称:conan,代码行数:43,代码来源:manifest_validation_test.py

示例4: update_test

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import load [as 别名]
    def update_test(self, mode):
        self._create_code(mode)

        self.client.run("export . lasote/testing")
        self.client.run("install Hello/[email protected]/testing --build=missing")
        self.client.run("upload Hello/[email protected]/testing --all")
        self.client.run('remove Hello/[email protected]/testing -f')
        self.client.run("install Hello/[email protected]/testing")

        # upload to remote again, the folder remains as installed
        self.client.run("install Hello/[email protected]/testing --update")
        self.assertIn("Hello/[email protected]/testing: Already installed!", self.client.user_io.out)
        self._check_export_installed_folder(mode)

        server_path = self.server.paths.export(self.reference)
        save(os.path.join(server_path, "license.txt"), "mylicense")
        manifest = FileTreeManifest.load(server_path)
        manifest.time += 1
        manifest.file_sums["license.txt"] = md5sum(os.path.join(server_path, "license.txt"))
        manifest.save(server_path)

        self.client.run("install Hello/[email protected]/testing --update")
        self._check_export_installed_folder(mode, updated=True)
开发者ID:19317362,项目名称:conan,代码行数:25,代码来源:export_sources_test.py


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