本文整理汇总了Python中conans.server.service.service.ConanService类的典型用法代码示例。如果您正苦于以下问题:Python ConanService类的具体用法?Python ConanService怎么用?Python ConanService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConanService类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove_packages
def remove_packages(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)
reader = codecs.getreader("utf-8")
payload = json.load(reader(request.body))
conan_service.remove_packages(conan_reference, payload["package_ids"])
示例2: remove_conanfile_files
def remove_conanfile_files(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)
payload = json.load(request.body)
files = [os.path.normpath(filename) for filename in payload["files"]]
conan_service.remove_conanfile_files(conan_reference, files)
示例3: search
def search(auth_user):
pattern = request.params.get("q", None)
ignorecase = request.params.get("ignorecase", True)
if isinstance(ignorecase, str):
ignorecase = False if 'false' == ignorecase.lower() else True
conan_service = ConanService(app.authorizer, app.file_manager, auth_user)
info = conan_service.search(pattern, ignorecase)
return info.serialize()
示例4: get_conanfile_download_urls
def get_conanfile_download_urls(conanname, version, username, channel, auth_user):
"""
Get a dict with all files and the download url
"""
conan_service = ConanService(app.authorizer, app.file_manager, auth_user)
reference = ConanFileReference(conanname, version, username, channel)
urls = conan_service.get_conanfile_download_urls(reference)
urls_norm = {filename.replace("\\", "/"): url for filename, url in urls.items()}
return urls_norm
示例5: remove_packages_files
def remove_packages_files(conanname, version, username, channel, package_id, auth_user):
""" Remove any existing conanfiles or its packages created """
conan_service = ConanService(app.authorizer, app.file_manager, auth_user)
reference = ConanFileReference(conanname, version, username, channel)
package_reference = PackageReference(reference, package_id)
reader = codecs.getreader("utf-8")
payload = json.load(reader(request.body))
files = [os.path.normpath(filename) for filename in payload["files"]]
conan_service.remove_package_files(package_reference, files)
示例6: get_conanfile_snapshot
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
示例7: get_conan_digest_url
def get_conan_digest_url(conanname, version, username, channel, auth_user):
"""
Get a dict with all files and the download url
"""
conan_service = ConanService(app.authorizer, app.file_manager, auth_user)
reference = ConanFileReference(conanname, version, username, channel)
urls = conan_service.get_conanfile_download_urls(reference, [CONAN_MANIFEST])
if not urls:
raise NotFoundException("No digest found")
return urls
示例8: get_package_download_urls
def get_package_download_urls(conanname, version, username, channel, package_id, auth_user):
"""
Get a dict with all packages files and the download url for each one
"""
conan_service = ConanService(app.authorizer, app.file_manager, auth_user)
reference = ConanFileReference(conanname, version, username, channel)
package_reference = PackageReference(reference, package_id)
urls = conan_service.get_package_download_urls(package_reference)
urls_norm = {filename.replace("\\", "/"): url for filename, url in urls.iteritems()}
return urls_norm
示例9: get_conanfile_upload_urls
def get_conanfile_upload_urls(conanname, version, username, channel, auth_user):
"""
Get a dict with all files and the upload url
"""
conan_service = ConanService(app.authorizer, app.file_manager, auth_user)
reference = ConanFileReference(conanname, version, username, channel)
reader = codecs.getreader("utf-8")
filesizes = json.load(reader(request.body))
urls = conan_service.get_conanfile_upload_urls(reference, filesizes)
urls_norm = {filename.replace("\\", "/"): url for filename, url in urls.items()}
return urls_norm
示例10: get_package_upload_urls
def get_package_upload_urls(conanname, version, username, channel, package_id, auth_user):
"""
Get a dict with all files and the upload url
"""
conan_service = ConanService(app.authorizer, app.file_manager, auth_user)
reference = ConanFileReference(conanname, version, username, channel)
package_reference = PackageReference(reference, package_id)
filesizes = json.load(request.body)
urls = conan_service.get_package_upload_urls(package_reference, filesizes)
urls_norm = {filename.replace("\\", "/"): url for filename, url in urls.iteritems()}
return urls_norm
示例11: get_package_digest_url
def get_package_digest_url(conanname, version, username, channel, package_id, auth_user):
"""
Get a dict with all files and the download url
"""
conan_service = ConanService(app.authorizer, app.file_manager, auth_user)
reference = ConanFileReference(conanname, version, username, channel)
package_reference = PackageReference(reference, package_id)
urls = conan_service.get_package_download_urls(package_reference, [CONAN_MANIFEST])
if not urls:
raise NotFoundException("No digest found")
urls_norm = {filename.replace("\\", "/"): url for filename, url in urls.items()}
return urls_norm
示例12: setUp
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)
示例13: remove_conanfile
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)
示例14: ConanServiceTest
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) \
#.........这里部分代码省略.........