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


Python FileTreeManifest.save方法代码示例

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


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

示例1: _upload_recipe

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import save [as 别名]
    def _upload_recipe(self, conan_reference, base_files=None, retry=1, retry_wait=0):

        files = hello_source_files(3, [1, 12])
        if base_files:
            files.update(base_files)
        content = """
from conans import ConanFile

class MyConan(ConanFile):
    name = "%s"
    version = "%s"
    settings = arch, compiler, os
""" % (conan_reference.name, conan_reference.version)
        files[CONANFILE] = content
        files_md5s = {filename: md5(content) for filename, content in files.items()}
        conan_digest = FileTreeManifest(123123123, files_md5s)

        tmp_dir = temp_folder()
        abs_paths = {}
        for filename, content in files.items():
            abs_path = os.path.join(tmp_dir, filename)
            save(abs_path, content)
            abs_paths[filename] = abs_path
        abs_paths[CONAN_MANIFEST] = os.path.join(tmp_dir, CONAN_MANIFEST)
        conan_digest.save(tmp_dir)

        self.api.upload_recipe(conan_reference, abs_paths, retry, retry_wait, False, None)
开发者ID:19317362,项目名称:conan,代码行数:29,代码来源:rest_api_test.py

示例2: _report_save_manifest

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import save [as 别名]
def _report_save_manifest(copied_files, output, dest_folder, manifest_name):
    report_copied_files(copied_files, output)
    if copied_files:
        date = calendar.timegm(time.gmtime())
        file_dict = {}
        for f in copied_files:
            abs_path = os.path.join(dest_folder, f)
            file_dict[f] = md5sum(abs_path)
        manifest = FileTreeManifest(date, file_dict)
        manifest.save(dest_folder, manifest_name)
开发者ID:19317362,项目名称:conan,代码行数:12,代码来源:importer.py

示例3: setUp

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import save [as 别名]
    def setUp(self):
        self.client = self._get_client()
        conan_digest = FileTreeManifest('123123123', {})
        self.conan_ref = ConanFileReference.loads("Hello/[email protected]/stable")
        reg_folder = self.client.paths.export(self.conan_ref)

        self.client.run('upload %s' % str(self.conan_ref), ignore_error=True)
        self.assertIn("There is no local conanfile exported as %s" % str(self.conan_ref),
                      self.client.user_io.out)

        files = hello_source_files()
        self.client.save(files, path=reg_folder)
        self.client.save({CONANFILE: myconan1,
                          "include/math/lib1.h": "//copy",
                          "my_lib/debug/libd.a": "//copy",
                          "my_data/readme.txt": "//copy",
                          "my_bin/executable": "//copy"}, path=reg_folder)
        conan_digest.save(reg_folder)
        mkdir(self.client.client_cache.export_sources(self.conan_ref))

        self.package_ref = PackageReference(self.conan_ref, "myfakeid")
        self.server_pack_folder = self.test_server.paths.package(self.package_ref)

        package_folder = self.client.paths.package(self.package_ref)
        save(os.path.join(package_folder, "include", "lib1.h"), "//header")
        save(os.path.join(package_folder, "lib", "my_lib", "libd.a"), "//lib")
        save(os.path.join(package_folder, "res", "shares", "readme.txt"),
             "//res")
        save(os.path.join(package_folder, "bin", "my_bin", "executable"), "//bin")
        save(os.path.join(package_folder, CONANINFO), "info")
        save(os.path.join(package_folder, CONAN_MANIFEST), "manifest")

        os.chmod(os.path.join(package_folder, "bin", "my_bin", "executable"),
                 os.stat(os.path.join(package_folder, "bin", "my_bin", "executable")).st_mode |
                 stat.S_IRWXU)

        digest_path = self.client.client_cache.digestfile_package(self.package_ref)
        expected_manifest = FileTreeManifest.create(os.path.dirname(digest_path))
        expected_manifest.save(package_folder)

        self.server_reg_folder = self.test_server.paths.export(self.conan_ref)
        self.assertFalse(os.path.exists(self.server_reg_folder))
        self.assertFalse(os.path.exists(self.server_pack_folder))
开发者ID:19317362,项目名称:conan,代码行数:45,代码来源:upload_complete_test.py

示例4: force_test

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import save [as 别名]
    def force_test(self):
        '''Tries to upload a conans exported after than remote version.'''
        # Upload all conans and packages
        self.client.run('upload %s --all' % str(self.conan_ref))
        self.assertTrue(os.path.exists(self.server_reg_folder))
        self.assertTrue(os.path.exists(self.server_pack_folder))

        # Fake datetime from exported date and upload again
        old_digest = self.client.paths.load_manifest(self.conan_ref)
        old_digest.file_sums["new_file"] = "012345"
        fake_digest = FileTreeManifest(2, old_digest.file_sums)
        fake_digest.save(self.client.paths.export(self.conan_ref))

        self.client.run('upload %s' % str(self.conan_ref), ignore_error=True)
        self.assertIn("Remote recipe is newer than local recipe", self.client.user_io.out)

        self.client.run('upload %s --force' % str(self.conan_ref))
        self.assertIn("Uploading %s" % str(self.conan_ref),
                      self.client.user_io.out)
开发者ID:19317362,项目名称:conan,代码行数:21,代码来源:upload_complete_test.py

示例5: setUp

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import save [as 别名]
    def setUp(self):
        self.servers = {"local": TestServer(server_capabilities=[]),
                        "search_able": TestServer(server_capabilities=[COMPLEX_SEARCH_CAPABILITY])}
        self.client = TestClient(servers=self.servers)

        # No conans created
        self.client.run("search")
        output = self.client.user_io.out
        self.assertIn('There are no packages', output)

        # Conans with and without packages created
        self.root_folder1 = 'Hello/1.4.10/fenix/testing'
        root_folder2 = 'helloTest/1.4.10/fenix/stable'
        root_folder3 = 'Bye/0.14/fenix/testing'
        root_folder4 = 'NodeInfo/1.0.2/fenix/stable'
        root_folder5 = 'MissFile/1.0.2/fenix/stable'
        root_folder11 = 'Hello/1.4.11/fenix/testing'
        root_folder12 = 'Hello/1.4.12/fenix/testing'

        self.client.save({"Empty/1.10/fake/test/reg/fake.txt": "//",
                          "%s/%s/WindowsPackageSHA/%s" % (self.root_folder1,
                                                          PACKAGES_FOLDER,
                                                          CONANINFO): conan_vars1,
                          "%s/%s/WindowsPackageSHA/%s" % (root_folder11,
                                                          PACKAGES_FOLDER,
                                                          CONANINFO): conan_vars1,
                          "%s/%s/WindowsPackageSHA/%s" % (root_folder12,
                                                          PACKAGES_FOLDER,
                                                          CONANINFO): conan_vars1,
                          "%s/%s/PlatformIndependantSHA/%s" % (self.root_folder1,
                                                               PACKAGES_FOLDER,
                                                               CONANINFO): conan_vars1b,
                          "%s/%s/LinuxPackageSHA/%s" % (self.root_folder1,
                                                        PACKAGES_FOLDER,
                                                        CONANINFO): conan_vars1c,
                          "%s/%s/a44f541cd44w57/%s" % (root_folder2,
                                                       PACKAGES_FOLDER,
                                                       CONANINFO): conan_vars2,
                          "%s/%s/e4f7vdwcv4w55d/%s" % (root_folder3,
                                                       PACKAGES_FOLDER,
                                                       CONANINFO): conan_vars3,
                          "%s/%s/e4f7vdwcv4w55d/%s" % (root_folder4,
                                                       PACKAGES_FOLDER,
                                                       CONANINFO): conan_vars4,
                          "%s/%s/e4f7vdwcv4w55d/%s" % (root_folder5,
                                                       PACKAGES_FOLDER,
                                                       "hello.txt"): "Hello"},
                         self.client.paths.store)

        # Fake some manifests to be able to calculate recipe hash
        fake_manifest = FileTreeManifest(1212, {})
        fake_manifest.save(os.path.join(self.client.paths.store, self.root_folder1, EXPORT_FOLDER))
        fake_manifest.save(os.path.join(self.client.paths.store, root_folder2, EXPORT_FOLDER))
        fake_manifest.save(os.path.join(self.client.paths.store, root_folder3, EXPORT_FOLDER))
        fake_manifest.save(os.path.join(self.client.paths.store, root_folder4, EXPORT_FOLDER))
        fake_manifest.save(os.path.join(self.client.paths.store, root_folder5, EXPORT_FOLDER))
开发者ID:19317362,项目名称:conan,代码行数:58,代码来源:search_test.py


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