How to use the packaging.logger.debug function in packaging

To help you get started, we’ve selected a few packaging 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 larryhastings / gilectomy / Lib / packaging / install.py View on Github external
for installed_project in installed:
        # is it a compatible project ?
        if predicate.name.lower() != installed_project.name.lower():
            continue
        found = True
        logger.info('Found %r %s', installed_project.name,
                    installed_project.version)

        # if we already have something installed, check it matches the
        # requirements
        if predicate.match(installed_project.version):
            return infos
        break

    if not found:
        logger.debug('Project not installed')

    if not index:
        index = wrapper.ClientWrapper()

    if not installed:
        installed = get_distributions(use_egg_info=True)

    # Get all the releases that match the requirements
    try:
        release = index.get_release(requirements)
    except (ReleaseNotFound, ProjectNotFound):
        raise InstallationException('Release not found: %r' % requirements)

    if release is None:
        logger.info('Could not find a matching project')
        return infos
github larryhastings / gilectomy / Lib / packaging / compiler / msvccompiler.py View on Github external
self.library_filename(dll_name))
                ld_args.append('/IMPLIB:' + implib_file)

            if extra_preargs:
                ld_args[:0] = extra_preargs
            if extra_postargs:
                ld_args.extend(extra_postargs)

            self.mkpath(os.path.dirname(output_filename))
            try:
                self.spawn([self.linker] + ld_args)
            except PackagingExecError as msg:
                raise LinkError(msg)

        else:
            logger.debug("skipping %s (up-to-date)", output_filename)
github larryhastings / gilectomy / Lib / packaging / command / install_dist.py View on Github external
def dump_dirs(self, msg):
        """Dump the list of user options."""
        logger.debug(msg + ":")
        for opt in self.user_options:
            opt_name = opt[0]
            if opt_name[-1] == "=":
                opt_name = opt_name[0:-1]
            if opt_name in self.negative_opt:
                opt_name = self.negative_opt[opt_name]
                opt_name = opt_name.replace('-', '_')
                val = not getattr(self, opt_name)
            else:
                opt_name = opt_name.replace('-', '_')
                val = getattr(self, opt_name)
            logger.debug("  %s: %s", opt_name, val)
github larryhastings / gilectomy / Lib / packaging / install.py View on Github external
{'install': [], 'remove': [], 'conflict': []}

    Conflict contains all the conflicting distributions, if there is a
    conflict.
    """
    # this function does several things:
    # 1. get a release specified by the requirements
    # 2. gather its metadata, using setuptools compatibility if needed
    # 3. compare this tree with what is currently installed on the system,
    #    return the requirements of what is missing
    # 4. do that recursively and merge back the results
    # 5. return a dict containing information about what is needed to install
    #    or remove

    if not installed:
        logger.debug('Reading installed distributions')
        installed = list(get_distributions(use_egg_info=True))

    infos = {'install': [], 'remove': [], 'conflict': []}
    # Is a compatible version of the project already installed ?
    predicate = get_version_predicate(requirements)
    found = False

    # check that the project isn't already installed
    for installed_project in installed:
        # is it a compatible project ?
        if predicate.name.lower() != installed_project.name.lower():
            continue
        found = True
        logger.info('Found %r %s', installed_project.name,
                    installed_project.version)
github larryhastings / gilectomy / Lib / packaging / util.py View on Github external
def _has_egg_info(srcdir):
    if os.path.isdir(srcdir):
        for item in os.listdir(srcdir):
            full_path = os.path.join(srcdir, item)
            if item.endswith('.egg-info') and os.path.isdir(full_path):
                logger.debug("Found egg-info directory.")
                return True
    logger.debug("No egg-info directory found.")
    return False
github larryhastings / gilectomy / Lib / packaging / dist.py View on Github external
def _set_command_options(self, command_obj, option_dict=None):
        """Set the options for 'command_obj' from 'option_dict'.  Basically
        this means copying elements of a dictionary ('option_dict') to
        attributes of an instance ('command').

        'command_obj' must be a Command instance.  If 'option_dict' is not
        supplied, uses the standard option dictionary for this command
        (from 'self.command_options').
        """
        command_name = command_obj.get_command_name()
        if option_dict is None:
            option_dict = self.get_option_dict(command_name)

        logger.debug("  setting options for %r command:", command_name)

        for option, (source, value) in option_dict.items():
            logger.debug("    %s = %s (from %s)", option, value, source)
            try:
                bool_opts = [x.replace('-', '_')
                             for x in command_obj.boolean_options]
            except AttributeError:
                bool_opts = []
            try:
                neg_opt = command_obj.negative_opt
            except AttributeError:
                neg_opt = {}

            try:
                is_string = isinstance(value, str)
                if option in neg_opt and is_string:
github larryhastings / gilectomy / Lib / packaging / util.py View on Github external
def _has_egg_info(srcdir):
    if os.path.isdir(srcdir):
        for item in os.listdir(srcdir):
            full_path = os.path.join(srcdir, item)
            if item.endswith('.egg-info') and os.path.isdir(full_path):
                logger.debug("Found egg-info directory.")
                return True
    logger.debug("No egg-info directory found.")
    return False
github larryhastings / gilectomy / Lib / packaging / compiler / unixccompiler.py View on Github external
self.spawn(self.archiver +
                       [output_filename] +
                       objects + self.objects)

            # Not many Unices required ranlib anymore -- SunOS 4.x is, I
            # think the only major Unix that does.  Maybe we need some
            # platform intelligence here to skip ranlib if it's not
            # needed -- or maybe Python's configure script took care of
            # it for us, hence the check for leading colon.
            if self.ranlib:
                try:
                    self.spawn(self.ranlib + [output_filename])
                except PackagingExecError as msg:
                    raise LibError(msg)
        else:
            logger.debug("skipping %s (up-to-date)", output_filename)
github larryhastings / gilectomy / Lib / packaging / dist.py View on Github external
def get_command_obj(self, command, create=True):
        """Return the command object for 'command'.  Normally this object
        is cached on a previous call to 'get_command_obj()'; if no command
        object for 'command' is in the cache, then we either create and
        return it (if 'create' is true) or return None.
        """
        cmd_obj = self.command_obj.get(command)
        if not cmd_obj and create:
            logger.debug("Distribution.get_command_obj(): "
                         "creating %r command object", command)

            cls = get_command_class(command)
            cmd_obj = self.command_obj[command] = cls(self)
            self.have_run[command] = 0

            # Set any options that were supplied in config files or on the
            # command line.  (XXX support for error reporting is suboptimal
            # here: errors aren't reported until finalize_options is called,
            # which means we won't report the source of the error.)
            options = self.command_options.get(command)
            if options:
                self._set_command_options(cmd_obj, options)

        return cmd_obj
github larryhastings / gilectomy / Lib / packaging / compiler / msvc9compiler.py View on Github external
if toolsdir and os.path.isdir(toolsdir):
            productdir = os.path.join(toolsdir, os.pardir, os.pardir, "VC")
            productdir = os.path.abspath(productdir)
            if not os.path.isdir(productdir):
                logger.debug("%s is not a valid directory", productdir)
                return None
        else:
            logger.debug("env var %s is not set or invalid", toolskey)
    if not productdir:
        logger.debug("no productdir found")
        return None
    vcvarsall = os.path.join(productdir, "vcvarsall.bat")
    if os.path.isfile(vcvarsall):
        return vcvarsall
    logger.debug("unable to find vcvarsall.bat")
    return None