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


Python FileTreeManifest.create方法代码示例

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


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

示例1: setUp

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
    def setUp(self):
        self.conan_reference = ConanFileReference.loads("openssl/[email protected]/testing")
        self.package_reference = PackageReference(self.conan_reference, "123123123")
        self.tmp_dir = temp_folder()

        read_perms = [("*/*@*/*", "*")]
        write_perms = []
        authorizer = BasicAuthorizer(read_perms, write_perms)

        self.fake_url = "http://url"
        updown_auth_manager = JWTUpDownAuthManager("secret",
                                                   timedelta(seconds=200))
        adapter = ServerDiskAdapter(self.fake_url, self.tmp_dir, updown_auth_manager)
        self.paths = SimplePaths(self.tmp_dir)
        self.file_manager = FileManager(self.paths, adapter)

        search_adapter = DiskSearchAdapter()
        self.search_manager = DiskSearchManager(self.paths, search_adapter)

        self.service = ConanService(authorizer, self.file_manager, "lasote")
        self.search_service = SearchService(authorizer, self.search_manager, "lasote")

        files = hello_source_files("test")
        save_files(self.paths.export(self.conan_reference), files)
        self.conan_digest = FileTreeManifest.create(self.paths.export(self.conan_reference))
        conan_digest_path = os.path.join(self.paths.export(self.conan_reference), CONAN_MANIFEST)
        save(conan_digest_path, str(self.conan_digest))

        files = hello_source_files("package")
        save_files(self.paths.package(self.package_reference), files)
开发者ID:conan-io,项目名称:conan,代码行数:32,代码来源:service_test.py

示例2: test_tree_manifest

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [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)

        save(os.path.join(tmp_dir, "THEMANIFEST.txt"), str(manifest))

        readed_manifest = FileTreeManifest.loads(load(os.path.join(tmp_dir, "THEMANIFEST.txt")))

        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:nesono,项目名称:conan,代码行数:28,代码来源:manifest_test.py

示例3: setUp

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
    def setUp(self):
        hello_files = cpp_hello_conan_files("Hello")
        test_conanfile_contents = hello_files[CONANFILE]

        self.server_folder = temp_folder()
        test_server = TestServer(users={"fenix": "mypass"},
                                 base_path=self.server_folder)  # exported users and passwords
        self.server = test_server
        servers = {"default": test_server}
        client = TestClient(servers=servers, users={"default": [("fenix", "mypass")]})

        # Conans with and without packages created
        self.root_folder = {"H1": 'Hello/1.4.10/fenix/testing',
                            "H2": 'Hello/2.4.11/fenix/testing',
                            "B": 'Bye/0.14/fenix/testing',
                            "O": 'Other/1.2/fenix/testing'}

        files = {}
        pack_refs = []
        for key, folder in self.root_folder.items():
            ref = ConanFileReference.loads(folder)
            files["%s/%s/conanfile.py" % (folder, EXPORT_FOLDER)] = test_conanfile_contents
            files["%s/%s/conanmanifest.txt" % (folder, EXPORT_FOLDER)] = ""
            files["%s/%s/conans.txt" % (folder, SRC_FOLDER)] = ""
            for pack_id in (1, 2):
                i = pack_id
                pack_id = "%s_%s" % (pack_id, key)
                pack_refs.append(PackageReference(ref, str(pack_id)))
                files["%s/%s/%s/conans.txt" % (folder, BUILD_FOLDER, pack_id)] = ""
                files["%s/%s/%s/conans.txt" % (folder, PACKAGES_FOLDER, pack_id)] = ""
                files["%s/%s/%s/%s" % (folder, PACKAGES_FOLDER, pack_id, CONANINFO)] = conaninfo % str(i)
                files["%s/%s/%s/%s" % (folder, PACKAGES_FOLDER, pack_id, CONAN_MANIFEST)] = ""

            exports_sources_dir = os.path.join(client.client_cache.export(ref), EXPORT_SOURCES_DIR)
            os.makedirs(exports_sources_dir)

        client.save(files, client.client_cache.store)

        # Create the manifests to be able to upload
        for pack_ref in pack_refs:
            digest_path = client.client_cache.digestfile_package(pack_ref)
            expected_manifest = FileTreeManifest.create(os.path.dirname(digest_path))
            files["%s/%s/%s/%s" % ("/".join(pack_ref.conan),
                                   PACKAGES_FOLDER,
                                   pack_ref.package_id,
                                   CONAN_MANIFEST)] = str(expected_manifest)

        client.save(files, client.client_cache.store)

        self.client = client

        for folder in self.root_folder.values():
            client.run("upload %s --all" % folder.replace("/fenix", "@fenix"))

        self.assert_folders({"H1": [1, 2], "H2": [1, 2], "B": [1, 2], "O": [1, 2]},
                            {"H1": [1, 2], "H2": [1, 2], "B": [1, 2], "O": [1, 2]},
                            {"H1": [1, 2], "H2": [1, 2], "B": [1, 2], "O": [1, 2]},
                            {"H1": True, "H2": True, "B": True, "O": True})
开发者ID:nesono,项目名称:conan,代码行数:60,代码来源:remove_test.py

示例4: valid_digest

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
 def valid_digest(self, digest_path):
     if not os.path.exists(digest_path):
         return False
     expected_digest = FileTreeManifest.create(os.path.dirname(digest_path))
     del expected_digest.file_sums[CONAN_MANIFEST]  # Exclude the MANIFEST itself
     expected_digest.file_sums.pop(CONANFILE + "c", None)  # Exclude the CONANFILE.pyc
     expected_digest.file_sums.pop(".DS_Store", None)  # Exclude tmp in mac
     readed_digest = FileTreeManifest.loads(load(digest_path))
     return readed_digest.file_sums == expected_digest.file_sums
开发者ID:samarjeet,项目名称:conan,代码行数:11,代码来源:paths.py

示例5: upload_same_package_dont_compress_test

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
    def upload_same_package_dont_compress_test(self):
        # Create a manifest for the faked package
        pack_path = self.client.paths.package(self.package_ref)
        digest_path = self.client.client_cache.digestfile_package(self.package_ref)
        expected_manifest = FileTreeManifest.create(os.path.dirname(digest_path))
        save(os.path.join(pack_path, CONAN_MANIFEST), str(expected_manifest))

        self.client.run("upload %s --all" % str(self.conan_ref), ignore_error=False)
        self.assertIn("Compressing package", str(self.client.user_io.out))

        self.client.run("upload %s --all" % str(self.conan_ref), ignore_error=False)
        self.assertNotIn("Compressing package", str(self.client.user_io.out))
        self.assertIn("Package is up to date", str(self.client.user_io.out))
开发者ID:lasote,项目名称:conan,代码行数:15,代码来源:upload_test.py

示例6: _create_aux_files

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
def _create_aux_files(build_folder, package_folder):
    """ auxiliary method that creates CONANINFO in
    the package_folder
    """
    try:
        logger.debug("Creating config files to %s" % package_folder)
        shutil.copy(os.path.join(build_folder, CONANINFO), package_folder)

        # Create the digest for the package
        digest = FileTreeManifest.create(package_folder)
        save(os.path.join(package_folder, CONAN_MANIFEST), str(digest))

    except IOError:
        raise ConanException("%s does not exist inside of your % folder. Try to re-build it again"
                           " to solve it." % (CONANINFO, build_folder))
开发者ID:samarjeet,项目名称:conan,代码行数:17,代码来源:packager.py

示例7: setUp

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
    def setUp(self):
        servers = {}
        # All can write (for avoid authentication until we mock user_io)
        self.test_server = TestServer([("*/*@*/*", "*")], [("*/*@*/*", "*")],
                                      users={"lasote": "mypass"})
        servers["default"] = self.test_server
        conan_digest = FileTreeManifest('123123123', {})

        self.client = TestClient(servers=servers, users={"default": [("lasote", "mypass")]})
        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,
                          CONAN_MANIFEST: str(conan_digest),
                          "include/math/lib1.h": "//copy",
                          "my_lib/debug/libd.a": "//copy",
                          "my_data/readme.txt": "//copy",
                          "my_bin/executable": "//copy"}, path=reg_folder)

        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))
        save(os.path.join(package_folder, CONAN_MANIFEST), str(expected_manifest))

        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:robertmrk,项目名称:conan,代码行数:50,代码来源:upload_test.py

示例8: export_pkg

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
def export_pkg(conanfile, src_package_folder, package_folder, output):
    mkdir(package_folder)

    output.info("Exporting to cache existing package from user folder")
    output.info("Package folder %s" % package_folder)

    copier = FileCopier(src_package_folder, package_folder)
    copier("*", symlinks=True)

    copy_done = copier.report(output)
    if not copy_done:
        output.warn("No files copied from package folder!")

    save(os.path.join(package_folder, CONANINFO), conanfile.info.dumps())
    digest = FileTreeManifest.create(package_folder)
    digest.save(package_folder)
    output.success("Package '%s' created" % os.path.basename(package_folder))
开发者ID:19317362,项目名称:conan,代码行数:19,代码来源:packager.py

示例9: _create_aux_files

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
def _create_aux_files(install_folder, package_folder, conanfile, copy_info):
    """ auxiliary method that creates CONANINFO and manifest in
    the package_folder
    """
    logger.debug("Creating config files to %s" % package_folder)
    if copy_info:
        try:
            shutil.copy(os.path.join(install_folder, CONANINFO), package_folder)
        except IOError:
            raise ConanException("%s does not exist inside of your %s folder. "
                                 "Try to re-build it again to solve it."
                                 % (CONANINFO, install_folder))
    else:
        save(os.path.join(package_folder, CONANINFO), conanfile.info.dumps())

    # Create the digest for the package
    digest = FileTreeManifest.create(package_folder)
    digest.save(package_folder)
开发者ID:19317362,项目名称:conan,代码行数:20,代码来源:packager.py

示例10: export_conanfile

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
def export_conanfile(output, paths, file_patterns, origin_folder, conan_ref):
    destination_folder = paths.export(conan_ref)

    previous_digest = _init_export_folder(destination_folder)

    _export(file_patterns, origin_folder, destination_folder)

    digest = FileTreeManifest.create(destination_folder)

    if previous_digest and previous_digest.file_sums == digest.file_sums:
        digest = previous_digest
    else:
        output.success('A new %s version was exported' % CONANFILE)

    save(os.path.join(destination_folder, CONAN_MANIFEST), str(digest))
    output.success('%s exported as %s.\nFolder: %s' % (CONANFILE,
                                                       str(conan_ref),
                                                       destination_folder))
开发者ID:zaitrarrio,项目名称:conan,代码行数:20,代码来源:export.py

示例11: setUp

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [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

示例12: test_tree_manifest

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

        manifest = FileTreeManifest.create(tmp_dir)

        save(os.path.join(tmp_dir, "THEMANIFEST.txt"), str(manifest))

        readed_manifest = FileTreeManifest.loads(load(os.path.join(tmp_dir, "THEMANIFEST.txt")))

        self.assertEquals(readed_manifest, manifest)

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

示例13: export_conanfile

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
def export_conanfile(output, paths, file_patterns, origin_folder, conan_ref, keep_source=False):
    destination_folder = paths.export(conan_ref)

    previous_digest = _init_export_folder(destination_folder)

    _export(file_patterns, origin_folder, destination_folder)

    digest = FileTreeManifest.create(destination_folder)
    save(os.path.join(destination_folder, CONAN_MANIFEST), str(digest))

    if previous_digest and previous_digest.file_sums == digest.file_sums:
        digest = previous_digest
        output.info("The stored package has not changed")
    else:
        output.success('A new %s version was exported' % CONANFILE)
        if not keep_source:
            rmdir(paths.source(conan_ref))
        output.success('%s exported to local storage' % CONANFILE)
        output.success('Folder: %s' % destination_folder)
开发者ID:SteffenL,项目名称:conan,代码行数:21,代码来源:export.py

示例14: method_called_test

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
    def method_called_test(self):

        save(os.path.join(self.client_cache.package(self.package_reference), CONANINFO), "asdasd")
        manifest = FileTreeManifest.create(self.client_cache.package(self.package_reference))
        save(os.path.join(self.client_cache.package(self.package_reference), CONAN_MANIFEST), str(manifest))

        self.assertFalse(self.remote_client.upload_package.called)
        self.manager.upload_package(self.package_reference, Remote("other", "url"))
        self.assertTrue(self.remote_client.upload_package.called)

        self.assertFalse(self.remote_client.get_conan_digest.called)
        self.manager.get_conan_digest(self.conan_reference, Remote("other", "url"))
        self.assertTrue(self.remote_client.get_conan_digest.called)

        self.assertFalse(self.remote_client.get_recipe.called)
        self.manager.get_recipe(self.conan_reference, temp_folder(), Remote("other", "url"))
        self.assertTrue(self.remote_client.get_recipe.called)

        self.assertFalse(self.remote_client.get_package.called)
        self.manager.get_package(self.package_reference, temp_folder(), Remote("other", "url"))
        self.assertTrue(self.remote_client.get_package.called)
开发者ID:lasote,项目名称:conan,代码行数:23,代码来源:remote_manager_test.py

示例15: export_conanfile

# 需要导入模块: from conans.model.manifest import FileTreeManifest [as 别名]
# 或者: from conans.model.manifest.FileTreeManifest import create [as 别名]
def export_conanfile(output, paths, file_patterns, origin_folder, conan_ref, short_paths,
                     keep_source):
    destination_folder = paths.export(conan_ref)

    previous_digest = _init_export_folder(destination_folder)

    _export(file_patterns, origin_folder, destination_folder, output)

    digest = FileTreeManifest.create(destination_folder)
    save(os.path.join(destination_folder, CONAN_MANIFEST), str(digest))

    if previous_digest and previous_digest.file_sums == digest.file_sums:
        digest = previous_digest
        output.info("The stored package has not changed")
        modified_recipe = False
    else:
        output.success('A new %s version was exported' % CONANFILE)
        output.info('Folder: %s' % destination_folder)
        modified_recipe = True

    source = paths.source(conan_ref, short_paths)
    dirty = os.path.join(source, DIRTY_FILE)
    remove = False
    if os.path.exists(dirty):
        output.info("Source folder is dirty, forcing removal")
        remove = True
    elif modified_recipe and not keep_source and os.path.exists(source):
        output.info("Package recipe modified in export, forcing source folder removal")
        output.info("Use the --keep-source, -k option to skip it")
        remove = True
    if remove:
        output.info("Removing 'source' folder, this can take a while for big packages")
        try:
            # remove only the internal
            rmdir(source)
        except BaseException as e:
            output.error("Unable to delete source folder. "
                         "Will be marked as dirty for deletion")
            output.warn(str(e))
            save(os.path.join(source, DIRTY_FILE), "")
开发者ID:conan-io,项目名称:conan,代码行数:42,代码来源:export.py


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