本文整理汇总了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)
示例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")
示例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)
示例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)