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


Python logger.warning函数代码示例

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


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

示例1: get_recipe_env

    def get_recipe_env(self, arch):
        env = super(MobileInsightRecipe, self).get_recipe_env(arch)

        warning("get_recipe_env(self, arch), use toolchain version = {toolchain_version}".format(
            toolchain_version   = self.toolchain_version))
        env['CFLAGS'] += ' -fPIC'
        env['CFLAGS'] += ' -I{ndk_dir}/sources/cxx-stl/gnu-libstdc++/{toolchain_version}/include'.format(
            ndk_dir             = self.ctx.ndk_dir,
            toolchain_version   = self.toolchain_version)
        env['CFLAGS'] += ' -I{ndk_dir}/sources/cxx-stl/gnu-libstdc++/{toolchain_version}/libs/{arch}/include'.format(
            ndk_dir             = self.ctx.ndk_dir,
            toolchain_version   = self.toolchain_version,
            arch                = arch)
        env['LDFLAGS'] += ' -L{ndk_dir}/sources/cxx-stl/gnu-libstdc++/{toolchain_version}/libs/{arch}'.format(
            ndk_dir             = self.ctx.ndk_dir,
            toolchain_version   = self.toolchain_version,
            arch                = arch)
        env['LDFLAGS'] += ' -shared'
        env['LDFLAGS'] += ' -lgnustl_shared -llog'
        env['STRIP']    = str.split(env['STRIP'])[0]

        # warning("Testing the env")
        # shprint(sh.echo, '$PATH', _env=env)
        # warning("self.ctx = {}".format(str(self.ctx)))
        # warning("self.ctx.ndk-dir = {}".format(self.ctx.ndk_dir))
        # warning("self.ctx.build_dir = {}".format(self.ctx.build_dir))
        # warning("self.ctx.libs_dir = {}".format(self.ctx.libs_dir))
        # warning("self.ctx.bootstrap.build_dir = {}".format(self.ctx.bootstrap.build_dir))
        return env
开发者ID:zwyuan,项目名称:python-for-android,代码行数:29,代码来源:__init__.py

示例2: recipes

 def recipes(self, args):
     ctx = self.ctx
     if args.compact:
         print(" ".join(set(Recipe.list_recipes(ctx))))
     else:
         for name in sorted(Recipe.list_recipes(ctx)):
             try:
                 recipe = Recipe.get_recipe(name, ctx)
             except IOError:
                 warning('Recipe "{}" could not be loaded'.format(name))
             except SyntaxError:
                 import traceback
                 traceback.print_exc()
                 warning(('Recipe "{}" could not be loaded due to a '
                          'syntax error').format(name))
             version = str(recipe.version)
             print('{Fore.BLUE}{Style.BRIGHT}{recipe.name:<12} '
                   '{Style.RESET_ALL}{Fore.LIGHTBLUE_EX}'
                   '{version:<8}{Style.RESET_ALL}'.format(
                     recipe=recipe, Fore=Out_Fore, Style=Out_Style,
                     version=version))
             print('    {Fore.GREEN}depends: {recipe.depends}'
                   '{Fore.RESET}'.format(recipe=recipe, Fore=Out_Fore))
             if recipe.conflicts:
                 print('    {Fore.RED}conflicts: {recipe.conflicts}'
                       '{Fore.RESET}'
                       .format(recipe=recipe, Fore=Out_Fore))
             if recipe.opt_depends:
                 print('    {Fore.YELLOW}optional depends: '
                       '{recipe.opt_depends}{Fore.RESET}'
                       .format(recipe=recipe, Fore=Out_Fore))
开发者ID:yileye,项目名称:python-for-android,代码行数:31,代码来源:toolchain.py

示例3: strip_libraries

    def strip_libraries(self, arch):
        info('Stripping libraries')
        if self.ctx.python_recipe.from_crystax:
            info('Python was loaded from CrystaX, skipping strip')
            return
        env = arch.get_env()
        strip = which('arm-linux-androideabi-strip', env['PATH'])
        if strip is None:
            warning('Can\'t find strip in PATH...')
            return
        strip = sh.Command(strip)

        libs_dir = join(self.dist_dir, '_python_bundle',
                        '_python_bundle', 'modules')
        if self.ctx.python_recipe.name == 'python2legacy':
            libs_dir = join(self.dist_dir, 'private')
        filens = shprint(sh.find, libs_dir, join(self.dist_dir, 'libs'),
                         '-iname', '*.so', _env=env).stdout.decode('utf-8')

        logger.info('Stripping libraries in private dir')
        for filen in filens.split('\n'):
            try:
                strip(filen, _env=env)
            except sh.ErrorReturnCode_1:
                logger.debug('Failed to strip ' + filen)
开发者ID:kronenpj,项目名称:python-for-android,代码行数:25,代码来源:bootstrap.py

示例4: prebuild_arch

    def prebuild_arch(self, arch):
        super(MobileInsightRecipe, self).prebuild_arch(arch)

        build_dir = self.get_build_dir(arch.arch)
        tmp_dir = join(build_dir, 'mi_tmp')
        info("Cleaning old MobileInsight-core sources at {}".format(build_dir))
        try:
            shprint(sh.rm, '-r',
                    build_dir,
                    _tail     = 20,
                    _critical = True)
        except:
            pass

        if LOCAL_DEBUG is False:
            info("Cloning MobileInsight-core sources from {}".format(self.mi_git))
            shprint(sh.git,
                    'clone', '-b',
                    self.mi_branch,
                    '--depth=1',
                    self.mi_git,
                    tmp_dir,
                    _tail     = 20,
                    _critical = True)
        else:
            warning("Debugging using local sources of MobileInsight at {}".format(self.local_src))
            shprint(sh.mkdir,
                    build_dir,
                    _tail     = 20,
                    _critical = True)
            shprint(sh.mkdir,
                    tmp_dir,
                    _tail     = 20,
                    _critical = True)
            shprint(sh.cp,
                    '-fr',
                    self.local_src,
                    tmp_dir,
                    _tail     = 20,
                    _critical = True)
            tmp_dir = join(tmp_dir, 'MobileInsight-core')

        shprint(sh.mv,
                join(tmp_dir, 'mobile_insight'),
                build_dir,
                _tail     = 20,
                _critical = True)

        shprint(sh.mv,
                join(tmp_dir, 'dm_collector_c'),
                build_dir,
                _tail     = 20,
                _critical = True)

        # remove unnecessary codes
        shprint(sh.rm, '-r', tmp_dir,
                _tail     = 20,
                _critical = True)

        self.get_newest_toolchain(arch)
开发者ID:zwyuan,项目名称:python-for-android,代码行数:60,代码来源:__init__.py

示例5: get_distributions

    def get_distributions(cls, ctx, extra_dist_dirs=[]):
        '''Returns all the distributions found locally.'''
        if extra_dist_dirs:
            warning('extra_dist_dirs argument to get_distributions '
                    'is not yet implemented')
            exit(1)
        dist_dir = ctx.dist_dir
        folders = glob.glob(join(dist_dir, '*'))
        for dir in extra_dist_dirs:
            folders.extend(glob.glob(join(dir, '*')))

        dists = []
        for folder in folders:
            if exists(join(folder, 'dist_info.json')):
                with open(join(folder, 'dist_info.json')) as fileh:
                    dist_info = json.load(fileh)
                dist = cls(ctx)
                dist.name = folder.split('/')[-1]
                dist.dist_dir = folder
                dist.needs_build = False
                dist.recipes = dist_info['recipes']
                if 'archs' in dist_info:
                    dist.archs = dist_info['archs']
                dists.append(dist)
        return dists
开发者ID:TangTab,项目名称:python-for-android,代码行数:25,代码来源:distribution.py

示例6: build_arch

    def build_arch(self, arch):
        env = self.get_recipe_env(arch)
        
        env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/png -I{jni_path}/jpeg'.format(
            jni_path=join(self.ctx.bootstrap.build_dir, 'jni'))
        env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/sdl/include -I{jni_path}/sdl_mixer'.format(
            jni_path=join(self.ctx.bootstrap.build_dir, 'jni'))
        env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/sdl_ttf -I{jni_path}/sdl_image'.format(
            jni_path=join(self.ctx.bootstrap.build_dir, 'jni'))
        debug('pygame cflags', env['CFLAGS'])

        
        env['LDFLAGS'] = env['LDFLAGS'] + ' -L{libs_path} -L{src_path}/obj/local/{arch} -lm -lz'.format(
            libs_path=self.ctx.libs_dir, src_path=self.ctx.bootstrap.build_dir, arch=env['ARCH'])

        env['LDSHARED'] = join(self.ctx.root_dir, 'tools', 'liblink')

        with current_directory(self.get_build_dir(arch.arch)):
            info('hostpython is ' + self.ctx.hostpython)
            hostpython = sh.Command(self.ctx.hostpython)
            shprint(hostpython, 'setup.py', 'install', '-O2', _env=env,
                    _tail=10, _critical=True)

            info('strip is ' + env['STRIP'])
            build_lib = glob.glob('./build/lib*')
            assert len(build_lib) == 1
            print('stripping pygame')
            shprint(sh.find, build_lib[0], '-name', '*.o', '-exec',
                    env['STRIP'], '{}', ';')

        python_install_path = join(self.ctx.build_dir, 'python-install')
        warning('Should remove pygame tests etc. here, but skipping for now')
开发者ID:TangTab,项目名称:python-for-android,代码行数:32,代码来源:__init__.py

示例7: clean_build

    def clean_build(self, arch=None):
        '''Deletes all the build information of the recipe.

        If arch is not None, only this arch dir is deleted. Otherwise
        (the default) all builds for all archs are deleted.

        By default, this just deletes the main build dir. If the
        recipe has e.g. object files biglinked, or .so files stored
        elsewhere, you should override this method.

        This method is intended for testing purposes, it may have
        strange results. Rebuild everything if this seems to happen.

        '''
        if arch is None:
            base_dir = join(self.ctx.build_dir, 'other_builds', self.name)
        else:
            base_dir = self.get_build_container_dir(arch)
        dirs = glob.glob(base_dir + '-*')
        if exists(base_dir):
            dirs.append(base_dir)
        if not dirs:
             warning(('Attempted to clean build for {} but found no existing '
                      'build dirs').format(self.name))

        for directory in dirs:
            if exists(directory):
                info('Deleting {}'.format(directory))
                shutil.rmtree(directory)

        # Delete any Python distributions to ensure the recipe build
        # doesn't persist in site-packages
        shutil.rmtree(self.ctx.python_installs_dir)
开发者ID:llfkj,项目名称:python-for-android,代码行数:33,代码来源:recipe.py

示例8: dist_dir

 def dist_dir(self):
     '''The dist dir at which to place the finished distribution.'''
     if self.distribution is None:
         warning('Tried to access {}.dist_dir, but {}.distribution '
                 'is None'.format(self, self))
         exit(1)
     return self.distribution.dist_dir
开发者ID:kronenpj,项目名称:python-for-android,代码行数:7,代码来源:bootstrap.py

示例9: prebuild_arch

 def prebuild_arch(self, arch):
     super(VlcRecipe, self).prebuild_arch(arch)
     build_dir = self.get_build_dir(arch.arch)
     port_dir = join(build_dir, 'vlc-port-android')
     if self.ENV_LIBVLC_AAR in environ:
         aar = environ.get(self.ENV_LIBVLC_AAR)
         if isdir(aar):
             aar = join(aar, 'libvlc-{}.aar'.format(self.version))
         if not isfile(aar):
             warning("Error: {} is not valid libvlc-<ver>.aar bundle".format(aar))
             info("check {} environment!".format(self.ENV_LIBVLC_AAR))
             exit(1)
         self.aars[arch] = aar
     else:
         aar_path = join(port_dir, 'libvlc', 'build', 'outputs', 'aar')
         self.aars[arch] = aar = join(aar_path, 'libvlc-{}.aar'.format(self.version))
         warning("HINT: set path to precompiled libvlc-<ver>.aar bundle "
                 "in {} environment!".format(self.ENV_LIBVLC_AAR))
         info("libvlc-<ver>.aar should build "
              "from sources at {}".format(port_dir))
         if not isfile(join(port_dir, 'compile.sh')):
             info("clone vlc port for android sources from {}".format(
                         self.port_git))
             shprint(sh.git, 'clone', self.port_git, port_dir,
                     _tail=20, _critical=True)
开发者ID:rnixx,项目名称:python-for-android,代码行数:25,代码来源:__init__.py

示例10: install_libs

 def install_libs(self, arch, *libs):
     libs_dir = self.ctx.get_libs_dir(arch.arch)
     if not libs:
         warning('install_libs called with no libraries to install!')
         return
     args = libs + (libs_dir,)
     shprint(sh.cp, *args)
开发者ID:llfkj,项目名称:python-for-android,代码行数:7,代码来源:recipe.py

示例11: clean_build

    def clean_build(self, arch=None):
        """Deletes all the build information of the recipe.

        If arch is not None, only this arch dir is deleted. Otherwise
        (the default) all builds for all archs are deleted.

        By default, this just deletes the main build dir. If the
        recipe has e.g. object files biglinked, or .so files stored
        elsewhere, you should override this method.

        This method is intended for testing purposes, it may have
        strange results. Rebuild everything if this seems to happen.

        """
        if arch is None:
            base_dir = join(self.ctx.build_dir, "other_builds", self.name)
        else:
            base_dir = self.get_build_container_dir(arch)
        dirs = glob.glob(base_dir + "-*")
        if exists(base_dir):
            dirs.append(base_dir)
        if not dirs:
            warning(("Attempted to clean build for {} but found no existing " "build dirs").format(self.name))

        for directory in dirs:
            if exists(directory):
                info("Deleting {}".format(directory))
                shutil.rmtree(directory)
开发者ID:hottwaj,项目名称:python-for-android,代码行数:28,代码来源:recipe.py

示例12: extract_source

    def extract_source(self, source, cwd):
        """
        (internal) Extract the `source` into the directory `cwd`.
        """
        if not source:
            return
        if isfile(source):
            info("Extract {} into {}".format(source, cwd))

            if source.endswith(".tgz") or source.endswith(".tar.gz"):
                shprint(sh.tar, "-C", cwd, "-xvzf", source)

            elif source.endswith(".tbz2") or source.endswith(".tar.bz2"):
                shprint(sh.tar, "-C", cwd, "-xvjf", source)

            elif source.endswith(".zip"):
                zf = zipfile.ZipFile(source)
                zf.extractall(path=cwd)
                zf.close()

            else:
                warning("Error: cannot extract, unrecognized extension for {}".format(source))
                raise Exception()

        elif isdir(source):
            info("Copying {} into {}".format(source, cwd))

            shprint(sh.cp, "-a", source, cwd)

        else:
            warning("Error: cannot extract or copy, unrecognized path {}".format(source))
            raise Exception()
开发者ID:hottwaj,项目名称:python-for-android,代码行数:32,代码来源:recipe.py

示例13: get_newest_toolchain

    def get_newest_toolchain(self, arch):

        # warning("get_newest_toolchain(self, arch), toolchain prefix = {}".format(toolchain_prefix))
        # [WARNING]: get_newest_toolchain(self, arch), toolchain prefix = arm-linux-androideabi

        toolchain_versions = []
        toolchain_prefix   = arch.toolchain_prefix
        toolchain_path     = join(self.ctx.ndk_dir, 'toolchains')
        if isdir(toolchain_path):
            toolchain_contents = glob.glob('{}/{}-*'.format(toolchain_path,
                                                            toolchain_prefix))
            toolchain_versions = [split(path)[-1][len(toolchain_prefix) + 1:]
                                  for path in toolchain_contents]
        else:
            warning('Could not find toolchain subdirectory!')
        toolchain_versions.sort()

        toolchain_versions_gcc = []
        for toolchain_version in toolchain_versions:
            if toolchain_version[0].isdigit():
                toolchain_versions_gcc.append(toolchain_version) # GCC toolchains begin with a number

        if toolchain_versions:
            toolchain_version = toolchain_versions_gcc[-1] # the latest gcc toolchain
        else:
            warning('Could not find any toolchain for {}!'.format(toolchain_prefix))

        self.toolchain_version = toolchain_version
开发者ID:zwyuan,项目名称:python-for-android,代码行数:28,代码来源:__init__.py

示例14: get_env

    def get_env(self):
        env = {}

        env["CFLAGS"] = " ".join([
            "-DANDROID", "-mandroid", "-fomit-frame-pointer",
            "--sysroot", self.ctx.ndk_platform])

        env["CXXFLAGS"] = env["CFLAGS"]

        env["LDFLAGS"] = " ".join(['-lm'])

        py_platform = sys.platform
        if py_platform in ['linux2', 'linux3']:
            py_platform = 'linux'

        toolchain_prefix = self.ctx.toolchain_prefix
        toolchain_version = self.ctx.toolchain_version
        command_prefix = self.command_prefix

        env['TOOLCHAIN_PREFIX'] = toolchain_prefix
        env['TOOLCHAIN_VERSION'] = toolchain_version

        print('path is', environ['PATH'])
        cc = find_executable('{command_prefix}-gcc'.format(
            command_prefix=command_prefix), path=environ['PATH'])
        if cc is None:
            warning('Couldn\'t find executable for CC. This indicates a '
                    'problem locating the {} executable in the Android '
                    'NDK, not that you don\'t have a normal compiler '
                    'installed. Exiting.')
            exit(1)

        env['CC'] = '{command_prefix}-gcc {cflags}'.format(
            command_prefix=command_prefix,
            cflags=env['CFLAGS'])
        env['CXX'] = '{command_prefix}-g++ {cxxflags}'.format(
            command_prefix=command_prefix,
            cxxflags=env['CXXFLAGS'])

        env['AR'] = '{}-ar'.format(command_prefix)
        env['RANLIB'] = '{}-ranlib'.format(command_prefix)
        env['LD'] = '{}-ld'.format(command_prefix)
        env['STRIP'] = '{}-strip --strip-unneeded'.format(command_prefix)
        env['MAKE'] = 'make -j5'
        env['READELF'] = '{}-readelf'.format(command_prefix)

        hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)

        # AND: This hardcodes python version 2.7, needs fixing
        env['BUILDLIB_PATH'] = join(
            hostpython_recipe.get_build_dir(self.arch),
            'build', 'lib.linux-{}-2.7'.format(uname()[-1]))

        env['PATH'] = environ['PATH']

        env['ARCH'] = self.arch

        return env
开发者ID:simudream,项目名称:python-for-android,代码行数:58,代码来源:archs.py

示例15: check_ndk_api

def check_ndk_api(ndk_api, android_api):
    """Warn if the user's NDK is too high or low."""
    if ndk_api > android_api:
        raise BuildInterruptingException(
            'Target NDK API is {}, higher than the target Android API {}.'.format(
                ndk_api, android_api),
            instructions=('The NDK API is a minimum supported API number and must be lower '
                          'than the target Android API'))

    if ndk_api < MIN_NDK_API:
        warning(OLD_NDK_API_MESSAGE)
开发者ID:PKRoma,项目名称:python-for-android,代码行数:11,代码来源:recommendations.py


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