• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tools.get_current_arch函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中umake.tools.get_current_arch函数的典型用法代码示例。如果您正苦于以下问题:Python get_current_arch函数的具体用法?Python get_current_arch怎么用?Python get_current_arch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_current_arch函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:26,代码来源:requirements_handler.py


示例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
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:27,代码来源:requirements_handler.py


示例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)
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:7,代码来源:crystal.py


示例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)
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:7,代码来源:electronics.py


示例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)
开发者ID:jravetch,项目名称:ubuntu-make,代码行数:8,代码来源:ide.py


示例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)
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:8,代码来源:games.py


示例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"]))
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:9,代码来源:test_requirements_handler.py


示例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)
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:9,代码来源:rust.py


示例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
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:56,代码来源:requirements_handler.py


示例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)
开发者ID:collinsnji,项目名称:ubuntu-make,代码行数:10,代码来源:games.py


示例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)
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:13,代码来源:nodejs.py


示例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)
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:14,代码来源:web.py


示例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)))
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:15,代码来源:rust.py


示例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)
开发者ID:Ziggoto,项目名称:ubuntu-make,代码行数:17,代码来源:games.py


示例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
开发者ID:Ubuntu420,项目名称:ubuntu-make,代码行数:17,代码来源:requirements_handler.py


示例16: parse_download_link

    def parse_download_link(self, line, in_download):
        """Parse Go download link, expect to find a sha and a url"""
        url, sha = (None, None)
        if "linux-{}".format(get_current_arch().replace("i386", "386")) in line:
            in_download = True
        if in_download:
            p = re.search(r'href="(.*)">', line)
            with suppress(AttributeError):
                url = p.group(1)
            p = re.search(r'<td><tt>(\w+)</tt></td>', line)
            with suppress(AttributeError):
                sha = p.group(1)
            if "</tr>" in line:
                in_download = False

        if url is None and sha is None:
            return (None, in_download)
        return ((url, sha), in_download)
开发者ID:jravetch,项目名称:ubuntu-make,代码行数:18,代码来源:go.py


示例17: get_metadata_and_check_license

    def get_metadata_and_check_license(self, result):
        """Override this so we can use BS and fetch the checksum separately."""
        logger.debug("Fetched download page, parsing.")

        page = result[self.download_page]

        error_msg = page.error
        if error_msg:
            logger.error("An error occurred while downloading {}: {}".format(self.download_page_url, error_msg))
            UI.return_main_screen(status_code=1)

        soup = BeautifulSoup(page.buffer, 'html.parser')

        link = (soup.find('div', class_="install")
                .find('td', class_="inst-type", text="Linux (.tar.gz)")
                .parent
                .find(text=self.arch_trans[get_current_arch()])
                .parent
                .parent)

        if link is None:
            logger.error("Can't parse the download URL from the download page.")
            UI.return_main_screen(status_code=1)

        download_url = link.attrs['href']
        checksum_url = download_url + '.sha256'
        logger.debug("Found download URL: " + download_url)
        logger.debug("Downloading checksum first, from " + checksum_url)

        def checksum_downloaded(results):
            checksum_result = next(iter(results.values()))  # Just get the first.
            if checksum_result.error:
                logger.error(checksum_result.error)
                UI.return_main_screen(status_code=1)

            checksum = checksum_result.buffer.getvalue().decode('utf-8').split()[0]
            logger.info('Obtained SHA256 checksum: ' + checksum)

            self.download_requests.append(DownloadItem(download_url,
                                                       checksum=Checksum(ChecksumType.sha256, checksum),
                                                       ignore_encoding=True))
            self.start_download_and_install()

        DownloadCenter([DownloadItem(checksum_url)], on_done=checksum_downloaded, download=False)
开发者ID:EdRondon,项目名称:ubuntu-make,代码行数:44,代码来源:rust.py


示例18: parse_download_link

    def parse_download_link(self, line, in_download):
        """Parse Rust download link, expect to find a url"""
        url, sha1 = (None, None)
        arch = get_current_arch()
        if "{}-unknown-linux-gnu.tar.gz".format(self.arch_trans[arch]) in line:
            in_download = True
        if in_download:
            p = re.search(r'href="(.*)">', line)
            with suppress(AttributeError):
                url = p.group(1)
            p = re.search(r'<td><tt>(\w+)</tt></td>', line)
            with suppress(AttributeError):
                sha1 = p.group(1)
            if "</tr>" in line:
                in_download = False

        if url is None and sha1 is None:
            return (None, in_download)
        return ((url, sha1), in_download)
开发者ID:EdRondon,项目名称:ubuntu-make,代码行数:19,代码来源:rust.py


示例19: get_metadata_and_check_license

    def get_metadata_and_check_license(self, result):
        logger.debug("Fetched download page, parsing.")
        page = result[self.download_page]
        error_msg = page.error
        if error_msg:
            logger.error("An error occurred while downloading {}: {}".format(self.download_page, error_msg))
            UI.return_main_screen(status_code=1)

        try:
            assets = json.loads(page.buffer.read().decode())["assets"]
            for asset in assets:
                if "linux-{}".format(self.arch_trans[get_current_arch()]) in asset["browser_download_url"]:
                    download_url = asset["browser_download_url"]
        except (json.JSONDecodeError, IndexError):
            logger.error("Can't parse the download URL from the download page.")
            UI.return_main_screen(status_code=1)
        logger.debug("Found download URL: " + download_url)

        self.download_requests.append(DownloadItem(download_url, None))
        self.start_download_and_install()
开发者ID:EdRondon,项目名称:ubuntu-make,代码行数:20,代码来源:games.py


示例20: is_installable

 def is_installable(self):
     """Return if the framework can be installed on that arch"""
     try:
         if len(self.only_on_archs) > 0:
             # we have some restricted archs, check we support it
             current_arch = get_current_arch()
             if current_arch not in self.only_on_archs:
                 logger.debug("{} only supports {} archs and you are on {}.".format(self.name, self.only_on_archs,
                                                                                    current_arch))
                 return False
         if len(self.only_ubuntu_version) > 0:
             current_version = get_current_ubuntu_version()
             if current_version not in self.only_ubuntu_version:
                 logger.debug("{} only supports {} and you are on {}.".format(self.name, self.only_ubuntu_version,
                                                                              current_version))
                 return False
         if not RequirementsHandler().is_bucket_available(self.packages_requirements):
             return False
     except:
         logger.error("An error occurred when detecting platform, don't register {}".format(self.name))
         return False
     return True
开发者ID:champ1,项目名称:ubuntu-make,代码行数:22,代码来源:__init__.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap