How to use the pip.log.logger.notify function in pip

To help you get started, we’ve selected a few pip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudfoundry / python-buildpack / vendor / pip-1.5.6 / pip / commands / zip.py View on Github external
for filename in sorted(os.listdir(path)):
                    ext = os.path.splitext(filename)[1].lower()
                    if ext in ('.pth', '.egg-info', '.egg-link'):
                        continue
                    if ext == '.py':
                        logger.info('Not displaying %s: not a package' % display_path(filename))
                        continue
                    full = os.path.join(path, filename)
                    if os.path.isdir(full):
                        unzipped.append((filename, self.count_package(full)))
                    elif zipfile.is_zipfile(full):
                        zipped.append(filename)
                    else:
                        logger.info('Unknown file: %s' % display_path(filename))
                if zipped:
                    logger.notify('Zipped packages:')
                    logger.indent += 2
                    try:
                        for filename in zipped:
                            logger.notify(filename)
                    finally:
                        logger.indent -= 2
                else:
                    logger.notify('No zipped packages.')
                if unzipped:
                    if options.sort_files:
                        unzipped.sort(key=lambda x: -x[1])
                    logger.notify('Unzipped packages:')
                    logger.indent += 2
                    try:
                        for filename, count in unzipped:
                            logger.notify('%s  (%i files)' % (filename, count))
github ansible / awx / awx / lib / site-packages / pip / req.py View on Github external
req_to_install = unnamed.pop(0)
            else:
                req_to_install = reqs.pop(0)
            install_needed = True
            if not self.ignore_installed and not req_to_install.editable:
                req_to_install.check_if_exists()
                if req_to_install.satisfied_by:
                    if self.upgrade:
                        #don't uninstall conflict if user install and and conflict is not user install
                        if not (self.use_user_site and not dist_in_usersite(req_to_install.satisfied_by)):
                            req_to_install.conflicts_with = req_to_install.satisfied_by
                        req_to_install.satisfied_by = None
                    else:
                        install_needed = False
                if req_to_install.satisfied_by:
                    logger.notify('Requirement already satisfied '
                                  '(use --upgrade to upgrade): %s'
                                  % req_to_install)

            if req_to_install.editable:
                if req_to_install.source_dir is None:
                    req_to_install.source_dir = req_to_install.build_location(self.src_dir)
            elif install_needed:
                req_to_install.source_dir = req_to_install.build_location(self.build_dir, not self.is_download)

            if req_to_install.source_dir is not None and not os.path.isdir(req_to_install.source_dir):
                raise InstallationError('Could not install requirement %s '
                                       'because source folder %s does not exist '
                                       '(perhaps --no-download was used without first running '
                                       'an equivalent install with --no-install?)'
                                       % (req_to_install, req_to_install.source_dir))
github IronLanguages / ironpython2 / External.LCA_RESTRICTED / Languages / IronPython / repackage / pip / pip / req.py View on Github external
def run_egg_info(self, force_root_egg_info=False):
        assert self.source_dir
        if self.name:
            logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
        else:
            logger.notify('Running setup.py (path:%s) egg_info for package from %s' % (self.setup_py, self.url))
        logger.indent += 2
        try:

            # if it's distribute>=0.7, it won't contain an importable
            # setuptools, and having an egg-info dir blocks the ability of
            # setup.py to find setuptools plugins, so delete the egg-info dir if
            # no setuptools. it will get recreated by the run of egg_info
            # NOTE: this self.name check only works when installing from a specifier
            #       (not archive path/urls)
            # TODO: take this out later
            if self.name == 'distribute' and not os.path.isdir(os.path.join(self.source_dir, 'setuptools')):
                rmtree(os.path.join(self.source_dir, 'distribute.egg-info'))

            script = self._run_setup_py
github prezi / snakebasket / snakebasket / commands / install.py View on Github external
def add_requirement(self, install_req):
        name = install_req.name
        install_req.as_egg = self.as_egg
        install_req.use_user_site = self.use_user_site
        if not name:
            #url or path requirement w/o an egg fragment
            # make sure no list item has this same url:
            if install_req.url is None or len([i for i in self.unnamed_requirements if i.url == install_req.url]) == 0:
                self.unnamed_requirements.append(install_req)
            return True
        satisfied_by = self.install_req_checker.get_available_substitute(install_req)
        if satisfied_by is not None:
            logger.notify("Package %s already satisfied by %s" % (name, satisfied_by.__repr__()))
        else:
            self.requirements[name] = install_req
        for n in self.install_req_checker.get_all_aliases(name):
            self.requirement_aliases[n] = name
        return satisfied_by is None
github Wox-launcher / Wox / PythonHome / Lib / site-packages / pip / commands / list.py View on Github external
def output_package_listing(self, installed_packages):
        installed_packages = sorted(installed_packages, key=lambda dist: dist.project_name.lower())
        for dist in installed_packages:
            if dist_is_editable(dist):
                line = '%s (%s, %s)' % (dist.project_name, dist.version, dist.location)
            else:
                line = '%s (%s)' % (dist.project_name, dist.version)
            logger.notify(line)
github cloudfoundry / python-buildpack / vendor / pip-1.5.6 / pip / commands / zip.py View on Github external
else:
                        logger.info('Unknown file: %s' % display_path(filename))
                if zipped:
                    logger.notify('Zipped packages:')
                    logger.indent += 2
                    try:
                        for filename in zipped:
                            logger.notify(filename)
                    finally:
                        logger.indent -= 2
                else:
                    logger.notify('No zipped packages.')
                if unzipped:
                    if options.sort_files:
                        unzipped.sort(key=lambda x: -x[1])
                    logger.notify('Unzipped packages:')
                    logger.indent += 2
                    try:
                        for filename, count in unzipped:
                            logger.notify('%s  (%i files)' % (filename, count))
                    finally:
                        logger.indent -= 2
                else:
                    logger.notify('No unzipped packages.')
            finally:
                logger.indent -= 2
github cloudfoundry / python-buildpack / vendor / pip-1.5.6 / pip / commands / zip.py View on Github external
def unzip_package(self, module_name, filename):
        zip_filename = os.path.dirname(filename)
        if not os.path.isfile(zip_filename) and zipfile.is_zipfile(zip_filename):
            raise InstallationError(
                'Module %s (in %s) isn\'t located in a zip file in %s'
                % (module_name, filename, zip_filename))
        package_path = os.path.dirname(zip_filename)
        if not package_path in self.paths():
            logger.warn(
                'Unpacking %s into %s, but %s is not on sys.path'
                % (display_path(zip_filename), display_path(package_path),
                   display_path(package_path)))
        logger.notify('Unzipping %s (in %s)' % (module_name, display_path(zip_filename)))
        if self.simulate:
            logger.notify('Skipping remaining operations because of --simulate')
            return
        logger.indent += 2
        try:
            ## FIXME: this should be undoable:
            zip = zipfile.ZipFile(zip_filename)
            to_save = []
            for info in zip.infolist():
                name = info.filename
                if name.startswith(module_name + os.path.sep):
                    content = zip.read(name)
                    dest = os.path.join(package_path, name)
                    if not os.path.exists(os.path.dirname(dest)):
                        os.makedirs(os.path.dirname(dest))
                    if not content and dest.endswith(os.path.sep):
                        if not os.path.exists(dest):
                            os.makedirs(dest)
github Wox-launcher / Wox / PythonHome / Lib / site-packages / pip / commands / zip.py View on Github external
finally:
                        logger.indent -= 2
                else:
                    logger.notify('No zipped packages.')
                if unzipped:
                    if options.sort_files:
                        unzipped.sort(key=lambda x: -x[1])
                    logger.notify('Unzipped packages:')
                    logger.indent += 2
                    try:
                        for filename, count in unzipped:
                            logger.notify('%s  (%i files)' % (filename, count))
                    finally:
                        logger.indent -= 2
                else:
                    logger.notify('No unzipped packages.')
            finally:
                logger.indent -= 2