本文整理汇总了Python中umake.tools.get_current_arch函数的典型用法代码示例。如果您正苦于以下问题:Python get_current_arch函数的具体用法?Python get_current_arch怎么用?Python get_current_arch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_arch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: is_bucket_available
def is_bucket_available(self, bucket):
"""Check if bucket available on the platform"""
all_in_cache = True
for pkg_name in bucket:
if ' | ' in pkg_name:
for package in pkg_name.split(' | '):
if self.is_bucket_available([package]):
bucket.remove(pkg_name)
bucket.append(package)
pkg_name = package
break
if pkg_name not in self.cache:
# this can be also a foo:arch and we don't have <arch> added. Tell is may be available
if ":" in pkg_name:
# /!\ danger: if current arch == ':appended_arch', on a non multiarch system, dpkg doesn't
# understand that. strip :arch then
(pkg_without_arch_name, arch) = pkg_name.split(":", -1)
if arch == get_current_arch() and pkg_without_arch_name in self.cache: # false positive, available
continue
elif arch not in get_foreign_archs(): # relax the constraint
logger.info("{} isn't available on this platform, but {} isn't enabled. So it may be available "
"later on".format(pkg_name, arch))
continue
logger.info("{} isn't available on this platform".format(pkg_name))
all_in_cache = False
return all_in_cache
示例2: is_bucket_uptodate
def is_bucket_uptodate(self, bucket):
"""Check if the bucket is installed and up to date
The bucket is a list of packages to check if installed."""
logger.debug("Check if {} is uptodate".format(bucket))
is_installed_and_uptodate = True
for pkg_name in bucket:
if ' | ' in pkg_name:
for package in pkg_name.split(' | '):
if self.is_bucket_available([package]):
bucket.remove(pkg_name)
bucket.append(package)
pkg_name = package
break
# /!\ danger: if current arch == ':appended_arch', on a non multiarch system, dpkg doesn't
# understand that. strip :arch then
if ":" in pkg_name:
(pkg_without_arch_name, arch) = pkg_name.split(":", -1)
if arch == get_current_arch():
pkg_name = pkg_without_arch_name
if pkg_name not in self.cache or not self.cache[pkg_name].is_installed:
logger.info("{} isn't installed".format(pkg_name))
is_installed_and_uptodate = False
elif self.cache[pkg_name].is_upgradable:
logger.info("We can update {}".format(pkg_name))
is_installed_and_uptodate = False
return is_installed_and_uptodate
示例3: parse_download_link
def parse_download_link(self, line, in_download):
url = None
for asset in line["assets"]:
if "linux-{}.tar.gz".format(self.arch_trans[get_current_arch()]) in asset["browser_download_url"]:
in_download = True
url = asset["browser_download_url"]
return (url, in_download)
示例4: get_sha_and_start_download
def get_sha_and_start_download(self, download_result):
res = download_result[self.new_download_url].buffer.getvalue().decode()
line = re.search(r'.*linux{}.tar.xz'.format(self.arch_trans[get_current_arch()]), res).group(0)
# you get and store url and checksum
checksum = line.split()[0]
url = os.path.join(self.new_download_url.rpartition('/')[0], line.split()[1])
self.check_data_and_start_download(url, checksum)
示例5: parse_download_link
def parse_download_link(self, line, in_download):
"""Parse SublimeText download links"""
url = None
if '{}.tar.bz2'.format(self.arch_trans[get_current_arch()]) in line:
p = re.search(r'also available as a <a href="(.*.tar.bz2)"', line)
with suppress(AttributeError):
url = p.group(1)
return ((url, None), in_download)
示例6: parse_download_link
def parse_download_link(self, line, in_download):
"""Parse Twine download links"""
url = None
for asset in line["assets"]:
if 'linux{}'.format(self.arch_trans[get_current_arch()]) in asset["browser_download_url"]:
in_download = True
url = asset["browser_download_url"]
return (url, in_download)
示例7: test_install_multi_arch_current_arch
def test_install_multi_arch_current_arch(self):
"""We install a multi_arch package corresponding to current arch"""
multi_arch_name = "testpackage:{}".format(tools.get_current_arch())
self.handler.install_bucket([multi_arch_name], lambda x: "", self.done_callback)
self.wait_for_callback(self.done_callback)
self.assertEqual(self.done_callback.call_args[0][0].bucket, [multi_arch_name])
self.assertIsNone(self.done_callback.call_args[0][0].error)
self.assertTrue(self.handler.is_bucket_installed(["testpackage"]))
示例8: parse_download_link
def parse_download_link(self, line, in_download):
"""Parse Rust download link, expect to find a url"""
url = None
if '{}-unknown-linux-gnu.tar.gz">'.format(self.arch_trans[get_current_arch()]) in line:
p = re.search(r'href="(.*)">', line)
with suppress(AttributeError):
url = p.group(1)
logger.debug("Found link: {}".format(url))
return ((url, None), in_download)
示例9: _really_install_bucket
def _really_install_bucket(self, current_bucket):
"""Really install current bucket and bind signals"""
bucket = current_bucket["bucket"]
logger.debug("Starting {} installation".format(bucket))
# exchange file output for apt and dpkg after the fork() call (open it empty)
self.apt_fd = tempfile.NamedTemporaryFile(delete=False)
self.apt_fd.close()
if self.is_bucket_uptodate(bucket):
return True
need_cache_reload = False
for pkg_name in bucket:
if ":" in pkg_name:
arch = pkg_name.split(":", -1)[-1]
need_cache_reload = need_cache_reload or add_foreign_arch(arch)
if need_cache_reload:
with as_root():
self._force_reload_apt_cache()
self.cache.update()
self._force_reload_apt_cache()
# mark for install and so on
for pkg_name in bucket:
# /!\ danger: if current arch == ':appended_arch', on a non multiarch system, dpkg doesn't understand that
# strip :arch then
if ":" in pkg_name:
(pkg_without_arch_name, arch) = pkg_name.split(":", -1)
if arch == get_current_arch():
pkg_name = pkg_without_arch_name
try:
pkg = self.cache[pkg_name]
if pkg.is_installed and pkg.is_upgradable:
logger.debug("Marking {} for upgrade".format(pkg_name))
pkg.mark_upgrade()
else:
logger.debug("Marking {} for install".format(pkg_name))
pkg.mark_install(auto_fix=False)
except Exception as msg:
message = "Can't mark for install {}: {}".format(pkg_name, msg)
raise BaseException(message)
# this can raise on installedArchives() exception if the commit() fails
with as_root():
self.cache.commit(fetch_progress=self._FetchProgress(current_bucket,
self.STATUS_DOWNLOADING,
current_bucket["progress_callback"]),
install_progress=self._InstallProgress(current_bucket,
self.STATUS_INSTALLING,
current_bucket["progress_callback"],
self._force_reload_apt_cache,
self.apt_fd.name))
return True
示例10: parse_download_link
def parse_download_link(self, line, in_download):
"""Parse Twine download links"""
url = None
regexp = r'href="(.*)" .*linux64'
if get_current_arch() == "i386":
regexp = r'href="(.*)" .*linux32'
p = re.search(regexp, line)
with suppress(AttributeError):
url = p.group(1)
return ((url, None), False)
示例11: parse_download_link
def parse_download_link(self, line, in_download):
"""Parse Nodejs download link, expect to find a sha1 and a url"""
url, shasum = (None, None)
arch = get_current_arch()
if "linux-{}.tar.xz".format(self.arch_trans[arch]) in line:
in_download = True
if in_download:
url = self.download_page.strip("SHASUMS256.txt.asc") + line.split()[1].rstrip()
shasum = line.split()[0]
if url is None and shasum is None:
return (None, in_download)
return ((url, shasum), in_download)
示例12: parse_download_link
def parse_download_link(self, line, in_download):
"""Parse PhantomJS download link, expect to find a sha and a url"""
url = None
string = 'linux-{}.tar.bz2">'.format(self.arch_trans[get_current_arch()])
if string in line:
in_download = True
if in_download is True:
p = re.search(r'href="(.*)">', line)
with suppress(AttributeError):
url = p.group(1)
if url is None:
return (None, in_download)
return ((url, None), in_download)
示例13: post_install
def post_install(self):
"""Add rust necessary env variables"""
add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "rustc", "bin"),
os.path.join(self.install_path, "cargo", "bin"))},
"LD_LIBRARY_PATH": {"value": os.path.join(self.install_path, "rustc", "lib")}})
# adjust for rust: some symlinks magic to have stdlib craft available
arch_lib_folder = '{}-unknown-linux-gnu'.format(self.arch_trans[get_current_arch()])
lib_folder = os.path.join(self.install_path, 'rust-std-{}'.format(arch_lib_folder),
'lib', 'rustlib', arch_lib_folder, 'lib')
for f in os.listdir(lib_folder):
os.symlink(os.path.join(lib_folder, f),
os.path.join(self.install_path, 'rustc', 'lib', 'rustlib', arch_lib_folder, 'lib', f))
UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
示例14: parse_download_link
def parse_download_link(self, line, in_download):
"""Parse Superpowers download links.
We parse from the beginning to the end, we will always have the latest download link"""
url = None
if "-linux-" in line:
in_download = True
if in_download:
regexp = r'href="(.*-{}.zip)"'.format(self.arch_trans[get_current_arch()])
p = re.search(regexp, line)
with suppress(AttributeError):
url = p.group(1)
url = "{}{}".format(self.download_page[:self.download_page.find("superpowers/") - 1], url)
return ((url, None), False)
示例15: is_bucket_installed
def is_bucket_installed(self, bucket):
"""Check if the bucket is installed
The bucket is a list of packages to check if installed."""
logger.debug("Check if {} is installed".format(bucket))
is_installed = True
for pkg_name in bucket:
# /!\ danger: if current arch == ':appended_arch', on a non multiarch system, dpkg doesn't
# understand that. strip :arch then
if ":" in pkg_name:
(pkg_without_arch_name, arch) = pkg_name.split(":", -1)
if arch == get_current_arch():
pkg_name = pkg_without_arch_name
if pkg_name not in self.cache or not self.cache[pkg_name].is_installed:
logger.info("{} isn't installed".format(pkg_name))
is_installed = False
return is_installed