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


Python ConanService.get_conanfile_snapshot方法代码示例

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


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

示例1: get_conanfile_snapshot

# 需要导入模块: from conans.server.service.service import ConanService [as 别名]
# 或者: from conans.server.service.service.ConanService import get_conanfile_snapshot [as 别名]
 def get_conanfile_snapshot(conanname, version, username, channel, auth_user):
     """
     Get a dictionary with all files and their each md5s
     """
     conan_service = ConanService(app.authorizer, app.file_manager, auth_user)
     reference = ConanFileReference(conanname, version, username, channel)
     snapshot = conan_service.get_conanfile_snapshot(reference)
     snapshot_norm = {filename.replace("\\", "/"): the_md5
                      for filename, the_md5 in snapshot.items()}
     return snapshot_norm
开发者ID:JustgeekDE,项目名称:conan,代码行数:12,代码来源:conan_controller.py

示例2: ConanServiceTest

# 需要导入模块: from conans.server.service.service import ConanService [as 别名]
# 或者: from conans.server.service.service.ConanService import get_conanfile_snapshot [as 别名]
class ConanServiceTest(unittest.TestCase):

    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)

    def test_get_conanfile_snapshot(self):
        snap = self.service.get_conanfile_snapshot(self.conan_reference)
        base_path = self.paths.export(self.conan_reference)

        snap_expected = {'hello.cpp': md5sum(os.path.join(base_path, "hello.cpp")),
                         'conanmanifest.txt': md5sum(os.path.join(base_path, "conanmanifest.txt")),
                         'executable': md5sum(os.path.join(base_path, "executable")),
                         'main.cpp':  md5sum(os.path.join(base_path, "main.cpp")),
                         'CMakeLists.txt':  md5sum(os.path.join(base_path, "CMakeLists.txt")),
                         'hellotest.h':  md5sum(os.path.join(base_path, "hellotest.h"))}

        self.assertEquals(snap, snap_expected)

    def test_get_conanfile_download_urls(self):
        urls = self.service.get_conanfile_download_urls(self.conan_reference)
        # Remove parameters
        urls = {name: url.split("?signature")[0] for name, url in urls.items()}

        def fake_url_build(filename):
            return self.fake_url + "/" + "/".join(self.conan_reference) + "/export/" + filename

        expected_urls = {'CMakeLists.txt': fake_url_build('CMakeLists.txt'),
                         'conanmanifest.txt': fake_url_build('conanmanifest.txt'),
                         'executable': fake_url_build('executable'),
                         'hello.cpp': fake_url_build('hello.cpp'),
                         'hellotest.h': fake_url_build('hellotest.h'),
                         'main.cpp': fake_url_build('main.cpp')}
        self.assertEquals(urls, expected_urls)

    def test_get_package_download_urls(self):
        urls = self.service.get_package_download_urls(self.package_reference)
        # Remove parameters
        urls = {name: url.split("?signature")[0] for name, url in urls.items()}

        def fake_url_build(filename):
            return self.fake_url + "/" + "/".join(self.package_reference.conan) \
                + "/package/" + self.package_reference.package_id + "/" + filename

        expected_urls = {'CMakeLists.txt': fake_url_build('CMakeLists.txt'),
                         'executable': fake_url_build('executable'),
                         'hello.cpp': fake_url_build('hello.cpp'),
                         'hellopackage.h': fake_url_build('hellopackage.h'),
                         'main.cpp': fake_url_build('main.cpp')}
        self.assertEquals(urls, expected_urls)

    def test_get_conanfile_upload_urls(self):
        urls = self.service.get_conanfile_upload_urls(self.conan_reference,
                                                      {"conanfile.py": 23,
                                                       "conanmanifest.txt": 24})
        # Remove parameters
        urls = {name: url.split("?signature")[0] for name, url in urls.items()}

        def fake_url_build(filename):
            return self.fake_url + "/" + "/".join(self.conan_reference) + "/export/" + filename

        expected_urls = {'conanfile.py': fake_url_build('conanfile.py'),
                         'conanmanifest.txt': fake_url_build('conanmanifest.txt')}
        self.assertEquals(urls, expected_urls)

    def test_get_package_upload_urls(self):
        urls = self.service.get_package_upload_urls(self.package_reference, {"uno.lib": 23,
                                                                             "dos.dll": 24})
        # Remove parameters
        urls = {name: url.split("?signature")[0] for name, url in urls.items()}

        def fake_url_build(filename):
            return self.fake_url + "/" + "/".join(self.package_reference.conan) \
#.........这里部分代码省略.........
开发者ID:conan-io,项目名称:conan,代码行数:103,代码来源:service_test.py


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