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


Python logger.info函数代码示例

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


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

示例1: install_pythonbrew

def install_pythonbrew():
    PythonbrewInstaller().install(INSTALLER_ROOT)
    
    m = re.search("(t?csh)", os.environ.get("SHELL"))
    if m:
        shrc = "cshrc"
        yourshrc = m.group(1)+"rc"
    else:
        shrc = yourshrc = "bashrc"
    
    logger.info("""
Well-done! Congratulations!

The pythonbrew is installed as:
    
  %(ROOT)s

Please add the following line to the end of your ~/.%(yourshrc)s

  source %(PATH_ETC)s/%(shrc)s

After that, exit this shell, start a new one, and install some fresh
pythons:

  pythonbrew install 2.6.6
  pythonbrew install 2.5.5

For further instructions, run:

  pythonbrew help

The default help messages will popup and tell you what to do!

Enjoy pythonbrew at %(ROOT)s!!
""" % {'ROOT':ROOT, 'yourshrc':yourshrc, 'shrc':shrc, 'PATH_ETC':PATH_ETC})
开发者ID:nvie,项目名称:pythonbrew,代码行数:35,代码来源:installer.py

示例2: run_command_clone

    def run_command_clone(self, options, args):
        if len(args) < 3:
            logger.error("Unrecognized command line argument: ( 'pythonbrew venv clone <source> <target>' )")
            sys.exit(1)
        if not os.access(PATH_VENVS, os.W_OK):
            logger.error("Can not clone a virtual environment in %s.\nPermission denied." % PATH_VENVS)
            sys.exit(1)
        if not self._pkgname:
            logger.error("Unknown python version: ( 'pythonbrew venv clone <source> <target> -p VERSION' )")
            sys.exit(1)

        source, target = args[1], args[2]
        source_dir = os.path.join(self._workon_home, source)
        target_dir = os.path.join(self._workon_home, target)

        if not os.path.isdir(source_dir):
            logger.error('%s does not exist.' % source_dir)
            sys.exit(1)

        if os.path.isdir(target_dir):
            logger.error('Can not overwrite %s.' % target_dir)
            sys.exit(1)

        logger.info("Cloning `%s` environment into `%s` on %s" % (source, target, self._workon_home))

        # Copies source to target
        cmd = [self._py, self._venv_clone, source_dir, target_dir]
        s = Subprocess()
        s.call(cmd)
开发者ID:Annia,项目名称:pythonbrew,代码行数:29,代码来源:venv.py

示例3: install_setuptools

    def install_setuptools(self):
        options = self.options
        pkgname = self.pkg.name
        if options.no_setuptools:
            logger.log("Skip installation of setuptools.")
            return
        download_url = DISTRIBUTE_SETUP_DLSITE
        filename = Link(download_url).filename
        download_file = os.path.join(PATH_DISTS, filename)

        dl = Downloader()
        dl.download(filename, download_url, download_file)

        install_dir = os.path.join(PATH_PYTHONS, pkgname)
        path_python = os.path.join(install_dir,"bin","python")
        try:
            s = Subprocess(log=self.logfile, cwd=PATH_DISTS, verbose=self.options.verbose)
            logger.info("Installing distribute into %s" % install_dir)
            s.check_call([path_python, filename])
            # installing pip
            easy_install = os.path.join(install_dir, 'bin', 'easy_install')
            if os.path.isfile(easy_install):
                logger.info("Installing pip into %s" % install_dir)
                s.check_call([easy_install, 'pip'])
        except:
            logger.error("Failed to install setuptools. See %s/build.log to see why." % (ROOT))
            logger.log("Skip installation of setuptools.")
开发者ID:Ank1tAggarwal,项目名称:pythonbrew,代码行数:27,代码来源:pythoninstaller.py

示例4: patch

 def patch(self):
     version = self.pkg.version
     try:
         s = Subprocess(log=self.logfile, cwd=self.build_dir)
         patches = []
         if is_macosx_snowleopard():
             if is_python24(version):
                 patch_dir = os.path.join(PATH_PATCHES_MACOSX_PYTHON24,'files')
                 patches = ['patch-configure', 'patch-Makefile.pre.in',
                            'patch-Lib-cgi.py', 'patch-Lib-site.py',
                            'patch-setup.py', 'patch-Include-pyport.h',
                            'patch-Mac-OSX-Makefile.in', 'patch-Mac-OSX-IDLE-Makefile.in',
                            'patch-Mac-OSX-PythonLauncher-Makefile.in', 'patch-configure-badcflags.diff',
                            'patch-configure-arch_only.diff', 'patch-macosmodule.diff',
                            'patch-mactoolboxglue.diff', 'patch-pymactoolbox.diff']
             elif is_python25(version):
                 patch_dir = os.path.join(PATH_PATCHES_MACOSX_PYTHON25,'files')
                 patches = ['patch-Makefile.pre.in.diff', 'patch-Lib-cgi.py.diff',
                            'patch-Lib-distutils-dist.py.diff', 'patch-setup.py.diff',
                            'patch-configure-badcflags.diff', 'patch-configure-arch_only.diff',
                            'patch-64bit.diff', 'patch-pyconfig.h.in.diff',
                            'patch-Modules-posixmodule.c.diff']
         if patches:
             logger.info("Patching %s" % self.pkg.name)
             for patch in patches:
                 s.check_call("patch -p0 < %s" % os.path.join(patch_dir, patch))
     except:
         logger.error("Failed to patch `%s`" % self.build_dir)
         sys.exit(1)
开发者ID:nvie,项目名称:pythonbrew,代码行数:29,代码来源:installer.py

示例5: __init__

 def __init__(self, arg, options):
     if is_url(arg):
         name = arg
     elif is_archive_file(arg):
         name = path_to_fileurl(arg)
     elif os.path.isdir(arg):
         name = path_to_fileurl(arg)
     else:
         name = arg
     
     if is_url(name):
         self.download_url = name
         filename = Link(self.download_url).filename
         pkg = Package(filename)
     else:
         pkg = Package(name)
         self.download_url = get_python_version_url(pkg.version)
         if not self.download_url:
             logger.info("Unknown python version: `%s`" % pkg.name)
             sys.exit(1)
         filename = Link(self.download_url).filename
     self.pkg = pkg
     self.install_dir = "%s/%s" % (PATH_PYTHONS, pkg.name)
     self.build_dir = "%s/%s" % (PATH_BUILD, pkg.name)
     self.download_file = "%s/%s" % (PATH_DISTS, filename)
     if is_file(self.download_url):
         path = fileurl_to_path(self.download_url)
         self.content_type = mimetypes.guess_type(path)[0]
     else:
         headerinfo = get_headerinfo_from_url(self.download_url)
         self.content_type = headerinfo['content-type']
     self.options = options
     self.logfile = "%s/build.log" % PATH_LOG
开发者ID:Singletoned,项目名称:pythonbrew,代码行数:33,代码来源:installer.py

示例6: run_command_clone

 def run_command_clone(self, options, args):
     if len(args) < 3:
         logger.error("Unrecognized command line argument: ( 'pythonbrew venv clone <source> <target>' )")
         sys.exit(1)
     
     if not os.access(PATH_VENVS, os.W_OK):
         logger.error("Can not clone a virtual environment in %s.\nPermission denied." % PATH_VENVS)
         sys.exit(1)
     
     virtualenv_options = []
     if options.no_site_packages:
         virtualenv_options.append('--no-site-packages')
     
     source, target = args[1], args[2]
     source_dir     = os.path.join(self._workon_home, source)
     target_dir     = os.path.join(self._workon_home, target)
     
     if not os.path.isdir(source_dir):
         logger.error('%s does not exist.' % source_dir)
         sys.exit(1)
     
     logger.info("Cloning `%s` environment into `%s` on %s" % (source, target, self._workon_home))
     
     # Create the new venv first
     self.run_command_create(options, ['create', target])
     
     print "Copying " + source + "'s libraries to " + target + "'s virtual environment...",
     # Copy all files and folders into the new venv dir, without replacing anything
     copy_libs(source, target)
     print "done."
     
     # Activate the new venv
     self.run_command_use(options, ['use', target])
开发者ID:jmagnusson,项目名称:pythonbrew,代码行数:33,代码来源:venv.py

示例7: run_command

    def run_command(self, options, args):
        if options.python:
            pkgname = Package(options.python).name
        else:
            pkgname = get_using_python_pkgname()
        if not is_installed(pkgname):
            logger.error('`%s` is not installed.' % pkgname)
            sys.exit(1)
        logger.info('Using %s' % pkgname)
        
        # build a path
        python = os.path.join(PATH_PYTHONS, pkgname, 'bin', 'python')
        
        # Download bootstrap.py
        download_url = BOOTSTRAP_DLSITE
        download_hash = BOOTSTRAP_HASH
        filename = Link(download_url).filename
        bootstrap = os.path.join(os.getcwd(), filename) # fetching into current directory
        try:
            d = Downloader()
            d.download(filename, download_url, bootstrap, download_hash) 
        except:
            e = sys.exc_info()[1]
            logger.error("%s" % (e))
            sys.exit(1)

        # call bootstrap.py
        if subprocess.call([python, bootstrap, '-d']):
            logger.error('Failed to bootstrap.')
            sys.exit(1)

        # call buildout
        subprocess.call(['./bin/buildout'])
开发者ID:steakknife,项目名称:pythonbrew,代码行数:33,代码来源:buildout.py

示例8: unpack_downloadfile

def unpack_downloadfile(content_type, download_file, target_dir):
    logger.info("Extracting %s into %s" % (os.path.basename(download_file), target_dir))
    if is_gzip(content_type, download_file):
        untar_file(download_file, target_dir)
    else:
        logger.error("Cannot determine archive format of %s" % download_file)
        return False
    return True
开发者ID:npinto,项目名称:pythonbrew,代码行数:8,代码来源:util.py

示例9: _symlink

 def _symlink(self, srcbin, dstbin, pkgname):
     """Create a symlink.
     """
     src = os.path.join(PATH_PYTHONS, pkgname, 'bin', srcbin)
     dst = os.path.join(PATH_BIN, dstbin)
     if os.path.isfile(src):
         symlink(src, dst)
     else:
         logger.info("%s: File not found" % src)
开发者ID:npinto,项目名称:pythonbrew,代码行数:9,代码来源:symlink.py

示例10: check_call

 def check_call(self, cmd, shell=None, cwd=None):
     if shell:
         self._shell = shell
     if cwd:
         self._cwd = cwd
     if self._print_cmd:
         logger.info(cmd)
     if self._log:
         cmd = "(%s) >> '%s' 2>&1" % (cmd, self._log)
     retcode = subprocess.call(cmd, shell=self._shell, cwd=self._cwd)
     if retcode != 0:
         raise ShellCommandException('Failed to `%s` command' % cmd)
开发者ID:npinto,项目名称:pythonbrew,代码行数:12,代码来源:util.py

示例11: run_command_init

 def run_command_init(self):
     if os.path.exists(self._venv):
         logger.info('venv command is already initialized.')
         return
     if not os.access(PATH_DISTS, os.W_OK):
         logger.error("Can not initialize venv command: Permission denied.")
         sys.exit(1)
     d = Downloader()
     download_file = os.path.join(PATH_DISTS, 'virtualenv.tar.gz')
     d.download('virtualenv.tar.gz', VIRTUALENV_DLSITE, download_file)
     logger.info('Extracting virtualenv into %s' % self._venv_dir)
     untar_file(download_file, self._venv_dir)
开发者ID:ampledata,项目名称:pythonbrew,代码行数:12,代码来源:venv.py

示例12: run_command_delete

 def run_command_delete(self, options, args):
     for arg in args[1:]:
         target_dir = os.path.join(self._workon_home, arg)
         if not os.path.isdir(target_dir):
             logger.error('%s already does not exist.' % target_dir)
         else:
             if not os.access(target_dir, os.W_OK):
                 logger.error("Can not delete %s.\nPermission denied." % target_dir)
                 continue
             logger.info('Deleting `%s` environment in %s' % (arg, self._workon_home))
             # make command
             rm_r(target_dir)
开发者ID:ampledata,项目名称:pythonbrew,代码行数:12,代码来源:venv.py

示例13: run_command

 def run_command(self, options, args):
     if not args:
         logger.error("Unrecognized command line argument: argument not found.")
         sys.exit(1)
     pkg = Package(args[0])
     pkgname = pkg.name
     pkgdir = "%s/%s" % (PATH_PYTHONS, pkgname)
     if not os.path.isdir(pkgdir):
         logger.error("`%s` is not installed." % pkgname)
         sys.exit(1)
     self._switch_dir(pkgdir)
     logger.info("Switched to %s" % pkgname)
开发者ID:nvie,项目名称:pythonbrew,代码行数:12,代码来源:switch.py

示例14: patch

 def patch(self):
     version = self.pkg.version
     try:
         s = Subprocess(log=self.logfile, cwd=self.build_dir)
         patches = []
         eds = {}
         if is_python24(version):
             patch_dir = PATH_PATCHES_MACOSX_PYTHON24
             patches = ['patch-configure', 'patch-Makefile.pre.in',
                        'patch-Lib-cgi.py.diff', 'patch-Lib-site.py.diff',
                        'patch-setup.py.diff', 'patch-Include-pyport.h',
                        'patch-Mac-OSX-Makefile.in', 'patch-Mac-OSX-IDLE-Makefile.in',
                        'patch-Mac-OSX-PythonLauncher-Makefile.in', 'patch-configure-badcflags.diff',
                        'patch-configure-arch_only.diff', 'patch-macosmodule.diff',
                        'patch-mactoolboxglue.diff', 'patch-pymactoolbox.diff',
                        'patch-gestaltmodule.c.diff']
         elif is_python25(version):
             patch_dir = PATH_PATCHES_MACOSX_PYTHON25
             patches = ['patch-Makefile.pre.in.diff', 
                        'patch-Lib-cgi.py.diff',
                        'patch-Lib-distutils-dist.py.diff', 
                        'patch-setup.py.diff',
                        'patch-configure-badcflags.diff', 
                        'patch-configure-arch_only.diff',
                        'patch-64bit.diff', 
                        'patch-pyconfig.h.in.diff',
                        'patch-gestaltmodule.c.diff']
             eds = {'_localemodule.c.ed': 'Modules/_localemodule.c', 
                    'locale.py.ed': 'Lib/locale.py'}
         elif is_python26(version):
             patch_dir = PATH_PATCHES_MACOSX_PYTHON26
             patches = ['patch-Lib-cgi.py.diff', 
                        'patch-Lib-distutils-dist.py.diff',
                        'patch-Mac-IDLE-Makefile.in.diff',
                        'patch-Mac-Makefile.in.diff',
                        'patch-Mac-PythonLauncher-Makefile.in.diff',
                        'patch-Mac-Tools-Doc-setup.py.diff',
                        'patch-setup.py-db46.diff',
                        'patch-Lib-ctypes-macholib-dyld.py.diff',
                        'patch-setup_no_tkinter.py.diff']
             eds = {'_localemodule.c.ed': 'Modules/_localemodule.c', 
                    'locale.py.ed': 'Lib/locale.py'}
             
         if patches or eds:
             logger.info("Patching %s" % self.pkg.name)
             for patch in patches:
                 s.check_call("patch -p0 < %s" % os.path.join(patch_dir, patch))
             for (ed, source) in eds.items():
                 ed = os.path.join(patch_dir, ed)
                 s.check_call('ed - %s < %s' % (source, ed))
     except:
         logger.error("Failed to patch `%s`" % self.build_dir)
         sys.exit(1)
开发者ID:npinto,项目名称:pythonbrew,代码行数:53,代码来源:pythoninstaller.py

示例15: check_call

 def check_call(self, cmd, shell=None, cwd=None):
     if shell:
         self._shell = shell
     if cwd:
         self._cwd = cwd
     if self._print_cmd:
         logger.info(cmd)
     if self._log:
         cmd = "(%s) >> '%s' 2>&1" % (cmd, self._log)
     retcode = subprocess.call(cmd, shell=self._shell, cwd=self._cwd)
     if retcode != 0:
         raise BuildingException()
开发者ID:nvie,项目名称:pythonbrew,代码行数:12,代码来源:util.py


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