How to use the packaging.logger 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 / compiler / View on Github external
def mkpath(self, name, mode=0o777):
        name = os.path.normpath(name)
        if os.path.isdir(name) or name == '':
        if self.dry_run:
            head = ''
            for part in name.split(os.sep):
      "created directory %s%s", head, part)
                head += part + os.sep
        os.makedirs(name, mode)
github larryhastings / gilectomy / Lib / packaging / command / View on Github external
"install-base/install-platbase -- not both")

        if self.home and (self.prefix or self.exec_prefix):
            raise PackagingOptionError(
                "must supply either home or prefix/exec-prefix -- not both")

        if self.user and (self.prefix or self.exec_prefix or self.home or
                          self.install_base or self.install_platbase):
            raise PackagingOptionError(
                "can't combine user with prefix/exec_prefix/home or "

        # Next, stuff that's wrong (or dubious) only on certain platforms.
        if != "posix":
            if self.exec_prefix:
                    '%s: exec-prefix option ignored on this platform',
                self.exec_prefix = None

        # Now the interesting logic -- so interesting that we farm it out
        # to other methods.  The goal of these methods is to set the final
        # values for the install_{lib,scripts,data,...}  options, using as
        # input a heady brew of prefix, exec_prefix, home, install_base,
        # install_platbase, user-supplied versions of
        # install_{purelib,platlib,lib,scripts,data,...}, and the
        # INSTALL_SCHEME dictionary above.  Phew!


        if == 'posix':
github larryhastings / gilectomy / Lib / packaging / compiler / View on Github external
RegError = winreg.error

except ImportError:
        import win32api
        import win32con
        _can_read_reg = True
        hkey_mod = win32con

        RegOpenKeyEx = win32api.RegOpenKeyEx
        RegEnumKey = win32api.RegEnumKey
        RegEnumValue = win32api.RegEnumValue
        RegError = win32api.error

    except ImportError:
            "can't read registry to find the necessary compiler setting;\n"
            "make sure that Python modules _winreg, win32api or win32con "
            "are installed.")

if _can_read_reg:
    HKEYS = (hkey_mod.HKEY_USERS,

def read_keys(base, key):
    """Return list of registry keys."""

        handle = RegOpenKeyEx(base, key)
github larryhastings / gilectomy / Lib / packaging / command / View on Github external
# send the data
            result = urlopen(request)
            status = result.code
            reason = result.msg
        except socket.error as e:
        except HTTPError as e:
            status = e.code
            reason = e.msg

        if status == 200:
  'Server response (%s): %s', status, reason)
            logger.error('Upload failed (%s): %s', status, reason)

        if self.show_response and logger.isEnabledFor(logging.INFO):
            sep = '-' * 75
  '%s\n%s\n%s', sep,, sep)
github larryhastings / gilectomy / Lib / packaging / View on Github external
metadata = release.fetch_metadata()

    # we need to build setuptools deps if any
    if 'requires_dist' not in metadata:
        metadata['requires_dist'] = _get_setuptools_deps(release)

    # build the dependency graph with local and required dependencies
    dists = list(installed)
    depgraph = generate_graph(dists)

    # Get what the missing deps are
    dists = depgraph.missing[release]
    if dists:"Missing dependencies found, retrieving metadata")
        # we have missing deps
        for dist in dists:
            _update_infos(infos, get_infos(dist, index, installed))

    # Fill in the infos
    existing = [d for d in installed if ==]
    if existing:
    return infos
github larryhastings / gilectomy / Lib / packaging / command / View on Github external
if package_dir != "":
            if not os.path.exists(package_dir):
                raise PackagingFileError(
                      "package directory '%s' does not exist" % package_dir)
            if not os.path.isdir(package_dir):
                raise PackagingFileError(
                       "supposed package directory '%s' exists, "
                       "but is not a directory" % package_dir)

        # Require for all but the "root package"
        if package:
            init_py = os.path.join(package_dir, "")
            if os.path.isfile(init_py):
                return init_py
                logger.warning("package init file %r not found "
                               "(or not a regular file)", init_py)

        # Either not in a package at all ( not expected), or
        # doesn't exist -- so don't return the filename.
        return None
github naftaliharris / tauthon / Lib / packaging / pypi / View on Github external
        with self._open_url(url) as f:
            base_url = f.url
            if url not in self._processed_urls:
                link_matcher = self._get_link_matcher(url)
                for link, is_download in link_matcher(, base_url):
                    if link not in self._processed_urls:
                        if self._is_distribution(link) or is_download:
                            # it's a distribution, so create a dist object
                                infos = get_infos_from_url(link, project_name,
                                            is_external=self.index_url not in url)
                            except CantParseArchiveName as e:
                                    "version has not been parsed: %s", e)
                            if self._is_browsable(link) and follow_links:
                                self._process_url(link, project_name,
github larryhastings / gilectomy / Lib / packaging / command / View on Github external
def warn(self, msg, *args):
        """Wrapper around logging that also remembers messages."""
        # XXX we could use a special handler for this, but would need to test
        # if it works even if the logger has a too high level
        self._warnings.append((msg, args))
        return logger.warning('%s: %s' % (self.get_command_name(), msg), *args)
github larryhastings / gilectomy / Lib / packaging / View on Github external
# XXX there's a bug somewhere: the help text says that -v is default
        # (and verbose is set to 1 above), but when the user explicitly gives
        # -v on the command line, self.verbose is incremented to 2!  Here we
        # compensate for that (I tested manually).  On a related note, I think
        # it's a good thing to use -q/nothing/-v/-vv on the command line
        # instead of logging constants; it will be easy to add support for
        # logging configuration in setup.cfg for advanced users. --merwok
        elif self.verbose in (1, 2):
            level = logging.INFO
        else:  # -vv and more for debug
            level = logging.DEBUG

        # setting up the stream handler
        handler = logging.StreamHandler(sys.stderr)
github larryhastings / gilectomy / Lib / packaging / compiler / View on Github external
"""Set environment variable 'name' to an MSVC path type value.

        This is equivalent to a SET command prior to execution of spawned

        if name == "lib":
            p = self.get_msvc_paths("library")
            p = self.get_msvc_paths(name)
        if p:
            os.environ[name] = ';'.join(p)

if get_build_version() >= 8.0:
    logger.debug("importing new compiler from distutils.msvc9compiler")
    OldMSVCCompiler = MSVCCompiler
    from packaging.compiler.msvc9compiler import MSVCCompiler
    # get_build_architecture not really relevant now we support cross-compile
    from packaging.compiler.msvc9compiler import MacroExpander