當前位置: 首頁>>代碼示例>>Python>>正文


Python ConanService.remove_conanfile方法代碼示例

本文整理匯總了Python中conans.server.service.service.ConanService.remove_conanfile方法的典型用法代碼示例。如果您正苦於以下問題:Python ConanService.remove_conanfile方法的具體用法?Python ConanService.remove_conanfile怎麽用?Python ConanService.remove_conanfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在conans.server.service.service.ConanService的用法示例。


在下文中一共展示了ConanService.remove_conanfile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: remove_conanfile

# 需要導入模塊: from conans.server.service.service import ConanService [as 別名]
# 或者: from conans.server.service.service.ConanService import remove_conanfile [as 別名]
 def remove_conanfile(conanname, version, username, channel, auth_user):
     """ Remove any existing conanfiles or its packages created """
     conan_reference = ConanFileReference(conanname, version, username, channel)
     conan_service = ConanService(app.authorizer, app.file_manager, auth_user)
     conan_service.remove_conanfile(conan_reference)
開發者ID:JustgeekDE,項目名稱:conan,代碼行數:7,代碼來源:conan_controller.py

示例2: ConanServiceTest

# 需要導入模塊: from conans.server.service.service import ConanService [as 別名]
# 或者: from conans.server.service.service.ConanService import remove_conanfile [as 別名]

#.........這裏部分代碼省略.........
                         '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) \
                + "/package/" + self.package_reference.package_id + "/" + filename

        expected_urls = {'uno.lib': fake_url_build('uno.lib'),
                         'dos.dll': fake_url_build('dos.dll')}
        self.assertEquals(urls, expected_urls)

    def test_search(self):
        """ check the dict is returned by get_packages_info service
        """
        # Creating and saving conans, packages, and conans.vars
        conan_ref2 = ConanFileReference("openssl", "3.0", "lasote", "stable")
        conan_ref3 = ConanFileReference("Assimp", "1.10", "fenix", "stable")
        conan_ref4 = ConanFileReference("assimpFake", "0.1", "phil", "stable")

        package_ref2 = PackageReference(conan_ref2, "12345587754")
        package_ref3 = PackageReference(conan_ref3, "77777777777")

        conan_vars = """
[options]
    use_Qt=%s
"""
        conan_vars1 = conan_vars % "True"
        conan_vars2 = conan_vars % "False"
        conan_vars3 = conan_vars % "True"

        save_files(self.paths.package(self.package_reference), {CONANINFO: conan_vars1})
        save_files(self.paths.package(package_ref2), {CONANINFO: conan_vars2})
        save_files(self.paths.package(package_ref3), {CONANINFO: conan_vars3})
        save_files(self.paths.export(conan_ref4), {"dummy.txt": "//"})

        info = self.search_service.search()
        expected = [conan_ref3, conan_ref4, self.conan_reference, conan_ref2]
        self.assertEqual(expected, info)

        info = self.search_service.search(pattern="Assimp*", ignorecase=False)
        self.assertEqual(info, [conan_ref3])

        info = self.search_service.search_packages(conan_ref2, None)
        self.assertEqual(info, {'12345587754': {'full_requires': [],
                                                'options': {'use_Qt': 'False'},
                                                'settings': {},
                                                'recipe_hash': None}})

        info = self.search_service.search_packages(conan_ref3, None)
        self.assertEqual(info, {'77777777777': {'full_requires': [],
                                                'options': {'use_Qt': 'True'},
                                                'settings': {},
                                                'recipe_hash': None}})

    def remove_test(self):
        conan_ref2 = ConanFileReference("OpenCV", "3.0", "lasote", "stable")
        conan_ref3 = ConanFileReference("Assimp", "1.10", "lasote", "stable")

        package_ref2 = PackageReference(conan_ref2, "12345587754")
        package_ref3 = PackageReference(conan_ref3, "77777777777")

        save_files(self.paths.export(conan_ref2), {"fake.txt": "//fake"})
        save_files(self.paths.package(package_ref2), {"fake.txt": "//fake"})
        save_files(self.paths.package(package_ref3), {"fake.txt": "//fake"})

        # Delete all the conans folder
        self.service.remove_conanfile(self.conan_reference)
        conan_path = self.paths.conan(self.conan_reference)
        self.assertFalse(os.path.exists(conan_path))

        # Delete one package
        self.service.remove_packages(conan_ref3, ["77777777777"])
        package_folder_3 = self.paths.package(PackageReference(conan_ref3, '077777777777'))
        self.assertFalse(os.path.exists(package_folder_3))

        # Raise an exception
        self.assertRaises(NotFoundException,
                          self.service.remove_conanfile,
                          ConanFileReference("Fake", "1.0", "lasote", "stable"))
開發者ID:conan-io,項目名稱:conan,代碼行數:104,代碼來源:service_test.py


注:本文中的conans.server.service.service.ConanService.remove_conanfile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。