PK       ! :      install_scripts.pynu [        """distutils.command.install_scripts

Implements the Distutils 'install_scripts' command, for installing
Python scripts."""

# contributed by Bastian Kleineidam

import os
from distutils.core import Command
from distutils import log
from stat import ST_MODE


class install_scripts(Command):

    description = "install scripts (Python or otherwise)"

    user_options = [
        ('install-dir=', 'd', "directory to install scripts to"),
        ('build-dir=','b', "build directory (where to install from)"),
        ('force', 'f', "force installation (overwrite existing files)"),
        ('skip-build', None, "skip the build steps"),
    ]

    boolean_options = ['force', 'skip-build']

    def initialize_options(self):
        self.install_dir = None
        self.force = 0
        self.build_dir = None
        self.skip_build = None

    def finalize_options(self):
        self.set_undefined_options('build', ('build_scripts', 'build_dir'))
        self.set_undefined_options('install',
                                   ('install_scripts', 'install_dir'),
                                   ('force', 'force'),
                                   ('skip_build', 'skip_build'),
                                  )

    def run(self):
        if not self.skip_build:
            self.run_command('build_scripts')
        self.outfiles = self.copy_tree(self.build_dir, self.install_dir)
        if os.name == 'posix':
            # Set the executable bits (owner, group, and world) on
            # all the scripts we just installed.
            for file in self.get_outputs():
                if self.dry_run:
                    log.info("changing mode of %s", file)
                else:
                    mode = ((os.stat(file)[ST_MODE]) | 0o555) & 0o7777
                    log.info("changing mode of %s to %o", file, mode)
                    os.chmod(file, mode)

    def get_inputs(self):
        return self.distribution.scripts or []

    def get_outputs(self):
        return self.outfiles or []
PK       ! ;Rx  Rx  
  install.pynu [        """distutils.command.install

Implements the Distutils 'install' command."""

import sys
import sysconfig
import os
import re

from distutils import log
from distutils.core import Command
from distutils.debug import DEBUG
from distutils.sysconfig import get_config_vars, is_virtual_environment
from distutils.errors import DistutilsPlatformError
from distutils.file_util import write_file
from distutils.util import convert_path, subst_vars, change_root
from distutils.util import get_platform
from distutils.errors import DistutilsOptionError

from site import USER_BASE
from site import USER_SITE

HAS_USER_SITE = (USER_SITE is not None)

# The keys to an installation scheme; if any new types of files are to be
# installed, be sure to add an entry to every scheme in
# sysconfig._INSTALL_SCHEMES, and to SCHEME_KEYS here.
SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')

# The following code provides backward-compatible INSTALL_SCHEMES
# while making the sysconfig module the single point of truth.
# This makes it easier for OS distributions where they need to
# alter locations for packages installations in a single place.
# Note that this module is deprecated (PEP 632); all consumers
# of this information should switch to using sysconfig directly.
INSTALL_SCHEMES = {"unix_prefix": {}, "unix_home": {}, "nt": {}}

# add the Debian install schemes here until they are added to sysconfig
INSTALL_SCHEMES['unix_local'] = {
    'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}',
    'platstdlib': '{platbase}/{platlibdir}/python{py_version_short}',
    'purelib': '{base}/local/lib/python{py_version_short}/dist-packages',
    'platlib': '{platbase}/local/{platlibdir}/python{py_version_short}/dist-packages',
    'include': '{installed_base}/include/python{py_version_short}{abiflags}',
    'headers': '{base}/local/include/python{py_version_short}{abiflags}',
    'platinclude': '{installed_platbase}/include/python{py_version_short}{abiflags}',
    'scripts': '{base}/local/bin',
    'data': '{base}/local',
}
INSTALL_SCHEMES['deb_system'] = {
    'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}',
    'platstdlib': '{platbase}/{platlibdir}/python{py_version_short}',
    'purelib': '{base}/lib/python3/dist-packages',
    'platlib': '{platbase}/{platlibdir}/python3/dist-packages',
    'include': '{installed_base}/include/python{py_version_short}{abiflags}',
    'headers': '{installed_base}/include/python{py_version_short}{abiflags}',
    'platinclude': '{installed_platbase}/include/python{py_version_short}{abiflags}',
    'scripts': '{base}/bin',
    'data': '{base}',
}

# Copy from sysconfig._INSTALL_SCHEMES
for key in SCHEME_KEYS:
    for distutils_scheme_name, sys_scheme_name in (
            ("unix_prefix", "posix_prefix"), ("unix_home", "posix_home"),
            ("nt", "nt")):
        sys_key = key
        sys_scheme = sysconfig._INSTALL_SCHEMES[sys_scheme_name]
        if key == "headers" and key not in sys_scheme:
            # On POSIX-y platforms, Python will:
            # - Build from .h files in 'headers' (only there when
            #   building CPython)
            # - Install .h files to 'include'
            # When 'headers' is missing, fall back to 'include'
            sys_key = 'include'
        INSTALL_SCHEMES[distutils_scheme_name][key] = sys_scheme[sys_key]

# Transformation to different template format
for main_key in INSTALL_SCHEMES:
    for key, value in INSTALL_SCHEMES[main_key].items():
        # Change all ocurences of {variable} to $variable
        value = re.sub(r"\{(.+?)\}", r"$\g<1>", value)
        value = value.replace("$installed_base", "$base")
        value = value.replace("$py_version_nodot_plat", "$py_version_nodot")
        if key == "headers":
            value += "/$dist_name"
        if sys.version_info >= (3, 9) and key == "platlib":
            # platlibdir is available since 3.9: bpo-1294959
            value = value.replace("/lib/", "/$platlibdir/")
        INSTALL_SCHEMES[main_key][key] = value

# The following part of INSTALL_SCHEMES has a different definition
# than the one in sysconfig, but because both depend on the site module,
# the outcomes should be the same.
if HAS_USER_SITE:
    INSTALL_SCHEMES['nt_user'] = {
        'purelib': '$usersite',
        'platlib': '$usersite',
        'headers': '$userbase/Python$py_version_nodot/Include/$dist_name',
        'scripts': '$userbase/Python$py_version_nodot/Scripts',
        'data'   : '$userbase',
        }

    INSTALL_SCHEMES['unix_user'] = {
        'purelib': '$usersite',
        'platlib': '$usersite',
        'headers':
            '$userbase/include/python$py_version_short$abiflags/$dist_name',
        'scripts': '$userbase/bin',
        'data'   : '$userbase',
        }


class install(Command):

    description = "install everything from build directory"

    user_options = [
        # Select installation scheme and set base director(y|ies)
        ('prefix=', None,
         "installation prefix"),
        ('exec-prefix=', None,
         "(Unix only) prefix for platform-specific files"),
        ('home=', None,
         "(Unix only) home directory to install under"),

        # Or, just set the base director(y|ies)
        ('install-base=', None,
         "base installation directory (instead of --prefix or --home)"),
        ('install-platbase=', None,
         "base installation directory for platform-specific files " +
         "(instead of --exec-prefix or --home)"),
        ('root=', None,
         "install everything relative to this alternate root directory"),

        # Or, explicitly set the installation scheme
        ('install-purelib=', None,
         "installation directory for pure Python module distributions"),
        ('install-platlib=', None,
         "installation directory for non-pure module distributions"),
        ('install-lib=', None,
         "installation directory for all module distributions " +
         "(overrides --install-purelib and --install-platlib)"),

        ('install-headers=', None,
         "installation directory for C/C++ headers"),
        ('install-scripts=', None,
         "installation directory for Python scripts"),
        ('install-data=', None,
         "installation directory for data files"),

        # Byte-compilation options -- see install_lib.py for details, as
        # these are duplicated from there (but only install_lib does
        # anything with them).
        ('compile', 'c', "compile .py to .pyc [default]"),
        ('no-compile', None, "don't compile .py files"),
        ('optimize=', 'O',
         "also compile with optimization: -O1 for \"python -O\", "
         "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),

        # Miscellaneous control options
        ('force', 'f',
         "force installation (overwrite any existing files)"),
        ('skip-build', None,
         "skip rebuilding everything (for testing/debugging)"),

        # Where to install documentation (eventually!)
        #('doc-format=', None, "format of documentation to generate"),
        #('install-man=', None, "directory for Unix man pages"),
        #('install-html=', None, "directory for HTML documentation"),
        #('install-info=', None, "directory for GNU info files"),

        ('record=', None,
         "filename in which to record list of installed files"),

        ('install-layout=', None,
         "installation layout to choose (known values: deb, unix)"),
        ]

    boolean_options = ['compile', 'force', 'skip-build']

    if HAS_USER_SITE:
        user_options.append(('user', None,
                             "install in user site-package '%s'" % USER_SITE))
        boolean_options.append('user')

    negative_opt = {'no-compile' : 'compile'}


    def initialize_options(self):
        """Initializes options."""
        # High-level options: these select both an installation base
        # and scheme.
        self.prefix = None
        self.exec_prefix = None
        self.home = None
        self.user = 0
        self.prefix_option = None

        # These select only the installation base; it's up to the user to
        # specify the installation scheme (currently, that means supplying
        # the --install-{platlib,purelib,scripts,data} options).
        self.install_base = None
        self.install_platbase = None
        self.root = None

        # These options are the actual installation directories; if not
        # supplied by the user, they are filled in using the installation
        # scheme implied by prefix/exec-prefix/home and the contents of
        # that installation scheme.
        self.install_purelib = None     # for pure module distributions
        self.install_platlib = None     # non-pure (dists w/ extensions)
        self.install_headers = None     # for C/C++ headers
        self.install_lib = None         # set to either purelib or platlib
        self.install_scripts = None
        self.install_data = None
        if HAS_USER_SITE:
            self.install_userbase = USER_BASE
            self.install_usersite = USER_SITE

        # enable custom installation, known values: deb
        self.install_layout = None
        self.multiarch = None

        self.compile = None
        self.optimize = None

        # Deprecated
        # These two are for putting non-packagized distributions into their
        # own directory and creating a .pth file if it makes sense.
        # 'extra_path' comes from the setup file; 'install_path_file' can
        # be turned off if it makes no sense to install a .pth file.  (But
        # better to install it uselessly than to guess wrong and not
        # install it when it's necessary and would be used!)  Currently,
        # 'install_path_file' is always true unless some outsider meddles
        # with it.
        self.extra_path = None
        self.install_path_file = 1

        # 'force' forces installation, even if target files are not
        # out-of-date.  'skip_build' skips running the "build" command,
        # handy if you know it's not necessary.  'warn_dir' (which is *not*
        # a user option, it's just there so the bdist_* commands can turn
        # it off) determines whether we warn about installing to a
        # directory not in sys.path.
        self.force = 0
        self.skip_build = 0
        self.warn_dir = 1

        # These are only here as a conduit from the 'build' command to the
        # 'install_*' commands that do the real work.  ('build_base' isn't
        # actually used anywhere, but it might be useful in future.)  They
        # are not user options, because if the user told the install
        # command where the build directory is, that wouldn't affect the
        # build command.
        self.build_base = None
        self.build_lib = None

        # Not defined yet because we don't know anything about
        # documentation yet.
        #self.install_man = None
        #self.install_html = None
        #self.install_info = None

        self.record = None


    # -- Option finalizing methods -------------------------------------
    # (This is rather more involved than for most commands,
    # because this is where the policy for installing third-
    # party Python modules on various platforms given a wide
    # array of user input is decided.  Yes, it's quite complex!)

    def finalize_options(self):
        """Finalizes options."""
        # This method (and its helpers, like 'finalize_unix()',
        # 'finalize_other()', and 'select_scheme()') is where the default
        # installation directories for modules, extension modules, and
        # anything else we care to install from a Python module
        # distribution.  Thus, this code makes a pretty important policy
        # statement about how third-party stuff is added to a Python
        # installation!  Note that the actual work of installation is done
        # by the relatively simple 'install_*' commands; they just take
        # their orders from the installation directory options determined
        # here.

        # Check for errors/inconsistencies in the options; first, stuff
        # that's wrong on any platform.

        if ((self.prefix or self.exec_prefix or self.home) and
            (self.install_base or self.install_platbase)):
            raise DistutilsOptionError(
                   "must supply either prefix/exec-prefix/home or " +
                   "install-base/install-platbase -- not both")

        if self.home and (self.prefix or self.exec_prefix):
            raise DistutilsOptionError(
                  "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 DistutilsOptionError("can't combine user with prefix, "
                                       "exec_prefix/home, or install_(plat)base")

        # Next, stuff that's wrong (or dubious) only on certain platforms.
        if os.name != "posix":
            if self.exec_prefix:
                self.warn("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!

        self.dump_dirs("pre-finalize_{unix,other}")

        if os.name == 'posix':
            self.finalize_unix()
        else:
            self.finalize_other()

        self.dump_dirs("post-finalize_{unix,other}()")

        # Expand configuration variables, tilde, etc. in self.install_base
        # and self.install_platbase -- that way, we can use $base or
        # $platbase in the other installation directories and not worry
        # about needing recursive variable expansion (shudder).

        py_version = sys.version.split()[0]
        (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
        try:
            abiflags = sys.abiflags
        except AttributeError:
            # sys.abiflags may not be defined on all platforms.
            abiflags = ''
        self.config_vars = {'dist_name': self.distribution.get_name(),
                            'dist_version': self.distribution.get_version(),
                            'dist_fullname': self.distribution.get_fullname(),
                            'py_version': py_version,
                            'py_version_short': '%d.%d' % sys.version_info[:2],
                            'py_version_nodot': '%d%d' % sys.version_info[:2],
                            'sys_prefix': prefix,
                            'prefix': prefix,
                            'sys_exec_prefix': exec_prefix,
                            'exec_prefix': exec_prefix,
                            'abiflags': abiflags,
                            'platlibdir': sys.platlibdir,
                           }

        if HAS_USER_SITE:
            self.config_vars['userbase'] = self.install_userbase
            self.config_vars['usersite'] = self.install_usersite

        if sysconfig.is_python_build(True):
            self.config_vars['srcdir'] = sysconfig.get_config_var('srcdir')

        self.expand_basedirs()

        self.dump_dirs("post-expand_basedirs()")

        # Now define config vars for the base directories so we can expand
        # everything else.
        self.config_vars['base'] = self.install_base
        self.config_vars['platbase'] = self.install_platbase

        if DEBUG:
            from pprint import pprint
            print("config vars:")
            pprint(self.config_vars)

        # Expand "~" and configuration variables in the installation
        # directories.
        self.expand_dirs()

        self.dump_dirs("post-expand_dirs()")

        # Create directories in the home dir:
        if self.user:
            self.create_home_path()

        # Pick the actual directory to install all modules to: either
        # install_purelib or install_platlib, depending on whether this
        # module distribution is pure or not.  Of course, if the user
        # already specified install_lib, use their selection.
        if self.install_lib is None:
            if self.distribution.ext_modules: # has extensions: non-pure
                self.install_lib = self.install_platlib
            else:
                self.install_lib = self.install_purelib


        # Convert directories from Unix /-separated syntax to the local
        # convention.
        self.convert_paths('lib', 'purelib', 'platlib',
                           'scripts', 'data', 'headers')
        if HAS_USER_SITE:
            self.convert_paths('userbase', 'usersite')

        # Deprecated
        # Well, we're not actually fully completely finalized yet: we still
        # have to deal with 'extra_path', which is the hack for allowing
        # non-packagized module distributions (hello, Numerical Python!) to
        # get their own directories.
        self.handle_extra_path()
        self.install_libbase = self.install_lib # needed for .pth file
        self.install_lib = os.path.join(self.install_lib, self.extra_dirs)

        # If a new root directory was supplied, make all the installation
        # dirs relative to it.
        if self.root is not None:
            self.change_roots('libbase', 'lib', 'purelib', 'platlib',
                              'scripts', 'data', 'headers')

        self.dump_dirs("after prepending root")

        # Find out the build directories, ie. where to install from.
        self.set_undefined_options('build',
                                   ('build_base', 'build_base'),
                                   ('build_lib', 'build_lib'))

        # Punt on doc directories for now -- after all, we're punting on
        # documentation completely!

    def dump_dirs(self, msg):
        """Dumps the list of user options."""
        if not DEBUG:
            return
        from distutils.fancy_getopt import longopt_xlate
        log.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.translate(longopt_xlate)
                val = not getattr(self, opt_name)
            else:
                opt_name = opt_name.translate(longopt_xlate)
                val = getattr(self, opt_name)
            log.debug("  %s: %s", opt_name, val)

    def finalize_unix(self):
        """Finalizes options for posix platforms."""
        if self.install_base is not None or self.install_platbase is not None:
            if ((self.install_lib is None and
                 self.install_purelib is None and
                 self.install_platlib is None) or
                self.install_headers is None or
                self.install_scripts is None or
                self.install_data is None):
                raise DistutilsOptionError(
                      "install-base or install-platbase supplied, but "
                      "installation scheme is incomplete")
            return

        if self.user:
            if self.install_userbase is None:
                raise DistutilsPlatformError(
                    "User base directory is not specified")
            self.install_base = self.install_platbase = self.install_userbase
            self.select_scheme("unix_user")
        elif self.home is not None:
            self.install_base = self.install_platbase = self.home
            self.select_scheme("unix_home")
        else:
            self.prefix_option = self.prefix
            if self.prefix is None:
                if self.exec_prefix is not None:
                    raise DistutilsOptionError(
                          "must not supply exec-prefix without prefix")

                self.prefix = os.path.normpath(sys.prefix)
                self.exec_prefix = os.path.normpath(sys.exec_prefix)

            else:
                if self.exec_prefix is None:
                    self.exec_prefix = self.prefix

            self.install_base = self.prefix
            self.install_platbase = self.exec_prefix
            if self.install_layout:
                if self.install_layout.lower() in ['deb']:
                    import sysconfig
                    self.multiarch = sysconfig.get_config_var('MULTIARCH')
                    self.select_scheme("deb_system")
                elif self.install_layout.lower() in ['unix']:
                    self.select_scheme("unix_prefix")
                else:
                    raise DistutilsOptionError(
                        "unknown value for --install-layout")
            elif ((self.prefix_option and
                   os.path.normpath(self.prefix) != '/usr/local')
                  or is_virtual_environment()):
                self.select_scheme("unix_prefix")
            else:
                if os.path.normpath(self.prefix) == '/usr/local':
                    self.prefix = self.exec_prefix = '/usr'
                    self.install_base = self.install_platbase = '/usr'
                self.select_scheme("unix_local")

    def finalize_other(self):
        """Finalizes options for non-posix platforms"""
        if self.user:
            if self.install_userbase is None:
                raise DistutilsPlatformError(
                    "User base directory is not specified")
            self.install_base = self.install_platbase = self.install_userbase
            self.select_scheme(os.name + "_user")
        elif self.home is not None:
            self.install_base = self.install_platbase = self.home
            self.select_scheme("unix_home")
        else:
            if self.prefix is None:
                self.prefix = os.path.normpath(sys.prefix)

            self.install_base = self.install_platbase = self.prefix
            try:
                self.select_scheme(os.name)
            except KeyError:
                raise DistutilsPlatformError(
                      "I don't know how to install stuff on '%s'" % os.name)

    def select_scheme(self, name):
        """Sets the install directories by applying the install schemes."""
        # it's the caller's problem if they supply a bad name!
        scheme = INSTALL_SCHEMES[name]
        for key in SCHEME_KEYS:
            attrname = 'install_' + key
            if getattr(self, attrname) is None:
                setattr(self, attrname, scheme[key])

    def _expand_attrs(self, attrs):
        for attr in attrs:
            val = getattr(self, attr)
            if val is not None:
                if os.name == 'posix' or os.name == 'nt':
                    val = os.path.expanduser(val)
                val = subst_vars(val, self.config_vars)
                setattr(self, attr, val)

    def expand_basedirs(self):
        """Calls `os.path.expanduser` on install_base, install_platbase and
        root."""
        self._expand_attrs(['install_base', 'install_platbase', 'root'])

    def expand_dirs(self):
        """Calls `os.path.expanduser` on install dirs."""
        self._expand_attrs(['install_purelib', 'install_platlib',
                            'install_lib', 'install_headers',
                            'install_scripts', 'install_data',])

    def convert_paths(self, *names):
        """Call `convert_path` over `names`."""
        for name in names:
            attr = "install_" + name
            setattr(self, attr, convert_path(getattr(self, attr)))

    def handle_extra_path(self):
        """Set `path_file` and `extra_dirs` using `extra_path`."""
        if self.extra_path is None:
            self.extra_path = self.distribution.extra_path

        if self.extra_path is not None:
            log.warn(
                "Distribution option extra_path is deprecated. "
                "See issue27919 for details."
            )
            if isinstance(self.extra_path, str):
                self.extra_path = self.extra_path.split(',')

            if len(self.extra_path) == 1:
                path_file = extra_dirs = self.extra_path[0]
            elif len(self.extra_path) == 2:
                path_file, extra_dirs = self.extra_path
            else:
                raise DistutilsOptionError(
                      "'extra_path' option must be a list, tuple, or "
                      "comma-separated string with 1 or 2 elements")

            # convert to local form in case Unix notation used (as it
            # should be in setup scripts)
            extra_dirs = convert_path(extra_dirs)
        else:
            path_file = None
            extra_dirs = ''

        # XXX should we warn if path_file and not extra_dirs? (in which
        # case the path file would be harmless but pointless)
        self.path_file = path_file
        self.extra_dirs = extra_dirs

    def change_roots(self, *names):
        """Change the install directories pointed by name using root."""
        for name in names:
            attr = "install_" + name
            setattr(self, attr, change_root(self.root, getattr(self, attr)))

    def create_home_path(self):
        """Create directories under ~."""
        if not self.user:
            return
        home = convert_path(os.path.expanduser("~"))
        for name, path in self.config_vars.items():
            if path.startswith(home) and not os.path.isdir(path):
                self.debug_print("os.makedirs('%s', 0o700)" % path)
                os.makedirs(path, 0o700)

    # -- Command execution methods -------------------------------------

    def run(self):
        """Runs the command."""
        # Obviously have to build before we can install
        if not self.skip_build:
            self.run_command('build')
            # If we built for any other platform, we can't install.
            build_plat = self.distribution.get_command_obj('build').plat_name
            # check warn_dir - it is a clue that the 'install' is happening
            # internally, and not to sys.path, so we don't check the platform
            # matches what we are running.
            if self.warn_dir and build_plat != get_platform():
                raise DistutilsPlatformError("Can't install when "
                                             "cross-compiling")

        # Run all sub-commands (at least those that need to be run)
        for cmd_name in self.get_sub_commands():
            self.run_command(cmd_name)

        if self.path_file:
            self.create_path_file()

        # write list of installed files, if requested.
        if self.record:
            outputs = self.get_outputs()
            if self.root:               # strip any package prefix
                root_len = len(self.root)
                for counter in range(len(outputs)):
                    outputs[counter] = outputs[counter][root_len:]
            self.execute(write_file,
                         (self.record, outputs),
                         "writing list of installed files to '%s'" %
                         self.record)

        sys_path = map(os.path.normpath, sys.path)
        sys_path = map(os.path.normcase, sys_path)
        install_lib = os.path.normcase(os.path.normpath(self.install_lib))
        if (self.warn_dir and
            not (self.path_file and self.install_path_file) and
            install_lib not in sys_path):
            log.debug(("modules installed to '%s', which is not in "
                       "Python's module search path (sys.path) -- "
                       "you'll have to change the search path yourself"),
                       self.install_lib)

    def create_path_file(self):
        """Creates the .pth file"""
        filename = os.path.join(self.install_libbase,
                                self.path_file + ".pth")
        if self.install_path_file:
            self.execute(write_file,
                         (filename, [self.extra_dirs]),
                         "creating %s" % filename)
        else:
            self.warn("path file '%s' not created" % filename)


    # -- Reporting methods ---------------------------------------------

    def get_outputs(self):
        """Assembles the outputs of all the sub-commands."""
        outputs = []
        for cmd_name in self.get_sub_commands():
            cmd = self.get_finalized_command(cmd_name)
            # Add the contents of cmd.get_outputs(), ensuring
            # that outputs doesn't contain duplicate entries
            for filename in cmd.get_outputs():
                if filename not in outputs:
                    outputs.append(filename)

        if self.path_file and self.install_path_file:
            outputs.append(os.path.join(self.install_libbase,
                                        self.path_file + ".pth"))

        return outputs

    def get_inputs(self):
        """Returns the inputs of all the sub-commands"""
        # XXX gee, this looks familiar ;-(
        inputs = []
        for cmd_name in self.get_sub_commands():
            cmd = self.get_finalized_command(cmd_name)
            inputs.extend(cmd.get_inputs())

        return inputs

    # -- Predicates for sub-command list -------------------------------

    def has_lib(self):
        """Returns true if the current distribution has any Python
        modules to install."""
        return (self.distribution.has_pure_modules() or
                self.distribution.has_ext_modules())

    def has_headers(self):
        """Returns true if the current distribution has any headers to
        install."""
        return self.distribution.has_headers()

    def has_scripts(self):
        """Returns true if the current distribution has any scripts to.
        install."""
        return self.distribution.has_scripts()

    def has_data(self):
        """Returns true if the current distribution has any data to.
        install."""
        return self.distribution.has_data_files()

    # 'sub_commands': a list of commands this command might have to run to
    # get its work done.  See cmd.py for more info.
    sub_commands = [('install_lib',     has_lib),
                    ('install_headers', has_headers),
                    ('install_scripts', has_scripts),
                    ('install_data',    has_data),
                    ('install_egg_info', lambda self:True),
                   ]
PK       ! d]!T  !T    bdist_rpm.pynu [        """distutils.command.bdist_rpm

Implements the Distutils 'bdist_rpm' command (create RPM source and binary
distributions)."""

import subprocess, sys, os
from distutils.core import Command
from distutils.debug import DEBUG
from distutils.file_util import write_file
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log

class bdist_rpm(Command):

    description = "create an RPM distribution"

    user_options = [
        ('bdist-base=', None,
         "base directory for creating built distributions"),
        ('rpm-base=', None,
         "base directory for creating RPMs (defaults to \"rpm\" under "
         "--bdist-base; must be specified for RPM 2)"),
        ('dist-dir=', 'd',
         "directory to put final RPM files in "
         "(and .spec files if --spec-only)"),
        ('python=', None,
         "path to Python interpreter to hard-code in the .spec file "
         "(default: \"python\")"),
        ('fix-python', None,
         "hard-code the exact path to the current Python interpreter in "
         "the .spec file"),
        ('spec-only', None,
         "only regenerate spec file"),
        ('source-only', None,
         "only generate source RPM"),
        ('binary-only', None,
         "only generate binary RPM"),
        ('use-bzip2', None,
         "use bzip2 instead of gzip to create source distribution"),

        # More meta-data: too RPM-specific to put in the setup script,
        # but needs to go in the .spec file -- so we make these options
        # to "bdist_rpm".  The idea is that packagers would put this
        # info in setup.cfg, although they are of course free to
        # supply it on the command line.
        ('distribution-name=', None,
         "name of the (Linux) distribution to which this "
         "RPM applies (*not* the name of the module distribution!)"),
        ('group=', None,
         "package classification [default: \"Development/Libraries\"]"),
        ('release=', None,
         "RPM release number"),
        ('serial=', None,
         "RPM serial number"),
        ('vendor=', None,
         "RPM \"vendor\" (eg. \"Joe Blow <joe@example.com>\") "
         "[default: maintainer or author from setup script]"),
        ('packager=', None,
         "RPM packager (eg. \"Jane Doe <jane@example.net>\") "
         "[default: vendor]"),
        ('doc-files=', None,
         "list of documentation files (space or comma-separated)"),
        ('changelog=', None,
         "RPM changelog"),
        ('icon=', None,
         "name of icon file"),
        ('provides=', None,
         "capabilities provided by this package"),
        ('requires=', None,
         "capabilities required by this package"),
        ('conflicts=', None,
         "capabilities which conflict with this package"),
        ('build-requires=', None,
         "capabilities required to build this package"),
        ('obsoletes=', None,
         "capabilities made obsolete by this package"),
        ('no-autoreq', None,
         "do not automatically calculate dependencies"),

        # Actions to take when building RPM
        ('keep-temp', 'k',
         "don't clean up RPM build directory"),
        ('no-keep-temp', None,
         "clean up RPM build directory [default]"),
        ('use-rpm-opt-flags', None,
         "compile with RPM_OPT_FLAGS when building from source RPM"),
        ('no-rpm-opt-flags', None,
         "do not pass any RPM CFLAGS to compiler"),
        ('rpm3-mode', None,
         "RPM 3 compatibility mode (default)"),
        ('rpm2-mode', None,
         "RPM 2 compatibility mode"),

        # Add the hooks necessary for specifying custom scripts
        ('prep-script=', None,
         "Specify a script for the PREP phase of RPM building"),
        ('build-script=', None,
         "Specify a script for the BUILD phase of RPM building"),

        ('pre-install=', None,
         "Specify a script for the pre-INSTALL phase of RPM building"),
        ('install-script=', None,
         "Specify a script for the INSTALL phase of RPM building"),
        ('post-install=', None,
         "Specify a script for the post-INSTALL phase of RPM building"),

        ('pre-uninstall=', None,
         "Specify a script for the pre-UNINSTALL phase of RPM building"),
        ('post-uninstall=', None,
         "Specify a script for the post-UNINSTALL phase of RPM building"),

        ('clean-script=', None,
         "Specify a script for the CLEAN phase of RPM building"),

        ('verify-script=', None,
         "Specify a script for the VERIFY phase of the RPM build"),

        # Allow a packager to explicitly force an architecture
        ('force-arch=', None,
         "Force an architecture onto the RPM build process"),

        ('quiet', 'q',
         "Run the INSTALL phase of RPM building in quiet mode"),
        ]

    boolean_options = ['keep-temp', 'use-rpm-opt-flags', 'rpm3-mode',
                       'no-autoreq', 'quiet']

    negative_opt = {'no-keep-temp': 'keep-temp',
                    'no-rpm-opt-flags': 'use-rpm-opt-flags',
                    'rpm2-mode': 'rpm3-mode'}


    def initialize_options(self):
        self.bdist_base = None
        self.rpm_base = None
        self.dist_dir = None
        self.python = None
        self.fix_python = None
        self.spec_only = None
        self.binary_only = None
        self.source_only = None
        self.use_bzip2 = None

        self.distribution_name = None
        self.group = None
        self.release = None
        self.serial = None
        self.vendor = None
        self.packager = None
        self.doc_files = None
        self.changelog = None
        self.icon = None

        self.prep_script = None
        self.build_script = None
        self.install_script = None
        self.clean_script = None
        self.verify_script = None
        self.pre_install = None
        self.post_install = None
        self.pre_uninstall = None
        self.post_uninstall = None
        self.prep = None
        self.provides = None
        self.requires = None
        self.conflicts = None
        self.build_requires = None
        self.obsoletes = None

        self.keep_temp = 0
        self.use_rpm_opt_flags = 1
        self.rpm3_mode = 1
        self.no_autoreq = 0

        self.force_arch = None
        self.quiet = 0

    def finalize_options(self):
        self.set_undefined_options('bdist', ('bdist_base', 'bdist_base'))
        if self.rpm_base is None:
            if not self.rpm3_mode:
                raise DistutilsOptionError(
                      "you must specify --rpm-base in RPM 2 mode")
            self.rpm_base = os.path.join(self.bdist_base, "rpm")

        if self.python is None:
            if self.fix_python:
                self.python = sys.executable
            else:
                self.python = "python3"
        elif self.fix_python:
            raise DistutilsOptionError(
                  "--python and --fix-python are mutually exclusive options")

        if os.name != 'posix':
            raise DistutilsPlatformError("don't know how to create RPM "
                   "distributions on platform %s" % os.name)
        if self.binary_only and self.source_only:
            raise DistutilsOptionError(
                  "cannot supply both '--source-only' and '--binary-only'")

        # don't pass CFLAGS to pure python distributions
        if not self.distribution.has_ext_modules():
            self.use_rpm_opt_flags = 0

        self.set_undefined_options('bdist', ('dist_dir', 'dist_dir'))
        self.finalize_package_data()

    def finalize_package_data(self):
        self.ensure_string('group', "Development/Libraries")
        self.ensure_string('vendor',
                           "%s <%s>" % (self.distribution.get_contact(),
                                        self.distribution.get_contact_email()))
        self.ensure_string('packager')
        self.ensure_string_list('doc_files')
        if isinstance(self.doc_files, list):
            for readme in ('README', 'README.txt'):
                if os.path.exists(readme) and readme not in self.doc_files:
                    self.doc_files.append(readme)

        self.ensure_string('release', "1")
        self.ensure_string('serial')   # should it be an int?

        self.ensure_string('distribution_name')

        self.ensure_string('changelog')
          # Format changelog correctly
        self.changelog = self._format_changelog(self.changelog)

        self.ensure_filename('icon')

        self.ensure_filename('prep_script')
        self.ensure_filename('build_script')
        self.ensure_filename('install_script')
        self.ensure_filename('clean_script')
        self.ensure_filename('verify_script')
        self.ensure_filename('pre_install')
        self.ensure_filename('post_install')
        self.ensure_filename('pre_uninstall')
        self.ensure_filename('post_uninstall')

        # XXX don't forget we punted on summaries and descriptions -- they
        # should be handled here eventually!

        # Now *this* is some meta-data that belongs in the setup script...
        self.ensure_string_list('provides')
        self.ensure_string_list('requires')
        self.ensure_string_list('conflicts')
        self.ensure_string_list('build_requires')
        self.ensure_string_list('obsoletes')

        self.ensure_string('force_arch')

    def run(self):
        if DEBUG:
            print("before _get_package_data():")
            print("vendor =", self.vendor)
            print("packager =", self.packager)
            print("doc_files =", self.doc_files)
            print("changelog =", self.changelog)

        # make directories
        if self.spec_only:
            spec_dir = self.dist_dir
            self.mkpath(spec_dir)
        else:
            rpm_dir = {}
            for d in ('SOURCES', 'SPECS', 'BUILD', 'RPMS', 'SRPMS'):
                rpm_dir[d] = os.path.join(self.rpm_base, d)
                self.mkpath(rpm_dir[d])
            spec_dir = rpm_dir['SPECS']

        # Spec file goes into 'dist_dir' if '--spec-only specified',
        # build/rpm.<plat> otherwise.
        spec_path = os.path.join(spec_dir,
                                 "%s.spec" % self.distribution.get_name())
        self.execute(write_file,
                     (spec_path,
                      self._make_spec_file()),
                     "writing '%s'" % spec_path)

        if self.spec_only: # stop if requested
            return

        # Make a source distribution and copy to SOURCES directory with
        # optional icon.
        saved_dist_files = self.distribution.dist_files[:]
        sdist = self.reinitialize_command('sdist')
        if self.use_bzip2:
            sdist.formats = ['bztar']
        else:
            sdist.formats = ['gztar']
        self.run_command('sdist')
        self.distribution.dist_files = saved_dist_files

        source = sdist.get_archive_files()[0]
        source_dir = rpm_dir['SOURCES']
        self.copy_file(source, source_dir)

        if self.icon:
            if os.path.exists(self.icon):
                self.copy_file(self.icon, source_dir)
            else:
                raise DistutilsFileError(
                      "icon file '%s' does not exist" % self.icon)

        # build package
        log.info("building RPMs")
        rpm_cmd = ['rpmbuild']

        if self.source_only: # what kind of RPMs?
            rpm_cmd.append('-bs')
        elif self.binary_only:
            rpm_cmd.append('-bb')
        else:
            rpm_cmd.append('-ba')
        rpm_cmd.extend(['--define', '__python %s' % self.python])
        if self.rpm3_mode:
            rpm_cmd.extend(['--define',
                             '_topdir %s' % os.path.abspath(self.rpm_base)])
        if not self.keep_temp:
            rpm_cmd.append('--clean')

        if self.quiet:
            rpm_cmd.append('--quiet')

        rpm_cmd.append(spec_path)
        # Determine the binary rpm names that should be built out of this spec
        # file
        # Note that some of these may not be really built (if the file
        # list is empty)
        nvr_string = "%{name}-%{version}-%{release}"
        src_rpm = nvr_string + ".src.rpm"
        non_src_rpm = "%{arch}/" + nvr_string + ".%{arch}.rpm"
        q_cmd = r"rpm -q --qf '%s %s\n' --specfile '%s'" % (
            src_rpm, non_src_rpm, spec_path)

        out = os.popen(q_cmd)
        try:
            binary_rpms = []
            source_rpm = None
            while True:
                line = out.readline()
                if not line:
                    break
                l = line.strip().split()
                assert(len(l) == 2)
                binary_rpms.append(l[1])
                # The source rpm is named after the first entry in the spec file
                if source_rpm is None:
                    source_rpm = l[0]

            status = out.close()
            if status:
                raise DistutilsExecError("Failed to execute: %s" % repr(q_cmd))

        finally:
            out.close()

        self.spawn(rpm_cmd)

        if not self.dry_run:
            if self.distribution.has_ext_modules():
                pyversion = get_python_version()
            else:
                pyversion = 'any'

            if not self.binary_only:
                srpm = os.path.join(rpm_dir['SRPMS'], source_rpm)
                assert(os.path.exists(srpm))
                self.move_file(srpm, self.dist_dir)
                filename = os.path.join(self.dist_dir, source_rpm)
                self.distribution.dist_files.append(
                    ('bdist_rpm', pyversion, filename))

            if not self.source_only:
                for rpm in binary_rpms:
                    rpm = os.path.join(rpm_dir['RPMS'], rpm)
                    if os.path.exists(rpm):
                        self.move_file(rpm, self.dist_dir)
                        filename = os.path.join(self.dist_dir,
                                                os.path.basename(rpm))
                        self.distribution.dist_files.append(
                            ('bdist_rpm', pyversion, filename))

    def _dist_path(self, path):
        return os.path.join(self.dist_dir, os.path.basename(path))

    def _make_spec_file(self):
        """Generate the text of an RPM spec file and return it as a
        list of strings (one per line).
        """
        # definitions and headers
        spec_file = [
            '%define name ' + self.distribution.get_name(),
            '%define version ' + self.distribution.get_version().replace('-','_'),
            '%define unmangled_version ' + self.distribution.get_version(),
            '%define release ' + self.release.replace('-','_'),
            '',
            'Summary: ' + self.distribution.get_description(),
            ]

        # Workaround for #14443 which affects some RPM based systems such as
        # RHEL6 (and probably derivatives)
        vendor_hook = subprocess.getoutput('rpm --eval %{__os_install_post}')
        # Generate a potential replacement value for __os_install_post (whilst
        # normalizing the whitespace to simplify the test for whether the
        # invocation of brp-python-bytecompile passes in __python):
        vendor_hook = '\n'.join(['  %s \\' % line.strip()
                                 for line in vendor_hook.splitlines()])
        problem = "brp-python-bytecompile \\\n"
        fixed = "brp-python-bytecompile %{__python} \\\n"
        fixed_hook = vendor_hook.replace(problem, fixed)
        if fixed_hook != vendor_hook:
            spec_file.append('# Workaround for http://bugs.python.org/issue14443')
            spec_file.append('%define __os_install_post ' + fixed_hook + '\n')

        # put locale summaries into spec file
        # XXX not supported for now (hard to put a dictionary
        # in a config file -- arg!)
        #for locale in self.summaries.keys():
        #    spec_file.append('Summary(%s): %s' % (locale,
        #                                          self.summaries[locale]))

        spec_file.extend([
            'Name: %{name}',
            'Version: %{version}',
            'Release: %{release}',])

        # XXX yuck! this filename is available from the "sdist" command,
        # but only after it has run: and we create the spec file before
        # running "sdist", in case of --spec-only.
        if self.use_bzip2:
            spec_file.append('Source0: %{name}-%{unmangled_version}.tar.bz2')
        else:
            spec_file.append('Source0: %{name}-%{unmangled_version}.tar.gz')

        spec_file.extend([
            'License: ' + self.distribution.get_license(),
            'Group: ' + self.group,
            'BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot',
            'Prefix: %{_prefix}', ])

        if not self.force_arch:
            # noarch if no extension modules
            if not self.distribution.has_ext_modules():
                spec_file.append('BuildArch: noarch')
        else:
            spec_file.append( 'BuildArch: %s' % self.force_arch )

        for field in ('Vendor',
                      'Packager',
                      'Provides',
                      'Requires',
                      'Conflicts',
                      'Obsoletes',
                      ):
            val = getattr(self, field.lower())
            if isinstance(val, list):
                spec_file.append('%s: %s' % (field, ' '.join(val)))
            elif val is not None:
                spec_file.append('%s: %s' % (field, val))


        if self.distribution.get_url() != 'UNKNOWN':
            spec_file.append('Url: ' + self.distribution.get_url())

        if self.distribution_name:
            spec_file.append('Distribution: ' + self.distribution_name)

        if self.build_requires:
            spec_file.append('BuildRequires: ' +
                             ' '.join(self.build_requires))

        if self.icon:
            spec_file.append('Icon: ' + os.path.basename(self.icon))

        if self.no_autoreq:
            spec_file.append('AutoReq: 0')

        spec_file.extend([
            '',
            '%description',
            self.distribution.get_long_description()
            ])

        # put locale descriptions into spec file
        # XXX again, suppressed because config file syntax doesn't
        # easily support this ;-(
        #for locale in self.descriptions.keys():
        #    spec_file.extend([
        #        '',
        #        '%description -l ' + locale,
        #        self.descriptions[locale],
        #        ])

        # rpm scripts
        # figure out default build script
        def_setup_call = "%s %s" % (self.python,os.path.basename(sys.argv[0]))
        def_build = "%s build" % def_setup_call
        if self.use_rpm_opt_flags:
            def_build = 'env CFLAGS="$RPM_OPT_FLAGS" ' + def_build

        # insert contents of files

        # XXX this is kind of misleading: user-supplied options are files
        # that we open and interpolate into the spec file, but the defaults
        # are just text that we drop in as-is.  Hmmm.

        install_cmd = ('%s install -O1 --root=$RPM_BUILD_ROOT '
                       '--record=INSTALLED_FILES') % def_setup_call

        script_options = [
            ('prep', 'prep_script', "%setup -n %{name}-%{unmangled_version}"),
            ('build', 'build_script', def_build),
            ('install', 'install_script', install_cmd),
            ('clean', 'clean_script', "rm -rf $RPM_BUILD_ROOT"),
            ('verifyscript', 'verify_script', None),
            ('pre', 'pre_install', None),
            ('post', 'post_install', None),
            ('preun', 'pre_uninstall', None),
            ('postun', 'post_uninstall', None),
        ]

        for (rpm_opt, attr, default) in script_options:
            # Insert contents of file referred to, if no file is referred to
            # use 'default' as contents of script
            val = getattr(self, attr)
            if val or default:
                spec_file.extend([
                    '',
                    '%' + rpm_opt,])
                if val:
                    with open(val) as f:
                        spec_file.extend(f.read().split('\n'))
                else:
                    spec_file.append(default)


        # files section
        spec_file.extend([
            '',
            '%files -f INSTALLED_FILES',
            '%defattr(-,root,root)',
            ])

        if self.doc_files:
            spec_file.append('%doc ' + ' '.join(self.doc_files))

        if self.changelog:
            spec_file.extend([
                '',
                '%changelog',])
            spec_file.extend(self.changelog)

        return spec_file

    def _format_changelog(self, changelog):
        """Format the changelog correctly and convert it to a list of strings
        """
        if not changelog:
            return changelog
        new_changelog = []
        for line in changelog.strip().split('\n'):
            line = line.strip()
            if line[0] == '*':
                new_changelog.extend(['', line])
            elif line[0] == '-':
                new_changelog.append(line)
            else:
                new_changelog.append('  ' + line)

        # strip trailing newline inserted by first changelog entry
        if not new_changelog[0]:
            del new_changelog[0]

        return new_changelog
PK       ! *Rj&      install_headers.pynu [        """distutils.command.install_headers

Implements the Distutils 'install_headers' command, to install C/C++ header
files to the Python include directory."""

from distutils.core import Command


# XXX force is never used
class install_headers(Command):

    description = "install C/C++ header files"

    user_options = [('install-dir=', 'd',
                     "directory to install header files to"),
                    ('force', 'f',
                     "force installation (overwrite existing files)"),
                   ]

    boolean_options = ['force']

    def initialize_options(self):
        self.install_dir = None
        self.force = 0
        self.outfiles = []

    def finalize_options(self):
        self.set_undefined_options('install',
                                   ('install_headers', 'install_dir'),
                                   ('force', 'force'))


    def run(self):
        headers = self.distribution.headers
        if not headers:
            return

        self.mkpath(self.install_dir)
        for header in headers:
            (out, _) = self.copy_file(header, self.install_dir)
            self.outfiles.append(out)

    def get_inputs(self):
        return self.distribution.headers or []

    def get_outputs(self):
        return self.outfiles
PK       ! 39  9    bdist.pynu [        """distutils.command.bdist

Implements the Distutils 'bdist' command (create a built [binary]
distribution)."""

import os
from distutils.core import Command
from distutils.errors import *
from distutils.util import get_platform


def show_formats():
    """Print list of available formats (arguments to "--format" option).
    """
    from distutils.fancy_getopt import FancyGetopt
    formats = []
    for format in bdist.format_commands:
        formats.append(("formats=" + format, None,
                        bdist.format_command[format][1]))
    pretty_printer = FancyGetopt(formats)
    pretty_printer.print_help("List of available distribution formats:")


class bdist(Command):

    description = "create a built (binary) distribution"

    user_options = [('bdist-base=', 'b',
                     "temporary directory for creating built distributions"),
                    ('plat-name=', 'p',
                     "platform name to embed in generated filenames "
                     "(default: %s)" % get_platform()),
                    ('formats=', None,
                     "formats for distribution (comma-separated list)"),
                    ('dist-dir=', 'd',
                     "directory to put final built distributions in "
                     "[default: dist]"),
                    ('skip-build', None,
                     "skip rebuilding everything (for testing/debugging)"),
                    ('owner=', 'u',
                     "Owner name used when creating a tar file"
                     " [default: current user]"),
                    ('group=', 'g',
                     "Group name used when creating a tar file"
                     " [default: current group]"),
                   ]

    boolean_options = ['skip-build']

    help_options = [
        ('help-formats', None,
         "lists available distribution formats", show_formats),
        ]

    # The following commands do not take a format option from bdist
    no_format_option = ('bdist_rpm',)

    # This won't do in reality: will need to distinguish RPM-ish Linux,
    # Debian-ish Linux, Solaris, FreeBSD, ..., Windows, Mac OS.
    default_format = {'posix': 'gztar',
                      'nt': 'zip'}

    # Establish the preferred order (for the --help-formats option).
    format_commands = ['rpm', 'gztar', 'bztar', 'xztar', 'ztar', 'tar',
                       'zip', 'msi']

    # And the real information.
    format_command = {'rpm':   ('bdist_rpm',  "RPM distribution"),
                      'gztar': ('bdist_dumb', "gzip'ed tar file"),
                      'bztar': ('bdist_dumb', "bzip2'ed tar file"),
                      'xztar': ('bdist_dumb', "xz'ed tar file"),
                      'ztar':  ('bdist_dumb', "compressed tar file"),
                      'tar':   ('bdist_dumb', "tar file"),
                      'zip':   ('bdist_dumb', "ZIP file"),
                      'msi':   ('bdist_msi',  "Microsoft Installer")
                      }


    def initialize_options(self):
        self.bdist_base = None
        self.plat_name = None
        self.formats = None
        self.dist_dir = None
        self.skip_build = 0
        self.group = None
        self.owner = None

    def finalize_options(self):
        # have to finalize 'plat_name' before 'bdist_base'
        if self.plat_name is None:
            if self.skip_build:
                self.plat_name = get_platform()
            else:
                self.plat_name = self.get_finalized_command('build').plat_name

        # 'bdist_base' -- parent of per-built-distribution-format
        # temporary directories (eg. we'll probably have
        # "build/bdist.<plat>/dumb", "build/bdist.<plat>/rpm", etc.)
        if self.bdist_base is None:
            build_base = self.get_finalized_command('build').build_base
            self.bdist_base = os.path.join(build_base,
                                           'bdist.' + self.plat_name)

        self.ensure_string_list('formats')
        if self.formats is None:
            try:
                self.formats = [self.default_format[os.name]]
            except KeyError:
                raise DistutilsPlatformError(
                      "don't know how to create built distributions "
                      "on platform %s" % os.name)

        if self.dist_dir is None:
            self.dist_dir = "dist"

    def run(self):
        # Figure out which sub-commands we need to run.
        commands = []
        for format in self.formats:
            try:
                commands.append(self.format_command[format][0])
            except KeyError:
                raise DistutilsOptionError("invalid format '%s'" % format)

        # Reinitialize and run each command.
        for i in range(len(self.formats)):
            cmd_name = commands[i]
            sub_cmd = self.reinitialize_command(cmd_name)
            if cmd_name not in self.no_format_option:
                sub_cmd.format = self.formats[i]

            # passing the owner and group names for tar archiving
            if cmd_name == 'bdist_dumb':
                sub_cmd.owner = self.owner
                sub_cmd.group = self.group

            # If we're going to need to run this command again, tell it to
            # keep its temporary files around so subsequent runs go faster.
            if cmd_name in commands[i+1:]:
                sub_cmd.keep_temp = 1
            self.run_command(cmd_name)
PK       !       check.pynu [        """distutils.command.check

Implements the Distutils 'check' command.
"""
from distutils.core import Command
from distutils.errors import DistutilsSetupError

try:
    # docutils is installed
    from docutils.utils import Reporter
    from docutils.parsers.rst import Parser
    from docutils import frontend
    from docutils import nodes

    class SilentReporter(Reporter):

        def __init__(self, source, report_level, halt_level, stream=None,
                     debug=0, encoding='ascii', error_handler='replace'):
            self.messages = []
            Reporter.__init__(self, source, report_level, halt_level, stream,
                              debug, encoding, error_handler)

        def system_message(self, level, message, *children, **kwargs):
            self.messages.append((level, message, children, kwargs))
            return nodes.system_message(message, level=level,
                                        type=self.levels[level],
                                        *children, **kwargs)

    HAS_DOCUTILS = True
except Exception:
    # Catch all exceptions because exceptions besides ImportError probably
    # indicate that docutils is not ported to Py3k.
    HAS_DOCUTILS = False

class check(Command):
    """This command checks the meta-data of the package.
    """
    description = ("perform some checks on the package")
    user_options = [('metadata', 'm', 'Verify meta-data'),
                    ('restructuredtext', 'r',
                     ('Checks if long string meta-data syntax '
                      'are reStructuredText-compliant')),
                    ('strict', 's',
                     'Will exit with an error if a check fails')]

    boolean_options = ['metadata', 'restructuredtext', 'strict']

    def initialize_options(self):
        """Sets default values for options."""
        self.restructuredtext = 0
        self.metadata = 1
        self.strict = 0
        self._warnings = 0

    def finalize_options(self):
        pass

    def warn(self, msg):
        """Counts the number of warnings that occurs."""
        self._warnings += 1
        return Command.warn(self, msg)

    def run(self):
        """Runs the command."""
        # perform the various tests
        if self.metadata:
            self.check_metadata()
        if self.restructuredtext:
            if HAS_DOCUTILS:
                self.check_restructuredtext()
            elif self.strict:
                raise DistutilsSetupError('The docutils package is needed.')

        # let's raise an error in strict mode, if we have at least
        # one warning
        if self.strict and self._warnings > 0:
            raise DistutilsSetupError('Please correct your package.')

    def check_metadata(self):
        """Ensures that all required elements of meta-data are supplied.

        Required fields:
            name, version, URL

        Recommended fields:
            (author and author_email) or (maintainer and maintainer_email)

        Warns if any are missing.
        """
        metadata = self.distribution.metadata

        missing = []
        for attr in ('name', 'version', 'url'):
            if not (hasattr(metadata, attr) and getattr(metadata, attr)):
                missing.append(attr)

        if missing:
            self.warn("missing required meta-data: %s"  % ', '.join(missing))
        if metadata.author:
            if not metadata.author_email:
                self.warn("missing meta-data: if 'author' supplied, " +
                          "'author_email' should be supplied too")
        elif metadata.maintainer:
            if not metadata.maintainer_email:
                self.warn("missing meta-data: if 'maintainer' supplied, " +
                          "'maintainer_email' should be supplied too")
        else:
            self.warn("missing meta-data: either (author and author_email) " +
                      "or (maintainer and maintainer_email) " +
                      "should be supplied")

    def check_restructuredtext(self):
        """Checks if the long string fields are reST-compliant."""
        data = self.distribution.get_long_description()
        for warning in self._check_rst_data(data):
            line = warning[-1].get('line')
            if line is None:
                warning = warning[1]
            else:
                warning = '%s (line %s)' % (warning[1], line)
            self.warn(warning)

    def _check_rst_data(self, data):
        """Returns warnings when the provided data doesn't compile."""
        # the include and csv_table directives need this to be a path
        source_path = self.distribution.script_name or 'setup.py'
        parser = Parser()
        settings = frontend.OptionParser(components=(Parser,)).get_default_values()
        settings.tab_width = 4
        settings.pep_references = None
        settings.rfc_references = None
        reporter = SilentReporter(source_path,
                          settings.report_level,
                          settings.halt_level,
                          stream=settings.warning_stream,
                          debug=settings.debug,
                          encoding=settings.error_encoding,
                          error_handler=settings.error_encoding_error_handler)

        document = nodes.document(settings, reporter, source=source_path)
        document.note_source(source_path, -1)
        try:
            parser.parse(data, document)
        except AttributeError as e:
            reporter.messages.append(
                (-1, 'Could not finish the parsing: %s.' % e, '', {}))

        return reporter.messages
PK       ! ,
  
    clean.pynu [        """distutils.command.clean

Implements the Distutils 'clean' command."""

# contributed by Bastian Kleineidam <calvin@cs.uni-sb.de>, added 2000-03-18

import os
from distutils.core import Command
from distutils.dir_util import remove_tree
from distutils import log

class clean(Command):

    description = "clean up temporary files from 'build' command"
    user_options = [
        ('build-base=', 'b',
         "base build directory (default: 'build.build-base')"),
        ('build-lib=', None,
         "build directory for all modules (default: 'build.build-lib')"),
        ('build-temp=', 't',
         "temporary build directory (default: 'build.build-temp')"),
        ('build-scripts=', None,
         "build directory for scripts (default: 'build.build-scripts')"),
        ('bdist-base=', None,
         "temporary directory for built distributions"),
        ('all', 'a',
         "remove all build output, not just temporary by-products")
    ]

    boolean_options = ['all']

    def initialize_options(self):
        self.build_base = None
        self.build_lib = None
        self.build_temp = None
        self.build_scripts = None
        self.bdist_base = None
        self.all = None

    def finalize_options(self):
        self.set_undefined_options('build',
                                   ('build_base', 'build_base'),
                                   ('build_lib', 'build_lib'),
                                   ('build_scripts', 'build_scripts'),
                                   ('build_temp', 'build_temp'))
        self.set_undefined_options('bdist',
                                   ('bdist_base', 'bdist_base'))

    def run(self):
        # remove the build/temp.<plat> directory (unless it's already
        # gone)
        if os.path.exists(self.build_temp):
            remove_tree(self.build_temp, dry_run=self.dry_run)
        else:
            log.debug("'%s' does not exist -- can't clean it",
                      self.build_temp)

        if self.all:
            # remove build directories
            for directory in (self.build_lib,
                              self.bdist_base,
                              self.build_scripts):
                if os.path.exists(directory):
                    remove_tree(directory, dry_run=self.dry_run)
                else:
                    log.warn("'%s' does not exist -- can't clean it",
                             directory)

        # just for the heck of it, try to remove the base build directory:
        # we might have emptied it right now, but if not we don't care
        if not self.dry_run:
            try:
                os.rmdir(self.build_base)
                log.info("removing '%s'", self.build_base)
            except OSError:
                pass
PK       ! !  !    install_lib.pynu [        """distutils.command.install_lib

Implements the Distutils 'install_lib' command
(install all Python modules)."""

import os
import importlib.util
import sys

from distutils.core import Command
from distutils.errors import DistutilsOptionError


# Extension for Python source files.
PYTHON_SOURCE_EXTENSION = ".py"

class install_lib(Command):

    description = "install all Python modules (extensions and pure Python)"

    # The byte-compilation options are a tad confusing.  Here are the
    # possible scenarios:
    #   1) no compilation at all (--no-compile --no-optimize)
    #   2) compile .pyc only (--compile --no-optimize; default)
    #   3) compile .pyc and "opt-1" .pyc (--compile --optimize)
    #   4) compile "opt-1" .pyc only (--no-compile --optimize)
    #   5) compile .pyc and "opt-2" .pyc (--compile --optimize-more)
    #   6) compile "opt-2" .pyc only (--no-compile --optimize-more)
    #
    # The UI for this is two options, 'compile' and 'optimize'.
    # 'compile' is strictly boolean, and only decides whether to
    # generate .pyc files.  'optimize' is three-way (0, 1, or 2), and
    # decides both whether to generate .pyc files and what level of
    # optimization to use.

    user_options = [
        ('install-dir=', 'd', "directory to install to"),
        ('build-dir=','b', "build directory (where to install from)"),
        ('force', 'f', "force installation (overwrite existing files)"),
        ('compile', 'c', "compile .py to .pyc [default]"),
        ('no-compile', None, "don't compile .py files"),
        ('optimize=', 'O',
         "also compile with optimization: -O1 for \"python -O\", "
         "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),
        ('skip-build', None, "skip the build steps"),
        ]

    boolean_options = ['force', 'compile', 'skip-build']
    negative_opt = {'no-compile' : 'compile'}

    def initialize_options(self):
        # let the 'install' command dictate our installation directory
        self.install_dir = None
        self.build_dir = None
        self.force = 0
        self.compile = None
        self.optimize = None
        self.skip_build = None
        self.multiarch = None # if we should rename the extensions

    def finalize_options(self):
        # Get all the information we need to install pure Python modules
        # from the umbrella 'install' command -- build (source) directory,
        # install (target) directory, and whether to compile .py files.
        self.set_undefined_options('install',
                                   ('build_lib', 'build_dir'),
                                   ('install_lib', 'install_dir'),
                                   ('force', 'force'),
                                   ('compile', 'compile'),
                                   ('optimize', 'optimize'),
                                   ('skip_build', 'skip_build'),
                                   ('multiarch', 'multiarch'),
                                  )

        if self.compile is None:
            self.compile = True
        if self.optimize is None:
            self.optimize = False

        if not isinstance(self.optimize, int):
            try:
                self.optimize = int(self.optimize)
                if self.optimize not in (0, 1, 2):
                    raise AssertionError
            except (ValueError, AssertionError):
                raise DistutilsOptionError("optimize must be 0, 1, or 2")

    def run(self):
        # Make sure we have built everything we need first
        self.build()

        # Install everything: simply dump the entire contents of the build
        # directory to the installation directory (that's the beauty of
        # having a build directory!)
        outfiles = self.install()

        # (Optionally) compile .py to .pyc
        if outfiles is not None and self.distribution.has_pure_modules():
            self.byte_compile(outfiles)

    # -- Top-level worker functions ------------------------------------
    # (called from 'run()')

    def build(self):
        if not self.skip_build:
            if self.distribution.has_pure_modules():
                self.run_command('build_py')
            if self.distribution.has_ext_modules():
                self.run_command('build_ext')

    def install(self):
        if os.path.isdir(self.build_dir):
            import distutils.dir_util
            distutils.dir_util._multiarch = self.multiarch
            outfiles = self.copy_tree(self.build_dir, self.install_dir)
        else:
            self.warn("'%s' does not exist -- no Python modules to install" %
                      self.build_dir)
            return
        return outfiles

    def byte_compile(self, files):
        if sys.dont_write_bytecode:
            self.warn('byte-compiling is disabled, skipping.')
            return

        from distutils.util import byte_compile

        # Get the "--root" directory supplied to the "install" command,
        # and use it as a prefix to strip off the purported filename
        # encoded in bytecode files.  This is far from complete, but it
        # should at least generate usable bytecode in RPM distributions.
        install_root = self.get_finalized_command('install').root

        if self.compile:
            byte_compile(files, optimize=0,
                         force=self.force, prefix=install_root,
                         dry_run=self.dry_run)
        if self.optimize > 0:
            byte_compile(files, optimize=self.optimize,
                         force=self.force, prefix=install_root,
                         verbose=self.verbose, dry_run=self.dry_run)


    # -- Utility methods -----------------------------------------------

    def _mutate_outputs(self, has_any, build_cmd, cmd_option, output_dir):
        if not has_any:
            return []

        build_cmd = self.get_finalized_command(build_cmd)
        build_files = build_cmd.get_outputs()
        build_dir = getattr(build_cmd, cmd_option)

        prefix_len = len(build_dir) + len(os.sep)
        outputs = []
        for file in build_files:
            outputs.append(os.path.join(output_dir, file[prefix_len:]))

        return outputs

    def _bytecode_filenames(self, py_filenames):
        bytecode_files = []
        for py_file in py_filenames:
            # Since build_py handles package data installation, the
            # list of outputs can contain more than just .py files.
            # Make sure we only report bytecode for the .py files.
            ext = os.path.splitext(os.path.normcase(py_file))[1]
            if ext != PYTHON_SOURCE_EXTENSION:
                continue
            if self.compile:
                bytecode_files.append(importlib.util.cache_from_source(
                    py_file, optimization=''))
            if self.optimize > 0:
                bytecode_files.append(importlib.util.cache_from_source(
                    py_file, optimization=self.optimize))

        return bytecode_files


    # -- External interface --------------------------------------------
    # (called by outsiders)

    def get_outputs(self):
        """Return the list of files that would be installed if this command
        were actually run.  Not affected by the "dry-run" flag or whether
        modules have actually been built yet.
        """
        pure_outputs = \
            self._mutate_outputs(self.distribution.has_pure_modules(),
                                 'build_py', 'build_lib',
                                 self.install_dir)
        if self.compile:
            bytecode_outputs = self._bytecode_filenames(pure_outputs)
        else:
            bytecode_outputs = []

        ext_outputs = \
            self._mutate_outputs(self.distribution.has_ext_modules(),
                                 'build_ext', 'build_lib',
                                 self.install_dir)

        return pure_outputs + bytecode_outputs + ext_outputs

    def get_inputs(self):
        """Get the list of files that are input to this command, ie. the
        files that get installed as they are named in the build tree.
        The files in this list correspond one-to-one to the output
        filenames returned by 'get_outputs()'.
        """
        inputs = []

        if self.distribution.has_pure_modules():
            build_py = self.get_finalized_command('build_py')
            inputs.extend(build_py.get_outputs())

        if self.distribution.has_ext_modules():
            build_ext = self.get_finalized_command('build_ext')
            inputs.extend(build_ext.get_outputs())

        return inputs
PK       ! v3;V  V    build_clib.pynu [        """distutils.command.build_clib

Implements the Distutils 'build_clib' command, to build a C/C++ library
that is included in the module distribution and needed by an extension
module."""


# XXX this module has *lots* of code ripped-off quite transparently from
# build_ext.py -- not surprisingly really, as the work required to build
# a static library from a collection of C source files is not really all
# that different from what's required to build a shared object file from
# a collection of C source files.  Nevertheless, I haven't done the
# necessary refactoring to account for the overlap in code between the
# two modules, mainly because a number of subtle details changed in the
# cut 'n paste.  Sigh.

import os
from distutils.core import Command
from distutils.errors import *
from distutils.sysconfig import customize_compiler
from distutils import log

def show_compilers():
    from distutils.ccompiler import show_compilers
    show_compilers()


class build_clib(Command):

    description = "build C/C++ libraries used by Python extensions"

    user_options = [
        ('build-clib=', 'b',
         "directory to build C/C++ libraries to"),
        ('build-temp=', 't',
         "directory to put temporary build by-products"),
        ('debug', 'g',
         "compile with debugging information"),
        ('force', 'f',
         "forcibly build everything (ignore file timestamps)"),
        ('compiler=', 'c',
         "specify the compiler type"),
        ]

    boolean_options = ['debug', 'force']

    help_options = [
        ('help-compiler', None,
         "list available compilers", show_compilers),
        ]

    def initialize_options(self):
        self.build_clib = None
        self.build_temp = None

        # List of libraries to build
        self.libraries = None

        # Compilation options for all libraries
        self.include_dirs = None
        self.define = None
        self.undef = None
        self.debug = None
        self.force = 0
        self.compiler = None


    def finalize_options(self):
        # This might be confusing: both build-clib and build-temp default
        # to build-temp as defined by the "build" command.  This is because
        # I think that C libraries are really just temporary build
        # by-products, at least from the point of view of building Python
        # extensions -- but I want to keep my options open.
        self.set_undefined_options('build',
                                   ('build_temp', 'build_clib'),
                                   ('build_temp', 'build_temp'),
                                   ('compiler', 'compiler'),
                                   ('debug', 'debug'),
                                   ('force', 'force'))

        self.libraries = self.distribution.libraries
        if self.libraries:
            self.check_library_list(self.libraries)

        if self.include_dirs is None:
            self.include_dirs = self.distribution.include_dirs or []
        if isinstance(self.include_dirs, str):
            self.include_dirs = self.include_dirs.split(os.pathsep)

        # XXX same as for build_ext -- what about 'self.define' and
        # 'self.undef' ?


    def run(self):
        if not self.libraries:
            return

        # Yech -- this is cut 'n pasted from build_ext.py!
        from distutils.ccompiler import new_compiler
        self.compiler = new_compiler(compiler=self.compiler,
                                     dry_run=self.dry_run,
                                     force=self.force)
        customize_compiler(self.compiler)

        if self.include_dirs is not None:
            self.compiler.set_include_dirs(self.include_dirs)
        if self.define is not None:
            # 'define' option is a list of (name,value) tuples
            for (name,value) in self.define:
                self.compiler.define_macro(name, value)
        if self.undef is not None:
            for macro in self.undef:
                self.compiler.undefine_macro(macro)

        self.build_libraries(self.libraries)


    def check_library_list(self, libraries):
        """Ensure that the list of libraries is valid.

        `library` is presumably provided as a command option 'libraries'.
        This method checks that it is a list of 2-tuples, where the tuples
        are (library_name, build_info_dict).

        Raise DistutilsSetupError if the structure is invalid anywhere;
        just returns otherwise.
        """
        if not isinstance(libraries, list):
            raise DistutilsSetupError(
                  "'libraries' option must be a list of tuples")

        for lib in libraries:
            if not isinstance(lib, tuple) and len(lib) != 2:
                raise DistutilsSetupError(
                      "each element of 'libraries' must a 2-tuple")

            name, build_info = lib

            if not isinstance(name, str):
                raise DistutilsSetupError(
                      "first element of each tuple in 'libraries' "
                      "must be a string (the library name)")

            if '/' in name or (os.sep != '/' and os.sep in name):
                raise DistutilsSetupError("bad library name '%s': "
                       "may not contain directory separators" % lib[0])

            if not isinstance(build_info, dict):
                raise DistutilsSetupError(
                      "second element of each tuple in 'libraries' "
                      "must be a dictionary (build info)")


    def get_library_names(self):
        # Assume the library list is valid -- 'check_library_list()' is
        # called from 'finalize_options()', so it should be!
        if not self.libraries:
            return None

        lib_names = []
        for (lib_name, build_info) in self.libraries:
            lib_names.append(lib_name)
        return lib_names


    def get_source_files(self):
        self.check_library_list(self.libraries)
        filenames = []
        for (lib_name, build_info) in self.libraries:
            sources = build_info.get('sources')
            if sources is None or not isinstance(sources, (list, tuple)):
                raise DistutilsSetupError(
                       "in 'libraries' option (library '%s'), "
                       "'sources' must be present and must be "
                       "a list of source filenames" % lib_name)

            filenames.extend(sources)
        return filenames


    def build_libraries(self, libraries):
        for (lib_name, build_info) in libraries:
            sources = build_info.get('sources')
            if sources is None or not isinstance(sources, (list, tuple)):
                raise DistutilsSetupError(
                       "in 'libraries' option (library '%s'), "
                       "'sources' must be present and must be "
                       "a list of source filenames" % lib_name)
            sources = list(sources)

            log.info("building '%s' library", lib_name)

            # First, compile the source code to object files in the library
            # directory.  (This should probably change to putting object
            # files in a temporary build directory.)
            macros = build_info.get('macros')
            include_dirs = build_info.get('include_dirs')
            objects = self.compiler.compile(sources,
                                            output_dir=self.build_temp,
                                            macros=macros,
                                            include_dirs=include_dirs,
                                            debug=self.debug)

            # Now "link" the object files together into a static library.
            # (On Unix at least, this isn't really linking -- it just
            # builds an archive.  Whatever.)
            self.compiler.create_static_lib(objects, lib_name,
                                            output_dir=self.build_clib,
                                            debug=self.debug)
PK       ! d+X  X    build_scripts.pynu [        """distutils.command.build_scripts

Implements the Distutils 'build_scripts' command."""

import os, re
from stat import ST_MODE
from distutils import sysconfig
from distutils.core import Command
from distutils.dep_util import newer
from distutils.util import convert_path, Mixin2to3
from distutils import log
import tokenize

# check if Python is called on the first line with this expression
first_line_re = re.compile(b'^#!.*python[0-9.]*([ \t].*)?$')

class build_scripts(Command):

    description = "\"build\" scripts (copy and fixup #! line)"

    user_options = [
        ('build-dir=', 'd', "directory to \"build\" (copy) to"),
        ('force', 'f', "forcibly build everything (ignore file timestamps"),
        ('executable=', 'e', "specify final destination interpreter path"),
        ]

    boolean_options = ['force']


    def initialize_options(self):
        self.build_dir = None
        self.scripts = None
        self.force = None
        self.executable = None
        self.outfiles = None

    def finalize_options(self):
        self.set_undefined_options('build',
                                   ('build_scripts', 'build_dir'),
                                   ('force', 'force'),
                                   ('executable', 'executable'))
        self.scripts = self.distribution.scripts

    def get_source_files(self):
        return self.scripts

    def run(self):
        if not self.scripts:
            return
        self.copy_scripts()


    def copy_scripts(self):
        r"""Copy each script listed in 'self.scripts'; if it's marked as a
        Python script in the Unix way (first line matches 'first_line_re',
        ie. starts with "\#!" and contains "python"), then adjust the first
        line to refer to the current Python interpreter as we copy.
        """
        self.mkpath(self.build_dir)
        outfiles = []
        updated_files = []
        for script in self.scripts:
            adjust = False
            script = convert_path(script)
            outfile = os.path.join(self.build_dir, os.path.basename(script))
            outfiles.append(outfile)

            if not self.force and not newer(script, outfile):
                log.debug("not copying %s (up-to-date)", script)
                continue

            # Always open the file, but ignore failures in dry-run mode --
            # that way, we'll get accurate feedback if we can read the
            # script.
            try:
                f = open(script, "rb")
            except OSError:
                if not self.dry_run:
                    raise
                f = None
            else:
                encoding, lines = tokenize.detect_encoding(f.readline)
                f.seek(0)
                first_line = f.readline()
                if not first_line:
                    self.warn("%s is an empty file (skipping)" % script)
                    continue

                match = first_line_re.match(first_line)
                if match:
                    adjust = True
                    post_interp = match.group(1) or b''

            if adjust:
                log.info("copying and adjusting %s -> %s", script,
                         self.build_dir)
                updated_files.append(outfile)
                if not self.dry_run:
                    if not sysconfig.python_build:
                        executable = self.executable
                    else:
                        executable = os.path.join(
                            sysconfig.get_config_var("BINDIR"),
                           "python%s%s" % (sysconfig.get_config_var("VERSION"),
                                           sysconfig.get_config_var("EXE")))
                    executable = os.fsencode(executable)
                    shebang = b"#!" + executable + post_interp + b"\n"
                    # Python parser starts to read a script using UTF-8 until
                    # it gets a #coding:xxx cookie. The shebang has to be the
                    # first line of a file, the #coding:xxx cookie cannot be
                    # written before. So the shebang has to be decodable from
                    # UTF-8.
                    try:
                        shebang.decode('utf-8')
                    except UnicodeDecodeError:
                        raise ValueError(
                            "The shebang ({!r}) is not decodable "
                            "from utf-8".format(shebang))
                    # If the script is encoded to a custom encoding (use a
                    # #coding:xxx cookie), the shebang has to be decodable from
                    # the script encoding too.
                    try:
                        shebang.decode(encoding)
                    except UnicodeDecodeError:
                        raise ValueError(
                            "The shebang ({!r}) is not decodable "
                            "from the script encoding ({})"
                            .format(shebang, encoding))
                    with open(outfile, "wb") as outf:
                        outf.write(shebang)
                        outf.writelines(f.readlines())
                if f:
                    f.close()
            else:
                if f:
                    f.close()
                updated_files.append(outfile)
                self.copy_file(script, outfile)

        if os.name == 'posix':
            for file in outfiles:
                if self.dry_run:
                    log.info("changing mode of %s", file)
                else:
                    oldmode = os.stat(file)[ST_MODE] & 0o7777
                    newmode = (oldmode | 0o555) & 0o7777
                    if newmode != oldmode:
                        log.info("changing mode of %s from %o to %o",
                                 file, oldmode, newmode)
                        os.chmod(file, newmode)
        # XXX should we modify self.outfiles?
        return outfiles, updated_files

class build_scripts_2to3(build_scripts, Mixin2to3):

    def copy_scripts(self):
        outfiles, updated_files = build_scripts.copy_scripts(self)
        if not self.dry_run:
            self.run_2to3(updated_files)
        return outfiles, updated_files
PK       ! 7=3  =3  	  config.pynu [        """distutils.command.config

Implements the Distutils 'config' command, a (mostly) empty command class
that exists mainly to be sub-classed by specific module distributions and
applications.  The idea is that while every "config" command is different,
at least they're all named the same, and users always see "config" in the
list of standard commands.  Also, this is a good place to put common
configure-like tasks: "try to compile this C code", or "figure out where
this header file lives".
"""

import os, re

from distutils.core import Command
from distutils.errors import DistutilsExecError
from distutils.sysconfig import customize_compiler
from distutils import log

LANG_EXT = {"c": ".c", "c++": ".cxx"}

class config(Command):

    description = "prepare to build"

    user_options = [
        ('compiler=', None,
         "specify the compiler type"),
        ('cc=', None,
         "specify the compiler executable"),
        ('include-dirs=', 'I',
         "list of directories to search for header files"),
        ('define=', 'D',
         "C preprocessor macros to define"),
        ('undef=', 'U',
         "C preprocessor macros to undefine"),
        ('libraries=', 'l',
         "external C libraries to link with"),
        ('library-dirs=', 'L',
         "directories to search for external C libraries"),

        ('noisy', None,
         "show every action (compile, link, run, ...) taken"),
        ('dump-source', None,
         "dump generated source files before attempting to compile them"),
        ]


    # The three standard command methods: since the "config" command
    # does nothing by default, these are empty.

    def initialize_options(self):
        self.compiler = None
        self.cc = None
        self.include_dirs = None
        self.libraries = None
        self.library_dirs = None

        # maximal output for now
        self.noisy = 1
        self.dump_source = 1

        # list of temporary files generated along-the-way that we have
        # to clean at some point
        self.temp_files = []

    def finalize_options(self):
        if self.include_dirs is None:
            self.include_dirs = self.distribution.include_dirs or []
        elif isinstance(self.include_dirs, str):
            self.include_dirs = self.include_dirs.split(os.pathsep)

        if self.libraries is None:
            self.libraries = []
        elif isinstance(self.libraries, str):
            self.libraries = [self.libraries]

        if self.library_dirs is None:
            self.library_dirs = []
        elif isinstance(self.library_dirs, str):
            self.library_dirs = self.library_dirs.split(os.pathsep)

    def run(self):
        pass

    # Utility methods for actual "config" commands.  The interfaces are
    # loosely based on Autoconf macros of similar names.  Sub-classes
    # may use these freely.

    def _check_compiler(self):
        """Check that 'self.compiler' really is a CCompiler object;
        if not, make it one.
        """
        # We do this late, and only on-demand, because this is an expensive
        # import.
        from distutils.ccompiler import CCompiler, new_compiler
        if not isinstance(self.compiler, CCompiler):
            self.compiler = new_compiler(compiler=self.compiler,
                                         dry_run=self.dry_run, force=1)
            customize_compiler(self.compiler)
            if self.include_dirs:
                self.compiler.set_include_dirs(self.include_dirs)
            if self.libraries:
                self.compiler.set_libraries(self.libraries)
            if self.library_dirs:
                self.compiler.set_library_dirs(self.library_dirs)

    def _gen_temp_sourcefile(self, body, headers, lang):
        filename = "_configtest" + LANG_EXT[lang]
        with open(filename, "w") as file:
            if headers:
                for header in headers:
                    file.write("#include <%s>\n" % header)
                file.write("\n")
            file.write(body)
            if body[-1] != "\n":
                file.write("\n")
        return filename

    def _preprocess(self, body, headers, include_dirs, lang):
        src = self._gen_temp_sourcefile(body, headers, lang)
        out = "_configtest.i"
        self.temp_files.extend([src, out])
        self.compiler.preprocess(src, out, include_dirs=include_dirs)
        return (src, out)

    def _compile(self, body, headers, include_dirs, lang):
        src = self._gen_temp_sourcefile(body, headers, lang)
        if self.dump_source:
            dump_file(src, "compiling '%s':" % src)
        (obj,) = self.compiler.object_filenames([src])
        self.temp_files.extend([src, obj])
        self.compiler.compile([src], include_dirs=include_dirs)
        return (src, obj)

    def _link(self, body, headers, include_dirs, libraries, library_dirs,
              lang):
        (src, obj) = self._compile(body, headers, include_dirs, lang)
        prog = os.path.splitext(os.path.basename(src))[0]
        self.compiler.link_executable([obj], prog,
                                      libraries=libraries,
                                      library_dirs=library_dirs,
                                      target_lang=lang)

        if self.compiler.exe_extension is not None:
            prog = prog + self.compiler.exe_extension
        self.temp_files.append(prog)

        return (src, obj, prog)

    def _clean(self, *filenames):
        if not filenames:
            filenames = self.temp_files
            self.temp_files = []
        log.info("removing: %s", ' '.join(filenames))
        for filename in filenames:
            try:
                os.remove(filename)
            except OSError:
                pass


    # XXX these ignore the dry-run flag: what to do, what to do? even if
    # you want a dry-run build, you still need some sort of configuration
    # info.  My inclination is to make it up to the real config command to
    # consult 'dry_run', and assume a default (minimal) configuration if
    # true.  The problem with trying to do it here is that you'd have to
    # return either true or false from all the 'try' methods, neither of
    # which is correct.

    # XXX need access to the header search path and maybe default macros.

    def try_cpp(self, body=None, headers=None, include_dirs=None, lang="c"):
        """Construct a source file from 'body' (a string containing lines
        of C/C++ code) and 'headers' (a list of header files to include)
        and run it through the preprocessor.  Return true if the
        preprocessor succeeded, false if there were any errors.
        ('body' probably isn't of much use, but what the heck.)
        """
        from distutils.ccompiler import CompileError
        self._check_compiler()
        ok = True
        try:
            self._preprocess(body, headers, include_dirs, lang)
        except CompileError:
            ok = False

        self._clean()
        return ok

    def search_cpp(self, pattern, body=None, headers=None, include_dirs=None,
                   lang="c"):
        """Construct a source file (just like 'try_cpp()'), run it through
        the preprocessor, and return true if any line of the output matches
        'pattern'.  'pattern' should either be a compiled regex object or a
        string containing a regex.  If both 'body' and 'headers' are None,
        preprocesses an empty file -- which can be useful to determine the
        symbols the preprocessor and compiler set by default.
        """
        self._check_compiler()
        src, out = self._preprocess(body, headers, include_dirs, lang)

        if isinstance(pattern, str):
            pattern = re.compile(pattern)

        with open(out) as file:
            match = False
            while True:
                line = file.readline()
                if line == '':
                    break
                if pattern.search(line):
                    match = True
                    break

        self._clean()
        return match

    def try_compile(self, body, headers=None, include_dirs=None, lang="c"):
        """Try to compile a source file built from 'body' and 'headers'.
        Return true on success, false otherwise.
        """
        from distutils.ccompiler import CompileError
        self._check_compiler()
        try:
            self._compile(body, headers, include_dirs, lang)
            ok = True
        except CompileError:
            ok = False

        log.info(ok and "success!" or "failure.")
        self._clean()
        return ok

    def try_link(self, body, headers=None, include_dirs=None, libraries=None,
                 library_dirs=None, lang="c"):
        """Try to compile and link a source file, built from 'body' and
        'headers', to executable form.  Return true on success, false
        otherwise.
        """
        from distutils.ccompiler import CompileError, LinkError
        self._check_compiler()
        try:
            self._link(body, headers, include_dirs,
                       libraries, library_dirs, lang)
            ok = True
        except (CompileError, LinkError):
            ok = False

        log.info(ok and "success!" or "failure.")
        self._clean()
        return ok

    def try_run(self, body, headers=None, include_dirs=None, libraries=None,
                library_dirs=None, lang="c"):
        """Try to compile, link to an executable, and run a program
        built from 'body' and 'headers'.  Return true on success, false
        otherwise.
        """
        from distutils.ccompiler import CompileError, LinkError
        self._check_compiler()
        try:
            src, obj, exe = self._link(body, headers, include_dirs,
                                       libraries, library_dirs, lang)
            self.spawn([exe])
            ok = True
        except (CompileError, LinkError, DistutilsExecError):
            ok = False

        log.info(ok and "success!" or "failure.")
        self._clean()
        return ok


    # -- High-level methods --------------------------------------------
    # (these are the ones that are actually likely to be useful
    # when implementing a real-world config command!)

    def check_func(self, func, headers=None, include_dirs=None,
                   libraries=None, library_dirs=None, decl=0, call=0):
        """Determine if function 'func' is available by constructing a
        source file that refers to 'func', and compiles and links it.
        If everything succeeds, returns true; otherwise returns false.

        The constructed source file starts out by including the header
        files listed in 'headers'.  If 'decl' is true, it then declares
        'func' (as "int func()"); you probably shouldn't supply 'headers'
        and set 'decl' true in the same call, or you might get errors about
        a conflicting declarations for 'func'.  Finally, the constructed
        'main()' function either references 'func' or (if 'call' is true)
        calls it.  'libraries' and 'library_dirs' are used when
        linking.
        """
        self._check_compiler()
        body = []
        if decl:
            body.append("int %s ();" % func)
        body.append("int main () {")
        if call:
            body.append("  %s();" % func)
        else:
            body.append("  %s;" % func)
        body.append("}")
        body = "\n".join(body) + "\n"

        return self.try_link(body, headers, include_dirs,
                             libraries, library_dirs)

    def check_lib(self, library, library_dirs=None, headers=None,
                  include_dirs=None, other_libraries=[]):
        """Determine if 'library' is available to be linked against,
        without actually checking that any particular symbols are provided
        by it.  'headers' will be used in constructing the source file to
        be compiled, but the only effect of this is to check if all the
        header files listed are available.  Any libraries listed in
        'other_libraries' will be included in the link, in case 'library'
        has symbols that depend on other libraries.
        """
        self._check_compiler()
        return self.try_link("int main (void) { }", headers, include_dirs,
                             [library] + other_libraries, library_dirs)

    def check_header(self, header, include_dirs=None, library_dirs=None,
                     lang="c"):
        """Determine if the system header file named by 'header_file'
        exists and can be found by the preprocessor; return true if so,
        false otherwise.
        """
        return self.try_cpp(body="/* No body */", headers=[header],
                            include_dirs=include_dirs)

def dump_file(filename, head=None):
    """Dumps a file content into log.info.

    If head is not None, will be dumped before the file content.
    """
    if head is None:
        log.info('%s', filename)
    else:
        log.info(head)
    file = open(filename)
    try:
        log.info(file.read())
    finally:
        file.close()
PK       ! "    !  __pycache__/build.cpython-310.pycnu [        o
    bc                     @   sT   d Z ddlZddlZddlmZ ddlmZ ddlmZ dd Z	G dd	 d	eZ
dS )
zBdistutils.command.build

Implements the Distutils 'build' command.    N)Command)DistutilsOptionError)get_platformc                  C   s   ddl m}  |   d S )Nr   show_compilers)distutils.ccompilerr   r    r   ./usr/lib/python3.10/distutils/command/build.pyr      s   
r   c                   @   s   e Zd ZdZdddddddd	d
e  fdddddgZddgZdddefgZdd Z	dd Z
dd Zdd Zdd Zdd  Zd!d" Zd#efd$efd%efd&efgZdS )'buildz"build everything needed to install)zbuild-base=bz base directory for build library)zbuild-purelib=Nz2build directory for platform-neutral distributions)zbuild-platlib=Nz3build directory for platform-specific distributions)z
build-lib=NzWbuild directory for all distribution (defaults to either build-purelib or build-platlib)zbuild-scripts=Nzbuild directory for scripts)zbuild-temp=tztemporary build directoryz
plat-name=pz6platform name to build for, if supported (default: %s))z	compiler=czspecify the compiler type)z	parallel=jznumber of parallel build jobs)debuggz;compile extensions and libraries with debugging information)forcefz2forcibly build everything (ignore file timestamps))zexecutable=ez5specify final destination interpreter path (build.py)r   r   zhelp-compilerNzlist available compilersc                 C   sL   d| _ d | _d | _d | _d | _d | _d | _d | _d | _d| _	d | _
d | _d S )Nr
   r   )
build_basebuild_purelibbuild_platlib	build_lib
build_tempbuild_scriptscompiler	plat_namer   r   
executableparallelselfr   r   r	   initialize_options8   s   
zbuild.initialize_optionsc                 C   sX  | j d u r
t | _ n	tjdkrtdd| j gtjd d R  }ttdr*|d7 }| jd u r8tj	
| jd| _| jd u rHtj	
| jd| | _| jd u rZ| jjrV| j| _n| j| _| jd u rjtj	
| jd| | _| jd u rtj	
| jd	tjd d  | _| jd u rtjrtj	tj| _t| jtrz	t| j| _W d S  ty   td
w d S )NntzW--plat-name only supported on Windows (try using './configure --help' on your platform)z	.%s-%d.%d   gettotalrefcountz-pydebuglibtempzscripts-%d.%dzparallel should be an integer)r   r   osnamer   sysversion_infohasattrr   pathjoinr   r   r   distributionext_modulesr   r   r   normpath
isinstancer   strint
ValueError)r    plat_specifierr   r   r	   finalize_optionsH   sH   












zbuild.finalize_optionsc                 C   s   |   D ]}| | qd S N)get_sub_commandsrun_command)r    cmd_namer   r   r	   run   s   z	build.runc                 C   
   | j  S r7   )r.   has_pure_modulesr   r   r   r	   r=         
zbuild.has_pure_modulesc                 C   r<   r7   )r.   has_c_librariesr   r   r   r	   r?      r>   zbuild.has_c_librariesc                 C   r<   r7   )r.   has_ext_modulesr   r   r   r	   r@      r>   zbuild.has_ext_modulesc                 C   r<   r7   )r.   has_scriptsr   r   r   r	   rA      r>   zbuild.has_scriptsbuild_py
build_clib	build_extr   )__name__
__module____qualname__descriptionr   user_optionsboolean_optionsr   help_optionsr!   r6   r;   r=   r?   r@   rA   sub_commandsr   r   r   r	   r
      sH    8r
   )__doc__r)   r'   distutils.corer   distutils.errorsr   distutils.utilr   r   r
   r   r   r   r	   <module>   s    PK       ! S/  /  %  __pycache__/bdist_rpm.cpython-310.pycnu [        o
    bc!T                     @   st   d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
T ddlmZ ddlmZ G d	d
 d
eZdS )zwdistutils.command.bdist_rpm

Implements the Distutils 'bdist_rpm' command (create RPM source and binary
distributions).    N)Command)DEBUG)
write_file)*)get_python_version)logc                   @   sd   e Zd ZdZg dZg dZddddZdd	 Zd
d Zdd Z	dd Z
dd Zdd Zdd ZdS )	bdist_rpmzcreate an RPM distribution)))zbdist-base=Nz/base directory for creating built distributions)z	rpm-base=Nzdbase directory for creating RPMs (defaults to "rpm" under --bdist-base; must be specified for RPM 2))z	dist-dir=dzDdirectory to put final RPM files in (and .spec files if --spec-only))zpython=NzMpath to Python interpreter to hard-code in the .spec file (default: "python"))z
fix-pythonNzLhard-code the exact path to the current Python interpreter in the .spec file)z	spec-onlyNzonly regenerate spec file)zsource-onlyNzonly generate source RPM)zbinary-onlyNzonly generate binary RPM)z	use-bzip2Nz7use bzip2 instead of gzip to create source distribution)zdistribution-name=Nzgname of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!))zgroup=Nz9package classification [default: "Development/Libraries"])zrelease=NzRPM release number)zserial=NzRPM serial number)zvendor=NzaRPM "vendor" (eg. "Joe Blow <joe@example.com>") [default: maintainer or author from setup script])z	packager=NzBRPM packager (eg. "Jane Doe <jane@example.net>") [default: vendor])z
doc-files=Nz6list of documentation files (space or comma-separated))z
changelog=NzRPM changelog)zicon=Nzname of icon file)z	provides=Nz%capabilities provided by this package)z	requires=Nz%capabilities required by this package)z
conflicts=Nz-capabilities which conflict with this package)zbuild-requires=Nz+capabilities required to build this package)z
obsoletes=Nz*capabilities made obsolete by this package)
no-autoreqNz+do not automatically calculate dependencies)	keep-tempkz"don't clean up RPM build directory)no-keep-tempNz&clean up RPM build directory [default])use-rpm-opt-flagsNz8compile with RPM_OPT_FLAGS when building from source RPM)no-rpm-opt-flagsNz&do not pass any RPM CFLAGS to compiler)	rpm3-modeNz"RPM 3 compatibility mode (default))	rpm2-modeNzRPM 2 compatibility mode)zprep-script=Nz3Specify a script for the PREP phase of RPM building)zbuild-script=Nz4Specify a script for the BUILD phase of RPM building)zpre-install=Nz:Specify a script for the pre-INSTALL phase of RPM building)zinstall-script=Nz6Specify a script for the INSTALL phase of RPM building)zpost-install=Nz;Specify a script for the post-INSTALL phase of RPM building)zpre-uninstall=Nz<Specify a script for the pre-UNINSTALL phase of RPM building)zpost-uninstall=Nz=Specify a script for the post-UNINSTALL phase of RPM building)zclean-script=Nz4Specify a script for the CLEAN phase of RPM building)zverify-script=Nz6Specify a script for the VERIFY phase of the RPM build)zforce-arch=Nz0Force an architecture onto the RPM build process)quietqz3Run the INSTALL phase of RPM building in quiet mode)r   r   r   r
   r   r   r   r   )r   r   r   c                 C   s   d | _ d | _d | _d | _d | _d | _d | _d | _d | _d | _	d | _
d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _ d| _!d| _"d| _#d| _$d | _%d| _&d S )Nr      )'
bdist_baserpm_basedist_dirpython
fix_python	spec_onlybinary_onlysource_only	use_bzip2distribution_namegroupreleaseserialvendorpackager	doc_files	changelogiconprep_scriptbuild_scriptinstall_scriptclean_scriptverify_scriptpre_installpost_installpre_uninstallpost_uninstallprepprovidesrequires	conflictsbuild_requires	obsoletes	keep_tempuse_rpm_opt_flags	rpm3_mode
no_autoreq
force_archr   self r=   2/usr/lib/python3.10/distutils/command/bdist_rpm.pyinitialize_options   sN   
zbdist_rpm.initialize_optionsc                 C   s   |  dd | jd u r| jstdtj| jd| _| jd u r,| j	r(t
j| _nd| _n| j	r3tdtjdkr?tdtj | jrI| jrItd	| j sQd
| _|  dd |   d S )Nbdist)r   r   z)you must specify --rpm-base in RPM 2 moderpmpython3z8--python and --fix-python are mutually exclusive optionsposixz9don't know how to create RPM distributions on platform %sz6cannot supply both '--source-only' and '--binary-only'r   )r   r   )set_undefined_optionsr   r8   DistutilsOptionErrorospathjoinr   r   r   sys
executablenameDistutilsPlatformErrorr   r   distributionhas_ext_modulesr7   finalize_package_datar;   r=   r=   r>   finalize_options   s6   




zbdist_rpm.finalize_optionsc                 C   sT  |  dd |  dd| j | j f  |  d | d t| jtr<dD ]}tj	
|r;|| jvr;| j| q(|  dd	 |  d
 |  d |  d | | j| _| d | d | d | d | d | d | d | d | d | d | d | d | d | d | d |  d d S )Nr   zDevelopment/Librariesr"   z%s <%s>r#   r$   )READMEz
README.txtr    1r!   r   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r1   r2   r3   r4   r5   r:   )ensure_stringrM   get_contactget_contact_emailensure_string_list
isinstancer$   listrF   rG   existsappend_format_changelogr%   ensure_filename)r<   readmer=   r=   r>   rO      sD   




















zbdist_rpm.finalize_package_datac                 C   s  t rtd td| j td| j td| j td| j | jr*| j}| | ni }dD ]}t	j
| j|||< | ||  q.|d }t	j
|d| j  }| t||  fd	|  | jrdd S | jjd d  }| d
}| jrydg|_ndg|_| d
 || j_| d }|d }| || | jrt	j
| jr| | j| ntd| j td dg}	| jr|	d n| j r|	d n|	d |	!dd| j" g | j#r|	!ddt	j
$| j g | j%s|	d | j&r|	d |	| d}
|
d }d|
 d }d|||f }t	'|}zCg }d }	 |( }|s$n!|) * }t+|d ks3J ||d!  |d u rC|d }q|, }|rTt-d"t.| W |,  n|,  w | /|	 | j0s| j1 rrt2 }nd#}| j st	j
|d$ |}t	j
|sJ | 3|| j t	j
| j|}| jjd%||f | js|D ]4}t	j
|d& |}t	j
|r| 3|| j t	j
| jt	j
4|}| jjd%||f qd S d S d S )'Nzbefore _get_package_data():zvendor =z
packager =zdoc_files =zchangelog =)SOURCESSPECSBUILDRPMSSRPMSr_   z%s.speczwriting '%s'sdistbztargztarr   r^   zicon file '%s' does not existzbuilding RPMsrpmbuildz-bsz-bbz-baz--definez__python %sz
_topdir %sz--cleanz--quietz%{name}-%{version}-%{release}z.src.rpmz%{arch}/z.%{arch}.rpmz%rpm -q --qf '%s %s\n' --specfile '%s'T   r   zFailed to execute: %sanyrb   r   ra   )5r   printr"   r#   r$   r%   r   r   mkpathrF   rG   rH   r   rM   get_nameexecuter   _make_spec_file
dist_filesreinitialize_commandr   formatsrun_commandget_archive_files	copy_filer&   rY   DistutilsFileErrorr   infor   rZ   r   extendr   r8   abspathr6   r   popenreadlinestripsplitlencloseDistutilsExecErrorreprspawndry_runrN   r   	move_filebasename)r<   spec_dirrpm_dirr	   	spec_pathsaved_dist_filesrc   source
source_dirrpm_cmd
nvr_stringsrc_rpmnon_src_rpmq_cmdoutbinary_rpms
source_rpmlinelstatus	pyversionsrpmfilenamerA   r=   r=   r>   run   s   












zbdist_rpm.runc                 C   s   t j| jt j|S )N)rF   rG   rH   r   r   )r<   rG   r=   r=   r>   
_dist_path  s   zbdist_rpm._dist_pathc              	   C   sJ  d| j   d| j  dd d| j   d| jdd dd| j   g}td	}d
dd |	 D }d}d}|||}||krT|
d |
d| d
  |g d | jrd|
d n|
d |d| j   d| j ddg | js| j  s|
d n|
d| j  dD ](}t| | }t|tr|
d|d|f  q|dur|
d||f  q| j  dkr|
d| j    | jr|
d | j  | jr|
d!d| j  | jr|
d"tj| j  | jr|
d# |dd$| j  g d%| jtjtj d& f }d'| }	| j!r!d(|	 }	d)| }
d*d+d,|	fd-d.|
fd/d0d1d2d3d4g	}|D ]C\}}}t| |}|sH|rz|dd5| g |rut"|}||# $d
 W d   n	1 snw   Y  q8|
| q8|g d6 | j%r|
d7d| j%  | j&r|dd8g || j& |S )9ziGenerate the text of an RPM spec file and return it as a
        list of strings (one per line).
        z%define name z%define version -_z%define unmangled_version z%define release  z	Summary: zrpm --eval %{__os_install_post}
c                 S   s   g | ]}d |   qS )z  %s \)rz   ).0r   r=   r=   r>   
<listcomp>  s    z-bdist_rpm._make_spec_file.<locals>.<listcomp>zbrp-python-bytecompile \
z%brp-python-bytecompile %{__python} \
z2# Workaround for http://bugs.python.org/issue14443z%define __os_install_post )zName: %{name}zVersion: %{version}zRelease: %{release}z-Source0: %{name}-%{unmangled_version}.tar.bz2z,Source0: %{name}-%{unmangled_version}.tar.gzz	License: zGroup: z>BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootzPrefix: %{_prefix}zBuildArch: noarchzBuildArch: %s)VendorPackagerProvidesRequires	Conflicts	Obsoletesz%s: %s NUNKNOWNzUrl: zDistribution: zBuildRequires: zIcon: z
AutoReq: 0z%descriptionz%s %sr   z%s buildzenv CFLAGS="$RPM_OPT_FLAGS" z>%s install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES)r0   r'   z&%setup -n %{name}-%{unmangled_version}buildr(   installr)   )cleanr*   zrm -rf $RPM_BUILD_ROOT)verifyscriptr+   N)prer,   N)postr-   N)preunr.   N)postunr/   N%)r   z%files -f INSTALLED_FILESz%defattr(-,root,root)z%doc z
%changelog)'rM   rk   get_versionreplacer    get_description
subprocess	getoutputrH   
splitlinesrZ   rv   r   get_licenser   r:   rN   getattrlowerrW   rX   get_urlr   r4   r&   rF   rG   r   r9   get_long_descriptionr   rI   argvr7   openreadr{   r$   r%   )r<   	spec_filevendor_hookproblemfixed
fixed_hookfieldvaldef_setup_call	def_buildinstall_cmdscript_optionsrpm_optattrdefaultfr=   r=   r>   rm     s   


	








zbdist_rpm._make_spec_filec                 C   s|   |s|S g }|  dD ]'}|  }|d dkr!|d|g q|d dkr-|| q|d|  q|d s<|d= |S )zKFormat the changelog correctly and convert it to a list of strings
        r   r   r   r   r   z  )rz   r{   rv   rZ   )r<   r%   new_changelogr   r=   r=   r>   r[   0  s   zbdist_rpm._format_changelogN)__name__
__module____qualname__descriptionuser_optionsboolean_optionsnegative_optr?   rP   rO   r   r   rm   r[   r=   r=   r=   r>   r      s"    m--  *r   )__doc__r   rI   rF   distutils.corer   distutils.debugr   distutils.file_utilr   distutils.errorsdistutils.sysconfigr   	distutilsr   r   r=   r=   r=   r>   <module>   s    PK       ! e1l8  l8  !  __pycache__/sdist.cpython-310.pycnu [        o
    bc=J                     @   s   d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZmZ dd ZG dd deZdS )zadistutils.command.sdist

Implements the Distutils 'sdist' command (create a source distribution).    N)glob)warn)Command)dir_util)	file_util)archive_util)TextFile)FileList)log)convert_path)DistutilsTemplateErrorDistutilsOptionErrorc                  C   s`   ddl m}  ddlm} g }| D ]}|d| d|| d f q|  | |d dS )zoPrint all possible values for the 'formats' option (used by
    the "--help-formats" command-line option).
    r   )FancyGetopt)ARCHIVE_FORMATSformats=N   z.List of available source distribution formats:)distutils.fancy_getoptr   distutils.archive_utilr   keysappendsort
print_help)r   r   formatsformat r   ./usr/lib/python3.10/distutils/command/sdist.pyshow_formats   s   
r   c                   @   s  e Zd ZdZdd Zg dZg dZdddefgZd	d
dZ	defgZ
dZdd Zdd Zdd Zdd Zdd Zdd Zedd Zdd Zdd Zd d! Zd"d# Zd$d% Zd&d' Zd(d) Zd*d+ Zd,d- Zd.d/ Zd0d1 Zd2d3 Zd4d5 Z d6d7 Z!d8d9 Z"dS ):sdistz6create a source distribution (tarball, zip file, etc.)c                 C      | j S )zYCallable used for the check sub-command.

        Placed here so user_options can view it)metadata_checkselfr   r   r   checking_metadata(      zsdist.checking_metadata))z	template=tz5name of manifest template file [default: MANIFEST.in])z	manifest=mz)name of manifest file [default: MANIFEST])use-defaultsNzRinclude the default file set in the manifest [default; disable with --no-defaults])no-defaultsNz"don't include the default file set)pruneNzspecifically exclude files/directories that should not be distributed (build tree, RCS/CVS dirs, etc.) [default; disable with --no-prune])no-pruneNz$don't automatically exclude anything)manifest-onlyozEjust regenerate the manifest and then stop (implies --force-manifest))force-manifestfzkforcibly regenerate the manifest and carry on as usual. Deprecated: now the manifest is always regenerated.)r   Nz6formats for source distribution (comma-separated list))	keep-tempkz@keep the distribution tree around after creating archive file(s))z	dist-dir=dzFdirectory to put the source distribution archive(s) in [default: dist])metadata-checkNz[Ensure that all required elements of meta-data are supplied. Warn if any missing. [default])zowner=uz@Owner name used when creating a tar file [default: current user])zgroup=gzAGroup name used when creating a tar file [default: current group])r&   r(   r*   r,   r.   r1   zhelp-formatsNz#list available distribution formatsr&   r(   )r'   r)   check)READMEz
README.txtz
README.rstc                 C   sT   d | _ d | _d| _d| _d| _d| _dg| _d| _d | _d | _	d| _
d | _d | _d S )N   r   gztar)templatemanifestuse_defaultsr(   manifest_onlyforce_manifestr   	keep_tempdist_dirarchive_filesr   ownergroupr    r   r   r   initialize_optionse   s   
zsdist.initialize_optionsc                 C   s^   | j d u rd| _ | jd u rd| _| d t| j}|r#td| | jd u r-d| _d S d S )NMANIFESTzMANIFEST.inr   zunknown archive format '%s'dist)r9   r8   ensure_string_listr   check_archive_formatsr   r   r>   )r!   
bad_formatr   r   r   finalize_options|   s   




zsdist.finalize_optionsc                 C   s>   t  | _|  D ]}| | q|   | jrd S |   d S N)r	   filelistget_sub_commandsrun_commandget_file_listr;   make_distribution)r!   cmd_namer   r   r   run   s   z	sdist.runc                 C   s*   t dt | jd}|  |  dS )zDeprecated API.zadistutils.command.sdist.check_metadata is deprecated,               use the check command insteadr4   N)r   PendingDeprecationWarningdistributionget_command_objensure_finalizedrP   )r!   r4   r   r   r   check_metadata   s   zsdist.check_metadatac                 C   s   t j| j}|s|  r|   | j  | j  dS |s'| 	d| j  | j
  | jr3|   |r9|   | jr@|   | j  | j  |   dS )aC  Figure out the list of files to include in the source
        distribution, and put it in 'self.filelist'.  This might involve
        reading the manifest template (and writing the manifest), or just
        reading the manifest, or just using the default file set -- it all
        depends on the user's options.
        Nz?manifest template '%s' does not exist (using default file list))ospathisfiler8   _manifest_is_not_generatedread_manifestrJ   r   remove_duplicatesr   findallr:   add_defaultsread_templater(   prune_file_listwrite_manifest)r!   template_existsr   r   r   rM      s(   




zsdist.get_file_listc                 C   s<   |    |   |   |   |   |   |   dS )a9  Add all the default files to self.filelist:
          - README or README.txt
          - setup.py
          - test/test*.py
          - all pure Python modules mentioned in setup script
          - all files pointed by package_data (build_py)
          - all files defined in data_files.
          - all files defined as scripts.
          - all C sources listed as part of extensions or C libraries
            in the setup script (doesn't catch C headers!)
        Warns if (README or README.txt) or setup.py are missing; everything
        else is optional.
        N)_add_defaults_standards_add_defaults_optional_add_defaults_python_add_defaults_data_files_add_defaults_ext_add_defaults_c_libs_add_defaults_scriptsr    r   r   r   r]      s   zsdist.add_defaultsc                 C   s:   t j| sdS t j| }t j|\}}|t |v S )z
        Case-sensitive path existence check

        >>> sdist._cs_path_exists(__file__)
        True
        >>> sdist._cs_path_exists(__file__.upper())
        False
        F)rV   rW   existsabspathsplitlistdir)fspathrj   	directoryfilenamer   r   r   _cs_path_exists   s
   
zsdist._cs_path_existsc                 C   s   | j | jjg}|D ]?}t|tr5|}d}|D ]}| |r'd}| j|  nq|s4| dd	|  q	| |rA| j| q	| d|  q	d S )NFTz,standard file not found: should have one of z, zstandard file '%s' not found)
READMESrR   script_name
isinstancetuplerp   rJ   r   r   join)r!   	standardsfnaltsgot_itr   r   r   rb      s(   


zsdist._add_defaults_standardsc                 C   s4   ddg}|D ]}t tjjt|}| j| qd S )Nztest/test*.pyz	setup.cfg)filterrV   rW   rX   r   rJ   extend)r!   optionalpatternfilesr   r   r   rc     s
   zsdist._add_defaults_optionalc                 C   s\   |  d}| j r| j|  |jD ]\}}}}|D ]}| jtj	
|| qqd S )Nbuild_py)get_finalized_commandrR   has_pure_modulesrJ   r{   get_source_files
data_filesr   rV   rW   ru   )r!   r   pkgsrc_dir	build_dir	filenamesro   r   r   r   rd     s   

zsdist._add_defaults_pythonc                 C   s~   | j  r;| j jD ]3}t|tr!t|}tj|r | j	
| q	|\}}|D ]}t|}tj|r9| j	
| q'q	d S d S rI   )rR   has_data_filesr   rs   strr   rV   rW   rX   rJ   r   )r!   itemdirnamer   r-   r   r   r   re   $  s    

zsdist._add_defaults_data_filesc                 C   ,   | j  r| d}| j|  d S d S )N	build_ext)rR   has_ext_modulesr   rJ   r{   r   )r!   r   r   r   r   rf   5     

zsdist._add_defaults_extc                 C   r   )N
build_clib)rR   has_c_librariesr   rJ   r{   r   )r!   r   r   r   r   rg   :  r   zsdist._add_defaults_c_libsc                 C   r   )Nbuild_scripts)rR   has_scriptsr   rJ   r{   r   )r!   r   r   r   r   rh   ?  r   zsdist._add_defaults_scriptsc              
   C   s   t d| j t| jddddddd}z;	 | }|du rn*z| j| W n  ttfyF } z| 	d|j
|j|f  W Y d}~nd}~ww qW |  dS |  w )zRead and parse manifest template file named by self.template.

        (usually "MANIFEST.in") The parsing and processing is done by
        'self.filelist', which updates itself accordingly.
        zreading manifest template '%s'r6   )strip_commentsskip_blanks
join_lines	lstrip_ws	rstrip_wscollapse_joinTNz%s, line %d: %s)r
   infor8   r   readlinerJ   process_template_liner   
ValueErrorr   ro   current_lineclose)r!   r8   linemsgr   r   r   r^   D  s,   

zsdist.read_templatec                 C   sz   |  d}| j }| jjd|jd | jjd|d tjdkr#d}nd}g d}d|d	||f }| jj|d
d dS )av  Prune off branches that might slip into the file list as created
        by 'read_template()', but really don't belong there:
          * the build tree (typically "build")
          * the release tree itself (only an issue if we ran "sdist"
            previously with --keep-temp, or it aborted)
          * any RCS, CVS, .svn, .hg, .git, .bzr, _darcs directories
        buildN)prefixwin32z/|\\/)RCSCVSz\.svnz\.hgz\.gitz\.bzr_darcsz(^|%s)(%s)(%s).*|r6   )is_regex)	r   rR   get_fullnamerJ   exclude_pattern
build_basesysplatformru   )r!   r   base_dirsepsvcs_dirsvcs_ptrnr   r   r   r_   a  s   


zsdist.prune_file_listc                 C   sX   |   rtd| j  dS | jjdd }|dd | tj	| j|fd| j  dS )zWrite the file list in 'self.filelist' (presumably as filled in
        by 'add_defaults()' and 'read_template()') to the manifest file
        named by 'self.manifest'.
        z5not writing to manually maintained manifest file '%s'Nr   z*# file GENERATED by distutils, do NOT editzwriting manifest file '%s')
rY   r
   r   r9   rJ   r~   insertexecuter   
write_file)r!   contentr   r   r   r`   y  s   zsdist.write_manifestc                 C   sB   t j| js	dS t| j}z| }W |  |dkS |  w )NFz+# file GENERATED by distutils, do NOT edit
)rV   rW   rX   r9   openr   r   )r!   fp
first_liner   r   r   rY     s   


z sdist._manifest_is_not_generatedc                 C   sl   t d| j t| j }|D ]}| }|ds|sq| j| qW d   dS 1 s/w   Y  dS )zRead the manifest file (named by 'self.manifest') and use it to
        fill in 'self.filelist', the list of files to include in the source
        distribution.
        zreading manifest file '%s'#N)r
   r   r9   r   strip
startswithrJ   r   )r!   r9   r   r   r   r   rZ     s   "zsdist.read_manifestc                 C   s   |  | tj||| jd ttdrd}d| }nd}d| }|s(td nt| |D ]}tj	
|s>td| q/tj	||}| j|||d	 q/| jj| dS )
a  Create the directory tree that will become the source
        distribution archive.  All directories implied by the filenames in
        'files' are created under 'base_dir', and then we hard link or copy
        (if hard linking is unavailable) those files into place.
        Essentially, this duplicates the developer's source tree, but in a
        directory named after the distribution, containing only the files
        to be distributed.
        dry_runlinkhardzmaking hard links in %s...Nzcopying files to %s...z)no files to distribute -- empty manifest?z#'%s' not a regular file -- skipping)r   )mkpathr   create_treer   hasattrrV   r
   r   r   rW   rX   ru   	copy_filerR   metadatawrite_pkg_info)r!   r   r~   r   r   filedestr   r   r   make_release_tree  s    

	

zsdist.make_release_treec                 C   s   | j  }tj| j|}| || jj g }d| j	v r*| j	
| j	| j	d | j	D ]}| j|||| j| jd}|
| | j j
dd|f q-|| _| js[tj|| jd dS dS )a  Create the source distribution(s).  First, we create the release
        tree with 'make_release_tree()'; then, we create all required
        archive files (according to 'self.formats') from the release tree.
        Finally, we clean up by blowing away the release tree (unless
        'self.keep_temp' is true).  The list of archive files created is
        stored so it can be retrieved later by 'get_archive_files()'.
        tar)r   r@   rA   r    r   N)rR   r   rV   rW   ru   r>   r   rJ   r~   r   r   popindexmake_archiver@   rA   
dist_filesr?   r=   r   remove_treer   )r!   r   	base_namer?   fmtr   r   r   r   rN     s    





zsdist.make_distributionc                 C   r   )zzReturn the list of archive files created when the command
        was run, or None if the command hasn't run yet.
        )r?   r    r   r   r   get_archive_files  r#   zsdist.get_archive_files)#__name__
__module____qualname__descriptionr"   user_optionsboolean_optionsr   help_optionsnegative_optsub_commandsrq   rB   rH   rP   rU   rM   r]   staticmethodrp   rb   rc   rd   re   rf   rg   rh   r^   r_   r`   rY   rZ   r   rN   r   r   r   r   r   r   $   sJ    '
(
*r   )__doc__rV   r   r   warningsr   distutils.corer   	distutilsr   r   r   distutils.text_filer   distutils.filelistr	   r
   distutils.utilr   distutils.errorsr   r   r   r   r   r   r   r   <module>   s     PK       ! u    &  __pycache__/bdist_dumb.cpython-310.pycnu [        o
    bc1                     @   sh   d Z ddlZddlmZ ddlmZ ddlmZmZ ddl	T ddl
mZ ddlmZ G d	d
 d
eZdS )zdistutils.command.bdist_dumb

Implements the Distutils 'bdist_dumb' command (create a "dumb" built
distribution -- i.e., just an archive to be unpacked under $prefix or
$exec_prefix).    N)Command)get_platform)remove_treeensure_relative)*)get_python_version)logc                	   @   s\   e Zd ZdZdddde  fdddd	d
ddg	Zg dZdddZdd Zdd Z	dd Z
dS )
bdist_dumbz"create a "dumb" built distribution)z
bdist-dir=dz1temporary directory for creating the distributionz
plat-name=pz;platform name to embed in generated filenames (default: %s))zformat=fz>archive format to create (tar, gztar, bztar, xztar, ztar, zip))	keep-tempkzPkeep the pseudo-installation tree around after creating the distribution archive)z	dist-dir=r
   z-directory to put final built distributions in)
skip-buildNz2skip rebuilding everything (for testing/debugging))relativeNz7build the archive using relative paths (default: false))zowner=uz@Owner name used when creating a tar file [default: current user])zgroup=gzAGroup name used when creating a tar file [default: current group])r   r   r   gztarzip)posixntc                 C   s:   d | _ d | _d | _d| _d | _d | _d| _d | _d | _d S )Nr   )		bdist_dir	plat_nameformat	keep_tempdist_dir
skip_buildr   ownergroup)self r    3/usr/lib/python3.10/distutils/command/bdist_dumb.pyinitialize_options2   s   
zbdist_dumb.initialize_optionsc                 C   st   | j d u r| dj}tj|d| _ | jd u r0z	| jtj | _W n t	y/   t
dtj w | dddd d S )Nbdistdumbz@don't know how to create dumb built distributions on platform %s)r   r   )r   r   )r   r   )r   get_finalized_command
bdist_baseospathjoinr   default_formatnameKeyErrorDistutilsPlatformErrorset_undefined_options)r   r&   r    r    r!   finalize_options=   s$   

zbdist_dumb.finalize_optionsc                 C   s(  | j s| d | jddd}| j|_| j |_ d|_td| j | d d| j	 | j
f }tj| j|}| js?| j}n$| j rX|j|jkrXtdt|jt|jf tj| jt|j}| j|| j|| j| jd	}| j ryt }nd
}| jjd||f | jst| j| jd d S d S )Nbuildinstall   )reinit_subcommandsr   zinstalling to %sz%s.%szScan't make a dumb built distribution where base and platbase are different (%s, %s))root_dirr   r   anyr	   )dry_run) r   run_commandreinitialize_commandr   rootwarn_dirr   infodistributionget_fullnamer   r'   r(   r)   r   r   has_ext_modulesinstall_baseinstall_platbaser-   reprr   make_archiver   r   r   r   
dist_filesappendr   r   r6   )r   r1   archive_basenamepseudoinstall_rootarchive_rootfilename	pyversionr    r    r!   runO   sN   





zbdist_dumb.runN)__name__
__module____qualname__descriptionr   user_optionsboolean_optionsr*   r"   r/   rJ   r    r    r    r!   r	      s.    r	   )__doc__r'   distutils.corer   distutils.utilr   distutils.dir_utilr   r   distutils.errorsdistutils.sysconfigr   	distutilsr   r	   r    r    r    r!   <module>   s    PK       ! X|  |  '  __pycache__/install_lib.cpython-310.pycnu [        o
    bc!                     @   sL   d Z ddlZddlZddlZddlmZ ddlmZ dZ	G dd deZ
dS )zkdistutils.command.install_lib

Implements the Distutils 'install_lib' command
(install all Python modules).    N)Command)DistutilsOptionErrorz.pyc                   @   sx   e Zd ZdZg dZg dZddiZdd Zdd	 Zd
d Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd ZdS )install_libz7install all Python modules (extensions and pure Python)))zinstall-dir=dzdirectory to install to)z
build-dir=bz'build directory (where to install from))forcefz-force installation (overwrite existing files))compileczcompile .py to .pyc [default])
no-compileNzdon't compile .py files)z	optimize=Ozlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])
skip-buildNzskip the build steps)r   r	   r   r   r	   c                 C   s.   d | _ d | _d| _d | _d | _d | _d | _d S )Nr   )install_dir	build_dirr   r	   optimize
skip_build	multiarchself r   4/usr/lib/python3.10/distutils/command/install_lib.pyinitialize_options3   s   
zinstall_lib.initialize_optionsc              
   C   s   |  dddddddd | jd u rd	| _| jd u rd
| _t| jts@zt| j| _| jdvr0tW d S  ttfy?   tdw d S )Ninstall)	build_libr   )r   r   )r   r   )r	   r	   )r   r   )r   r   )r   r   TF)r         zoptimize must be 0, 1, or 2)set_undefined_optionsr	   r   
isinstanceintAssertionError
ValueErrorr   r   r   r   r   finalize_options=   s.   



zinstall_lib.finalize_optionsc                 C   s8   |    |  }|d ur| j r| | d S d S d S N)buildr   distributionhas_pure_modulesbyte_compile)r   outfilesr   r   r   runX   s
   zinstall_lib.runc                 C   s:   | j s| j r| d | j r| d d S d S d S )Nbuild_py	build_ext)r   r$   r%   run_commandhas_ext_modulesr   r   r   r   r#   h   s   


zinstall_lib.buildc                 C   sH   t j| jrdd l}| j|j_| | j| j	}|S | 
d| j  d S )Nr   z3'%s' does not exist -- no Python modules to install)ospathisdirr   distutils.dir_utilr   dir_util
_multiarch	copy_treer   warn)r   	distutilsr'   r   r   r   r   o   s   
zinstall_lib.installc                 C   sv   t jr
| d d S ddlm} | dj}| jr$||d| j|| j	d | j
dkr9||| j
| j|| j| j	d d S d S )Nz%byte-compiling is disabled, skipping.r   )r&   r   )r   r   prefixdry_run)r   r   r6   verboser7   )sysdont_write_bytecoder4   distutils.utilr&   get_finalized_commandrootr	   r   r7   r   r8   )r   filesr&   install_rootr   r   r   r&   z   s    


zinstall_lib.byte_compilec           
   	   C   sd   |sg S |  |}| }t||}t|ttj }g }|D ]}	|tj||	|d   q|S r"   )	r<   get_outputsgetattrlenr-   sepappendr.   join)
r   has_any	build_cmd
cmd_option
output_dirbuild_filesr   
prefix_lenoutputsfiler   r   r   _mutate_outputs   s   

zinstall_lib._mutate_outputsc                 C   sr   g }|D ]2}t jt j|d }|tkrq| jr%|tjj	|dd | j
dkr6|tjj	|| j
d q|S )Nr    )optimizationr   )r-   r.   splitextnormcasePYTHON_SOURCE_EXTENSIONr	   rD   	importlibutilcache_from_sourcer   )r   py_filenamesbytecode_filespy_fileextr   r   r   _bytecode_filenames   s   


zinstall_lib._bytecode_filenamesc                 C   sR   |  | j dd| j}| jr| |}ng }|  | j dd| j}|| | S )zReturn the list of files that would be installed if this command
        were actually run.  Not affected by the "dry-run" flag or whether
        modules have actually been built yet.
        r)   r   r*   )rN   r$   r%   r   r	   r[   r,   )r   pure_outputsbytecode_outputsext_outputsr   r   r   r@      s   zinstall_lib.get_outputsc                 C   sL   g }| j  r| d}||  | j  r$| d}||  |S )zGet the list of files that are input to this command, ie. the
        files that get installed as they are named in the build tree.
        The files in this list correspond one-to-one to the output
        filenames returned by 'get_outputs()'.
        r)   r*   )r$   r%   r<   extendr@   r,   )r   inputsr)   r*   r   r   r   
get_inputs   s   



zinstall_lib.get_inputsN)__name__
__module____qualname__descriptionuser_optionsboolean_optionsnegative_optr   r!   r(   r#   r   r&   rN   r[   r@   ra   r   r   r   r   r      s    
r   )__doc__r-   importlib.utilrT   r9   distutils.corer   distutils.errorsr   rS   r   r   r   r   r   <module>   s    PK       ! _]nY  Y  !  __pycache__/check.cpython-310.pycnu [        o
    bc                     @   s   d Z ddlmZ ddlmZ z$ddlmZ ddlmZ ddl	m
Z
 ddl	mZ G dd	 d	eZd
ZW n ey=   dZY nw G dd deZdS )zCdistutils.command.check

Implements the Distutils 'check' command.
    )Command)DistutilsSetupError)Reporter)Parser)frontend)nodesc                   @   s"   e Zd Z		d	ddZdd ZdS )
SilentReporterNr   asciireplacec              
   C   s"   g | _ t| ||||||| d S N)messagesr   __init__)selfsourcereport_level
halt_levelstreamdebugencodingerror_handler r   ./usr/lib/python3.10/distutils/command/check.pyr      s   zSilentReporter.__init__c                 O   s8   | j ||||f tj|g|R || j| d|S )N)leveltype)r   appendr   system_messagelevels)r   r   messagechildrenkwargsr   r   r   r      s   zSilentReporter.system_message)Nr   r	   r
   )__name__
__module____qualname__r   r   r   r   r   r   r      s
    
r   TFc                   @   s\   e Zd ZdZdZg dZg dZdd Zdd Zd	d
 Z	dd Z
dd Zdd Zdd ZdS )checkz6This command checks the meta-data of the package.
    z"perform some checks on the package))metadatamzVerify meta-data)restructuredtextrzEChecks if long string meta-data syntax are reStructuredText-compliant)strictsz(Will exit with an error if a check fails)r$   r&   r(   c                 C   s   d| _ d| _d| _d| _dS )z Sets default values for options.r      N)r&   r$   r(   	_warningsr   r   r   r   initialize_options0   s   
zcheck.initialize_optionsc                 C   s   d S r   r   r,   r   r   r   finalize_options7   s   zcheck.finalize_optionsc                 C   s   |  j d7  _ t| |S )z*Counts the number of warnings that occurs.r*   )r+   r   warn)r   msgr   r   r   r/   :   s   z
check.warnc                 C   sP   | j r|   | jrtr|   n| jrtd| jr$| jdkr&tddS dS )zRuns the command.zThe docutils package is needed.r   zPlease correct your package.N)r$   check_metadatar&   HAS_DOCUTILScheck_restructuredtextr(   r   r+   r,   r   r   r   run?   s   
z	check.runc                 C   s   | j j}g }dD ]}t||rt||s|| q|r&| dd|  |jr5|js3| d dS dS |j	rD|j
sB| d dS dS | d dS )a
  Ensures that all required elements of meta-data are supplied.

        Required fields:
            name, version, URL

        Recommended fields:
            (author and author_email) or (maintainer and maintainer_email)

        Warns if any are missing.
        )nameversionurlzmissing required meta-data: %sz, zNmissing meta-data: if 'author' supplied, 'author_email' should be supplied toozVmissing meta-data: if 'maintainer' supplied, 'maintainer_email' should be supplied toozkmissing meta-data: either (author and author_email) or (maintainer and maintainer_email) should be suppliedN)distributionr$   hasattrgetattrr   r/   joinauthorauthor_email
maintainermaintainer_email)r   r$   missingattrr   r   r   r1   O   s"   
zcheck.check_metadatac                 C   sX   | j  }| |D ]}|d d}|du r|d }nd|d |f }| | q
dS )z4Checks if the long string fields are reST-compliant.lineNr*   z%s (line %s))r8   get_long_description_check_rst_datagetr/   )r   datawarningrC   r   r   r   r3   p   s   

zcheck.check_restructuredtextc              
   C   s   | j jpd}t }tjtfd }d|_d|_d|_t	||j
|j|j|j|j|jd}tj|||d}||d z
||| W |jS  tyd } z|jdd| d	i f W Y d}~|jS d}~ww )
z8Returns warnings when the provided data doesn't compile.zsetup.py)
components   N)r   r   r   r   )r   rB   z!Could not finish the parsing: %s. )r8   script_namer   r   OptionParserget_default_values	tab_widthpep_referencesrfc_referencesr   r   r   warning_streamr   error_encodingerror_encoding_error_handlerr   documentnote_sourceparseAttributeErrorr   r   )r   rG   source_pathparsersettingsreporterrU   er   r   r   rE   {   s4   zcheck._check_rst_dataN)r    r!   r"   __doc__descriptionuser_optionsboolean_optionsr-   r.   r/   r4   r1   r3   rE   r   r   r   r   r#   #   s    !r#   N)r^   distutils.corer   distutils.errorsr   docutils.utilsr   docutils.parsers.rstr   docutilsr   r   r   r2   	Exceptionr#   r   r   r   r   <module>   s    PK       ! i:  :  #  __pycache__/install.cpython-310.pycnu [        o
    bcRx                  
   @   s  d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZ ddlmZ dd	lmZmZmZ dd
lmZ ddlmZ ddlmZ ddlmZ eduZdZi i i dZdddddddddd	ed< dddddddddd	ed< eD ]"Zd D ]\ZZ eZ!ej"e  Z#ed!kree#vrd"Z!e#e! ee e< qqeD ]=Z$ee$ % D ]4\ZZ&e'd#d$e&Z&e&(d%d&Z&e&(d'd(Z&ed!kre&d)7 Z&ej)d*kred+kre&(d,d-Z&e&ee$ e< qqerd.d.d/d0d1ded2< d.d.d3d4d1ded5< G d6d7 d7eZ*dS )8zFdistutils.command.install

Implements the Distutils 'install' command.    N)log)Command)DEBUG)get_config_varsis_virtual_environment)DistutilsPlatformError)
write_file)convert_path
subst_varschange_root)get_platform)DistutilsOptionError)	USER_BASE)	USER_SITE)purelibplatlibheadersscriptsdata)unix_prefix	unix_homentz6{installed_base}/{platlibdir}/python{py_version_short}z0{platbase}/{platlibdir}/python{py_version_short}z7{base}/local/lib/python{py_version_short}/dist-packageszD{platbase}/local/{platlibdir}/python{py_version_short}/dist-packagesz;{installed_base}/include/python{py_version_short}{abiflags}z7{base}/local/include/python{py_version_short}{abiflags}z?{installed_platbase}/include/python{py_version_short}{abiflags}z{base}/local/binz{base}/local)	stdlib
platstdlibr   r   includer   platincluder   r   
unix_localz {base}/lib/python3/dist-packagesz-{platbase}/{platlibdir}/python3/dist-packagesz
{base}/binz{base}
deb_system))r   posix_prefix)r   
posix_home)r   r   r   r   z	\{(.+?)\}z$\g<1>z$installed_basez$basez$py_version_nodot_platz$py_version_nodotz/$dist_name)   	   r   z/lib/z/$platlibdir/z	$usersitez4$userbase/Python$py_version_nodot/Include/$dist_namez)$userbase/Python$py_version_nodot/Scriptsz	$userbasent_userz=$userbase/include/python$py_version_short$abiflags/$dist_namez$userbase/bin	unix_userc                   @   s  e Zd ZdZg dZg dZereddde f ed ddiZ	d	d
 Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Zd3efd4efd5efd6efd7d8d9 fgZdS ):installz'install everything from build directory))zprefix=Nzinstallation prefix)zexec-prefix=Nz.(Unix only) prefix for platform-specific files)zhome=Nz+(Unix only) home directory to install under)zinstall-base=Nz;base installation directory (instead of --prefix or --home))zinstall-platbase=Nz\base installation directory for platform-specific files (instead of --exec-prefix or --home))zroot=Nz<install everything relative to this alternate root directory)zinstall-purelib=Nz;installation directory for pure Python module distributions)zinstall-platlib=Nz8installation directory for non-pure module distributions)zinstall-lib=Nzginstallation directory for all module distributions (overrides --install-purelib and --install-platlib))zinstall-headers=Nz(installation directory for C/C++ headers)zinstall-scripts=Nz)installation directory for Python scripts)zinstall-data=Nz%installation directory for data files)compileczcompile .py to .pyc [default])
no-compileNzdon't compile .py files)z	optimize=Ozlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])forcefz1force installation (overwrite any existing files))
skip-buildNz2skip rebuilding everything (for testing/debugging))zrecord=Nz3filename in which to record list of installed files)zinstall-layout=Nz7installation layout to choose (known values: deb, unix))r%   r)   r+   userNz!install in user site-package '%s'r'   r%   c                 C   s   d| _ d| _d| _d| _d| _d| _d| _d| _d| _d| _	d| _
d| _d| _d| _tr2t| _t| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _dS )zInitializes options.Nr      )prefixexec_prefixhomer,   prefix_optioninstall_baseinstall_platbaserootinstall_purelibinstall_platlibinstall_headersinstall_libinstall_scriptsinstall_dataHAS_USER_SITEr   install_userbaser   install_usersiteinstall_layout	multiarchr%   optimize
extra_pathinstall_path_filer)   
skip_buildwarn_dir
build_base	build_librecordself rJ   0/usr/lib/python3.10/distutils/command/install.pyinitialize_options   s:   
zinstall.initialize_optionsc                 C   s  | j s	| js	| jr| js| jrtd| jr | j s| jr td| jr6| j s2| js2| js2| js2| jr6tdtjdkrF| jrF| 	d d| _| 
d tjdkrU|   n|   | 
d tj d	 }td
d\}}ztj}W n ty|   d}Y nw | j | j | j |dtjdd  dtjdd  |||||tjd| _tr| j| jd< | j| jd< tdrtd| jd< |    | 
d | j| jd< | j| jd< t!rd	dl"m"} t#d || j | $  | 
d | jr| %  | j&du r
| jj'r| j(| _&n| j)| _&| *dddddd  tr| *dd | +  | j&| _,tj-.| j&| j/| _&| j0dur@| 1d!dddddd  | 
d" | 2d#d$d% dS )&zFinalizes options.zWmust supply either prefix/exec-prefix/home or install-base/install-platbase -- not bothz9must supply either home or prefix/exec-prefix -- not bothzGcan't combine user with prefix, exec_prefix/home, or install_(plat)baseposixz+exec-prefix option ignored on this platformNzpre-finalize_{unix,other}zpost-finalize_{unix,other}()r   r.   r/    z%d.%d   z%d%d)	dist_namedist_versiondist_fullname
py_versionpy_version_shortpy_version_nodot
sys_prefixr.   sys_exec_prefixr/   abiflags
platlibdiruserbaseusersiteTsrcdirzpost-expand_basedirs()baseplatbase)pprintzconfig vars:zpost-expand_dirs()libr   r   r   r   r   libbasezafter prepending rootbuild)rE   rE   )rF   rF   )3r.   r/   r0   r2   r3   r   r,   osnamewarn	dump_dirsfinalize_unixfinalize_othersysversionsplitr   rX   AttributeErrordistributionget_nameget_versionget_fullnameversion_inforY   config_varsr;   r<   r=   	sysconfigis_python_buildget_config_varexpand_basedirsr   r_   printexpand_dirscreate_home_pathr8   ext_modulesr6   r5   convert_pathshandle_extra_pathinstall_libbasepathjoin
extra_dirsr4   change_rootsset_undefined_options)rI   rS   r.   r/   rX   r_   rJ   rJ   rK   finalize_options  s   















zinstall.finalize_optionsc                 C   s   t sdS ddlm} t|d  | jD ]9}|d }|d dkr&|dd }|| jv r<| j| }||}t| | }n
||}t| |}td|| qdS )zDumps the list of user options.Nr   )longopt_xlate:=z  %s: %s)	r   distutils.fancy_getoptr   r   debuguser_optionsnegative_opt	translategetattr)rI   msgr   optopt_namevalrJ   rJ   rK   rf     s    





zinstall.dump_dirsc                 C   s  | j dus
| jdur.| jdu r| jdu r| jdu s(| jdu s(| jdu s(| jdu r,tddS | j	rH| j
du r:td| j
 | _ | _| d dS | jdur[| j | _ | _| d dS | j| _| jdu r~| jdurmtdtjtj| _tjtj| _n	| jdu r| j| _| j| _ | j| _| jr| j dv rddl}|d	| _| d
 dS | j dv r| d dS td| jrtj| jdkst r| d dS tj| jdkrd | _| _d | _ | _| d dS )z&Finalizes options for posix platforms.NzPinstall-base or install-platbase supplied, but installation scheme is incomplete$User base directory is not specifiedr#   r   z*must not supply exec-prefix without prefix)debr   	MULTIARCHr   )unixr   z"unknown value for --install-layoutz
/usr/localz/usrr   )r2   r3   r8   r5   r6   r7   r9   r:   r   r,   r<   r   select_schemer0   r.   r1   r/   rc   r~   normpathri   r>   lowerrs   ru   r?   r   )rI   rs   rJ   rJ   rK   rg     sh   










zinstall.finalize_unixc                 C   s   | j r| jdu rtd| j | _| _| tjd  dS | jdur0| j | _| _| d dS | j	du r=tj
tj	| _	| j	 | _| _z	| tj W dS  ty[   tdtj w )z)Finalizes options for non-posix platformsNr   _userr   z)I don't know how to install stuff on '%s')r,   r<   r   r2   r3   r   rc   rd   r0   r.   r~   r   ri   KeyErrorrH   rJ   rJ   rK   rh     s(   


zinstall.finalize_otherc                 C   s<   t | }tD ]}d| }t| |du rt| |||  qdS )z=Sets the install directories by applying the install schemes.install_N)INSTALL_SCHEMESSCHEME_KEYSr   setattr)rI   rd   schemekeyattrnamerJ   rJ   rK   r     s   zinstall.select_schemec                 C   sX   |D ]'}t | |}|d ur)tjdkstjdkrtj|}t|| j}t| || qd S )NrM   r   )r   rc   rd   r~   
expanduserr
   rr   r   )rI   attrsattrr   rJ   rJ   rK   _expand_attrs  s   
zinstall._expand_attrsc                 C      |  g d dS )zNCalls `os.path.expanduser` on install_base, install_platbase and
        root.)r2   r3   r4   Nr   rH   rJ   rJ   rK   rv   "  s   zinstall.expand_basedirsc                 C   r   )z+Calls `os.path.expanduser` on install dirs.)r5   r6   r8   r7   r9   r:   Nr   rH   rJ   rJ   rK   rx   '  s   zinstall.expand_dirsc                 G   s,   |D ]}d| }t | |tt| | qdS )z!Call `convert_path` over `names`.r   N)r   r	   r   rI   namesrd   r   rJ   rJ   rK   r{   -  s   zinstall.convert_pathsc                 C   s   | j du r
| jj | _ | j durFtd t| j tr!| j d| _ t| j dkr0| j d  }}nt| j dkr=| j \}}ntdt	|}nd}d}|| _
|| _dS )	z4Set `path_file` and `extra_dirs` using `extra_path`.NzIDistribution option extra_path is deprecated. See issue27919 for details.,r-   r   rO   zY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementsrN   )rA   rm   r   re   
isinstancestrrk   lenr   r	   	path_filer   )rI   r   r   rJ   rJ   rK   r|   3  s(   




zinstall.handle_extra_pathc              	   G   s0   |D ]}d| }t | |t| jt| | qdS )z:Change the install directories pointed by name using root.r   N)r   r   r4   r   r   rJ   rJ   rK   r   U  s   zinstall.change_rootsc                 C   sb   | j sdS ttjd}| j D ]\}}||r.tj|s.| 	d|  t
|d qdS )zCreate directories under ~.N~zos.makedirs('%s', 0o700)i  )r,   r	   rc   r~   r   rr   items
startswithisdirdebug_printmakedirs)rI   r0   rd   r~   rJ   rJ   rK   ry   [  s   zinstall.create_home_pathc                 C   s&  | j s| d | jdj}| jr|t krtd|  D ]}| | q| j	r.| 
  | jr]|  }| jrPt| j}tt|D ]}|| |d ||< qC| t| j|fd| j  ttjjtj}ttjj|}tjtj| j}| jr| j	r| js||vrtd| j dS dS dS dS )zRuns the command.rb   z"Can't install when cross-compilingNz'writing list of installed files to '%s'zmodules installed to '%s', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself)rC   run_commandrm   get_command_obj	plat_namerD   r   r   get_sub_commandsr   create_path_filerG   get_outputsr4   r   rangeexecuter   maprc   r~   r   ri   normcaser8   rB   r   r   )rI   
build_platcmd_nameoutputsroot_lencountersys_pathr8   rJ   rJ   rK   rung  sH   

zinstall.runc                 C   sL   t j| j| jd }| jr| t|| jgfd|  dS | 	d|  dS )zCreates the .pth file.pthzcreating %szpath file '%s' not createdN)
rc   r~   r   r}   r   rB   r   r   r   re   )rI   filenamerJ   rJ   rK   r     s   

zinstall.create_path_filec                 C   sh   g }|   D ]}| |}| D ]}||vr|| qq| jr2| jr2|tj| j	| jd  |S )z.Assembles the outputs of all the sub-commands.r   )
r   get_finalized_commandr   appendr   rB   rc   r~   r   r}   )rI   r   r   cmdr   rJ   rJ   rK   r     s   

zinstall.get_outputsc                 C   s.   g }|   D ]}| |}||  q|S )z*Returns the inputs of all the sub-commands)r   r   extend
get_inputs)rI   inputsr   r   rJ   rJ   rK   r     s
   
zinstall.get_inputsc                 C   s   | j  p	| j  S )zSReturns true if the current distribution has any Python
        modules to install.)rm   has_pure_moduleshas_ext_modulesrH   rJ   rJ   rK   has_lib  s   
zinstall.has_libc                 C   
   | j  S )zLReturns true if the current distribution has any headers to
        install.)rm   has_headersrH   rJ   rJ   rK   r        
zinstall.has_headersc                 C   r   )zMReturns true if the current distribution has any scripts to.
        install.)rm   has_scriptsrH   rJ   rJ   rK   r     r   zinstall.has_scriptsc                 C   r   )zJReturns true if the current distribution has any data to.
        install.)rm   has_data_filesrH   rJ   rJ   rK   has_data  r   zinstall.has_datar8   r7   r9   r:   install_egg_infoc                 C   s   dS )NTrJ   rH   rJ   rJ   rK   <lambda>  s    zinstall.<lambda>) __name__
__module____qualname__descriptionr   boolean_optionsr;   r   r   r   rL   r   rf   rg   rh   r   r   rv   rx   r{   r|   r   ry   r   r   r   r   r   r   r   r   sub_commandsrJ   rJ   rJ   rK   r$   r   sL    >
T ;		",
r$   )+__doc__ri   rs   rc   re	distutilsr   distutils.corer   distutils.debugr   distutils.sysconfigr   r   distutils.errorsr   distutils.file_utilr   distutils.utilr	   r
   r   r   r   siter   r   r;   r   r   r   distutils_scheme_namesys_scheme_namesys_key_INSTALL_SCHEMES
sys_schememain_keyr   valuesubreplacerq   r$   rJ   rJ   rJ   rK   <module>   s    



	

PK       ! xY=    &  __pycache__/build_clib.cpython-310.pycnu [        o
    bcV                     @   sT   d Z ddlZddlmZ ddlT ddlmZ ddlmZ dd Z	G d	d
 d
eZ
dS )zdistutils.command.build_clib

Implements the Distutils 'build_clib' command, to build a C/C++ library
that is included in the module distribution and needed by an extension
module.    N)Command)*)customize_compiler)logc                  C   s   ddl m}  |   d S )Nr   show_compilers)distutils.ccompilerr   r    r	   3/usr/lib/python3.10/distutils/command/build_clib.pyr      s   
r   c                   @   sf   e Zd ZdZg dZddgZdddefgZdd	 Zd
d Z	dd Z
dd Zdd Zdd Zdd ZdS )
build_clibz/build C/C++ libraries used by Python extensions))zbuild-clib=bz%directory to build C/C++ libraries to)zbuild-temp=tz,directory to put temporary build by-products)debuggz"compile with debugging information)forcefz2forcibly build everything (ignore file timestamps))z	compiler=czspecify the compiler typer   r   zhelp-compilerNzlist available compilersc                 C   s:   d | _ d | _d | _d | _d | _d | _d | _d| _d | _d S )Nr   )	r   
build_temp	librariesinclude_dirsdefineundefr   r   compilerselfr	   r	   r
   initialize_options4   s   
zbuild_clib.initialize_optionsc                 C   sl   |  dddddd | jj| _| jr| | j | jd u r$| jjp"g | _t| jtr4| jtj	| _d S d S )Nbuild)r   r   )r   r   )r   r   )r   r   )r   r   )
set_undefined_optionsdistributionr   check_library_listr   
isinstancestrsplitospathsepr   r	   r	   r
   finalize_optionsD   s   

zbuild_clib.finalize_optionsc                 C   s   | j sd S ddlm} || j| j| jd| _t| j | jd ur'| j| j | j	d ur;| j	D ]\}}| j
|| q/| jd urL| jD ]}| j| qC| | j  d S )Nr   )new_compiler)r   dry_runr   )r   r   r&   r   r'   r   r   r   set_include_dirsr   define_macror   undefine_macrobuild_libraries)r   r&   namevaluemacror	   r	   r
   run^   s"   




zbuild_clib.runc                 C   s   t |ts	td|D ]=}t |tst|dkrtd|\}}t |ts)tdd|v s7tjdkr?tj|v r?td|d  t |tsHtdqd	S )
a`  Ensure that the list of libraries is valid.

        `library` is presumably provided as a command option 'libraries'.
        This method checks that it is a list of 2-tuples, where the tuples
        are (library_name, build_info_dict).

        Raise DistutilsSetupError if the structure is invalid anywhere;
        just returns otherwise.
        z+'libraries' option must be a list of tuples   z*each element of 'libraries' must a 2-tuplezNfirst element of each tuple in 'libraries' must be a string (the library name)/z;bad library name '%s': may not contain directory separatorsr   zMsecond element of each tuple in 'libraries' must be a dictionary (build info)N)	r    listDistutilsSetupErrortuplelenr!   r#   sepdict)r   r   libr,   
build_infor	   r	   r
   r   v   s0   



zbuild_clib.check_library_listc                 C   s,   | j sd S g }| j D ]	\}}|| q
|S )N)r   append)r   	lib_nameslib_namer9   r	   r	   r
   get_library_names   s   zbuild_clib.get_library_namesc                 C   sZ   |  | j g }| jD ]\}}|d}|d u st|ttfs%td| || q|S )Nsourcesfin 'libraries' option (library '%s'), 'sources' must be present and must be a list of source filenames)r   r   getr    r2   r4   r3   extend)r   	filenamesr<   r9   r>   r	   r	   r
   get_source_files   s   
zbuild_clib.get_source_filesc                 C   s   |D ]G\}}| d}|d u st|ttfstd| t|}td| | d}| d}| jj|| j	||| j
d}| jj||| j| j
d qd S )Nr>   r?   zbuilding '%s' librarymacrosr   )
output_dirrD   r   r   )rE   r   )r@   r    r2   r4   r3   r   infor   compiler   r   create_static_libr   )r   r   r<   r9   r>   rD   r   objectsr	   r	   r
   r+      s.   



	zbuild_clib.build_libraries)__name__
__module____qualname__descriptionuser_optionsboolean_optionsr   help_optionsr   r%   r/   r   r=   rC   r+   r	   r	   r	   r
   r      s    $r   )__doc__r#   distutils.corer   distutils.errorsdistutils.sysconfigr   	distutilsr   r   r   r	   r	   r	   r
   <module>   s    PK       ! `d#(  #(  "  __pycache__/config.cpython-310.pycnu [        o
    bc=3                     @   sl   d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 ddd	ZG d
d deZdddZdS )a  distutils.command.config

Implements the Distutils 'config' command, a (mostly) empty command class
that exists mainly to be sub-classed by specific module distributions and
applications.  The idea is that while every "config" command is different,
at least they're all named the same, and users always see "config" in the
list of standard commands.  Also, this is a good place to put common
configure-like tasks: "try to compile this C code", or "figure out where
this header file lives".
    N)Command)DistutilsExecError)customize_compiler)logz.cz.cxx)czc++c                   @   s   e Zd ZdZg dZdd Zdd Zdd Zd	d
 Zdd Z	dd Z
dd Zdd Zdd Zd(ddZ		d(ddZd)ddZ		d*ddZ		d*dd Z		!d+d"d#Zdddg fd$d%Z		d)d&d'ZdS ),configzprepare to build)	)z	compiler=Nzspecify the compiler type)zcc=Nzspecify the compiler executable)zinclude-dirs=Iz.list of directories to search for header files)zdefine=DzC preprocessor macros to define)zundef=Uz!C preprocessor macros to undefine)z
libraries=lz!external C libraries to link with)zlibrary-dirs=Lz.directories to search for external C libraries)noisyNz1show every action (compile, link, run, ...) taken)zdump-sourceNz=dump generated source files before attempting to compile themc                 C   s4   d | _ d | _d | _d | _d | _d| _d| _g | _d S )N   )compilerccinclude_dirs	librarieslibrary_dirsr   dump_source
temp_filesself r   //usr/lib/python3.10/distutils/command/config.pyinitialize_options3   s   
zconfig.initialize_optionsc                 C   s   | j d u r| jj p
g | _ nt| j tr| j tj| _ | jd u r$g | _nt| jtr/| jg| _| jd u r9g | _d S t| jtrI| jtj| _d S d S N)	r   distribution
isinstancestrsplitospathsepr   r   r   r   r   r   finalize_optionsB   s   




zconfig.finalize_optionsc                 C   s   d S r   r   r   r   r   r   runR   s   z
config.runc                 C   s   ddl m}m} t| j|s=|| j| jdd| _t| j | jr'| j| j | j	r1| j
| j	 | jr?| j| j dS dS dS )z^Check that 'self.compiler' really is a CCompiler object;
        if not, make it one.
        r   )	CCompilernew_compilerr   )r   dry_runforceN)distutils.ccompilerr$   r%   r   r   r&   r   r   set_include_dirsr   set_librariesr   set_library_dirs)r   r$   r%   r   r   r   _check_compilerY   s   
zconfig._check_compilerc                 C   s   dt |  }t|d4}|r|D ]	}|d|  q|d || |d dkr7|d W d    |S W d    |S 1 sBw   Y  |S )N_configtestwz#include <%s>

)LANG_EXTopenwrite)r   bodyheaderslangfilenamefileheaderr   r   r   _gen_temp_sourcefilek   s    



zconfig._gen_temp_sourcefilec                 C   s<   |  |||}d}| j||g | jj|||d ||fS )Nz_configtest.ir   )r:   r   extendr   
preprocess)r   r4   r5   r   r6   srcoutr   r   r   _preprocessw   s
   zconfig._preprocessc                 C   s\   |  |||}| jrt|d|  | j|g\}| j||g | jj|g|d ||fS )Nzcompiling '%s':r;   )r:   r   	dump_filer   object_filenamesr   r<   compile)r   r4   r5   r   r6   r>   objr   r   r   _compile~   s   zconfig._compilec           
      C   sr   |  ||||\}}tjtj|d }	| jj|g|	|||d | jjd ur.|	| jj }	| j	|	 |||	fS )Nr   )r   r   target_lang)
rE   r    pathsplitextbasenamer   link_executableexe_extensionr   append)
r   r4   r5   r   r   r   r6   r>   rD   progr   r   r   _link   s   
zconfig._linkc              	   G   sP   |s| j }g | _ tdd| |D ]}zt| W q ty%   Y qw d S )Nzremoving: %s )r   r   infojoinr    removeOSError)r   	filenamesr7   r   r   r   _clean   s   zconfig._cleanNr   c                 C   sP   ddl m} |   d}z
| |||| W n |y!   d}Y nw |   |S )aQ  Construct a source file from 'body' (a string containing lines
        of C/C++ code) and 'headers' (a list of header files to include)
        and run it through the preprocessor.  Return true if the
        preprocessor succeeded, false if there were any errors.
        ('body' probably isn't of much use, but what the heck.)
        r   CompileErrorTF)r(   rW   r,   r@   rU   r   r4   r5   r   r6   rW   okr   r   r   try_cpp   s   zconfig.try_cppc                 C   s   |    | ||||\}}t|trt|}t|}d}		 | }
|
dkr)n	||
r1d}	nq W d   n1 s<w   Y  | 	  |	S )a  Construct a source file (just like 'try_cpp()'), run it through
        the preprocessor, and return true if any line of the output matches
        'pattern'.  'pattern' should either be a compiled regex object or a
        string containing a regex.  If both 'body' and 'headers' are None,
        preprocesses an empty file -- which can be useful to determine the
        symbols the preprocessor and compiler set by default.
        FT N)
r,   r@   r   r   rerC   r2   readlinesearchrU   )r   patternr4   r5   r   r6   r>   r?   r8   matchliner   r   r   
search_cpp   s$   	




zconfig.search_cppc                 C   sb   ddl m} |   z| |||| d}W n |y!   d}Y nw t|r(dp)d |   |S )zwTry to compile a source file built from 'body' and 'headers'.
        Return true on success, false otherwise.
        r   rV   TFsuccess!failure.)r(   rW   r,   rE   r   rP   rU   rX   r   r   r   try_compile   s   zconfig.try_compilec           
   	   C   sn   ddl m}m} |   z| |||||| d}	W n ||fy'   d}	Y nw t|	r.dp/d |   |	S )zTry to compile and link a source file, built from 'body' and
        'headers', to executable form.  Return true on success, false
        otherwise.
        r   rW   	LinkErrorTFrc   rd   )r(   rW   rg   r,   rN   r   rP   rU   )
r   r4   r5   r   r   r   r6   rW   rg   rY   r   r   r   try_link   s   
zconfig.try_linkc              
   C   s   ddl m}m} |   z| ||||||\}	}
}| |g d}W n ||tfy1   d}Y nw t|r8dp9d | 	  |S )zTry to compile, link to an executable, and run a program
        built from 'body' and 'headers'.  Return true on success, false
        otherwise.
        r   rf   TFrc   rd   )
r(   rW   rg   r,   rN   spawnr   r   rP   rU   )r   r4   r5   r   r   r   r6   rW   rg   r>   rD   exerY   r   r   r   try_run   s   

zconfig.try_runr   c           	      C   st   |    g }|r|d|  |d |r|d|  n|d|  |d d|d }| |||||S )a  Determine if function 'func' is available by constructing a
        source file that refers to 'func', and compiles and links it.
        If everything succeeds, returns true; otherwise returns false.

        The constructed source file starts out by including the header
        files listed in 'headers'.  If 'decl' is true, it then declares
        'func' (as "int func()"); you probably shouldn't supply 'headers'
        and set 'decl' true in the same call, or you might get errors about
        a conflicting declarations for 'func'.  Finally, the constructed
        'main()' function either references 'func' or (if 'call' is true)
        calls it.  'libraries' and 'library_dirs' are used when
        linking.
        z
int %s ();zint main () {z  %s();z  %s;}r/   )r,   rL   rQ   rh   )	r   funcr5   r   r   r   declcallr4   r   r   r   
check_func  s   


zconfig.check_funcc                 C   s    |    | d|||g| |S )a  Determine if 'library' is available to be linked against,
        without actually checking that any particular symbols are provided
        by it.  'headers' will be used in constructing the source file to
        be compiled, but the only effect of this is to check if all the
        header files listed are available.  Any libraries listed in
        'other_libraries' will be included in the link, in case 'library'
        has symbols that depend on other libraries.
        zint main (void) { })r,   rh   )r   libraryr   r5   r   other_librariesr   r   r   	check_lib4  s   


zconfig.check_libc                 C   s   | j d|g|dS )zDetermine if the system header file named by 'header_file'
        exists and can be found by the preprocessor; return true if so,
        false otherwise.
        z/* No body */)r4   r5   r   )rZ   )r   r9   r   r   r6   r   r   r   check_headerB  s   
zconfig.check_header)NNNr   )NNr   )NNNNr   )NNNNr   r   )__name__
__module____qualname__descriptionuser_optionsr   r"   r#   r,   r:   r@   rE   rN   rU   rZ   rb   re   rh   rk   rp   rs   rt   r   r   r   r   r      s@    	






r   c                 C   sP   |du rt d|  nt | t| }zt |  W |  dS |  w )zjDumps a file content into log.info.

    If head is not None, will be dumped before the file content.
    Nz%s)r   rP   r2   readclose)r7   headr8   r   r   r   rA   K  s   
rA   r   )__doc__r    r\   distutils.corer   distutils.errorsr   distutils.sysconfigr   	distutilsr   r1   r   rA   r   r   r   r   <module>   s    
  8PK       ! rk}    +  __pycache__/install_headers.cpython-310.pycnu [        o
    bc                     @   s$   d Z ddlmZ G dd deZdS )zdistutils.command.install_headers

Implements the Distutils 'install_headers' command, to install C/C++ header
files to the Python include directory.    )Commandc                   @   sF   e Zd ZdZddgZdgZdd Zdd Zd	d
 Zdd Z	dd Z
dS )install_headerszinstall C/C++ header files)zinstall-dir=dz$directory to install header files to)forcefz-force installation (overwrite existing files)r   c                 C   s   d | _ d| _g | _d S )Nr   )install_dirr   outfilesself r   8/usr/lib/python3.10/distutils/command/install_headers.pyinitialize_options   s   
z"install_headers.initialize_optionsc                 C   s   |  ddd d S )Ninstall)r   r   )r   r   )set_undefined_optionsr	   r   r   r   finalize_options   s   z install_headers.finalize_optionsc                 C   sH   | j j}|sd S | | j |D ]}| || j\}}| j| qd S N)distributionheadersmkpathr   	copy_filer   append)r
   r   headerout_r   r   r   run!   s   zinstall_headers.runc                 C   s   | j jpg S r   )r   r   r	   r   r   r   
get_inputs+   s   zinstall_headers.get_inputsc                 C   s   | j S r   )r   r	   r   r   r   get_outputs.   s   zinstall_headers.get_outputsN)__name__
__module____qualname__descriptionuser_optionsboolean_optionsr   r   r   r   r   r   r   r   r   r   
   s    
r   N)__doc__distutils.corer   r   r   r   r   r   <module>   s    PK       ! PM    $  __pycache__/__init__.cpython-310.pycnu [        o
    bc                     @   s   d Z g dZdS )z\distutils.command

Package containing implementation of all the standard Distutils
commands.)buildbuild_py	build_ext
build_clibbuild_scriptscleaninstallinstall_libinstall_headersinstall_scriptsinstall_datasdistregisterbdist
bdist_dumb	bdist_rpmcheckuploadN)__doc____all__ r   r   1/usr/lib/python3.10/distutils/command/__init__.py<module>   s    PK       ! ,-  -  !  __pycache__/clean.cpython-310.pycnu [        o
    bc
                     @   sD   d Z ddlZddlmZ ddlmZ ddlmZ G dd deZdS )zBdistutils.command.clean

Implements the Distutils 'clean' command.    N)Command)remove_tree)logc                   @   s6   e Zd ZdZg dZdgZdd Zdd Zdd	 Zd
S )cleanz-clean up temporary files from 'build' command))zbuild-base=bz2base build directory (default: 'build.build-base'))z
build-lib=Nz<build directory for all modules (default: 'build.build-lib'))zbuild-temp=tz7temporary build directory (default: 'build.build-temp'))zbuild-scripts=Nz<build directory for scripts (default: 'build.build-scripts'))zbdist-base=Nz+temporary directory for built distributions)allaz7remove all build output, not just temporary by-productsr   c                 C   s(   d | _ d | _d | _d | _d | _d | _d S )N)
build_base	build_lib
build_tempbuild_scripts
bdist_baser   self r   ./usr/lib/python3.10/distutils/command/clean.pyinitialize_options    s   
zclean.initialize_optionsc                 C   s"   |  ddddd |  dd d S )Nbuild)r
   r
   )r   r   )r   r   )r   r   bdist)r   r   )set_undefined_optionsr   r   r   r   finalize_options(   s   zclean.finalize_optionsc                 C   s   t j| jrt| j| jd ntd| j | jr9| j	| j
| jfD ]}t j|r2t|| jd q"td| q"| jsWzt | j td| j W d S  tyV   Y d S w d S )N)dry_runz%'%s' does not exist -- can't clean itzremoving '%s')ospathexistsr   r   r   r   debugr   r   r   r   warnrmdirr
   infoOSError)r   	directoryr   r   r   run1   s.   z	clean.runN)	__name__
__module____qualname__descriptionuser_optionsboolean_optionsr   r   r"   r   r   r   r   r      s    	r   )	__doc__r   distutils.corer   distutils.dir_utilr   	distutilsr   r   r   r   r   r   <module>   s    PK       ! 5'+w  w  ,  __pycache__/install_egg_info.cpython-310.pycnu [        o
    bc                     @   sd   d Z ddlmZ ddlmZmZ ddlZddlZddlZG dd deZ	dd Z
d	d
 Zdd ZdS )zdistutils.command.install_egg_info

Implements the Distutils 'install_egg_info' command, for installing
a package's PKG-INFO metadata.    )Command)logdir_utilNc                   @   s<   e Zd ZdZdZddgZdd Zdd Zd	d
 Zdd Z	dS )install_egg_infoz)Install an .egg-info file for the packagez8Install package's PKG-INFO metadata as an .egg-info file)zinstall-dir=dzdirectory to install to)zinstall-layoutNzcustom installation layoutc                 C   s   d | _ d | _d | _d S N)install_dirinstall_layoutprefix_optionself r   9/usr/lib/python3.10/distutils/command/install_egg_info.pyinitialize_options   s   
z#install_egg_info.initialize_optionsc                 C   s   |  dd |  dd |  dd | jr(| j dvr td| j dk}n| jr.d	}nd
}|rGdtt| j tt	| j
 f }ndtt| j tt	| j
 gtjd d R  }tj| j|| _| jg| _d S )Ninstall_lib)r   r   install)r	   r	   )r
   r
   )debunixz"unknown value for --install-layoutr   FTz%s-%s.egg-infoz%s-%s-py%d.%d.egg-info   )set_undefined_optionsr	   lowerDistutilsOptionErrorr
   to_filename	safe_namedistributionget_namesafe_versionget_versionsysversion_infoospathjoinr   targetoutputs)r   no_pyverbasenamer   r   r   finalize_options   s2   z!install_egg_info.finalize_optionsc                 C   s   | j }tj|rtj|stj|| jd n'tj|r+| 	tj
| j fd|  ntj| js?| 	tj| jfd| j  td| | jsit|ddd}| jj| W d    d S 1 sbw   Y  d S d S )N)dry_runz	Removing z	Creating z
Writing %swzUTF-8)encoding)r#   r    r!   isdirislinkr   remove_treer(   existsexecuteunlinkr   makedirsr   infoopenr   metadatawrite_pkg_file)r   r#   fr   r   r   run4   s   "zinstall_egg_info.runc                 C   s   | j S r   )r$   r   r   r   r   get_outputsB   s   zinstall_egg_info.get_outputsN)
__name__
__module____qualname____doc__descriptionuser_optionsr   r'   r7   r8   r   r   r   r   r      s    r   c                 C   s   t dd| S )zConvert an arbitrary string to a standard distribution name

    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    [^A-Za-z0-9.]+-)resubnamer   r   r   r   J   s   r   c                 C   s   |  dd} tdd| S )zConvert an arbitrary string to a standard version string

    Spaces become dots, and all other non-alphanumeric characters become
    dashes, with runs of multiple dashes condensed to a single dash.
     .r?   r@   )replacerA   rB   )versionr   r   r   r   R   s   r   c                 C   s   |  ddS )z|Convert a project or version name to its filename-escaped form

    Any '-' characters are currently replaced with '_'.
    r@   _)rG   rC   r   r   r   r   \   s   r   )r<   distutils.cmdr   	distutilsr   r   r    r   rA   r   r   r   r   r   r   r   r   <module>   s    ?
PK       ! !稴!  !  $  __pycache__/register.cpython-310.pycnu [        o
    bc-                     @   sd   d Z ddlZddlZddlZddlZddlmZ ddlm	Z	 ddl
T ddlmZ G dd de	ZdS )	zhdistutils.command.register

Implements the Distutils 'register' command (register with the repository).
    N)warn)PyPIRCCommand)*)logc                   @   s   e Zd ZdZejddg Zejg d Zddd fgZdd	 Zd
d Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd ZdddZdS )registerz7register the distribution with the Python package index)list-classifiersNz list the valid Trove classifiers)strictNzBWill stop the registering if the meta-data are not fully compliant)verifyr   r   checkc                 C   s   dS )NT selfr   r   1/usr/lib/python3.10/distutils/command/register.py<lambda>   s    zregister.<lambda>c                 C   s   t |  d| _d| _d S )Nr   )r   initialize_optionslist_classifiersr   r   r   r   r   r      s   

zregister.initialize_optionsc                 C   s*   t |  d| jfdd}|| jjd< d S )Nr   )r      )r   restructuredtextr
   )r   finalize_optionsr   distributioncommand_options)r   check_optionsr   r   r   r   $   s
   
zregister.finalize_optionsc                 C   sX   |    |   |  D ]}| | q| jr|   d S | jr&|   d S |   d S N)	r   _set_configget_sub_commandsrun_commanddry_runverify_metadatar   classifierssend_metadata)r   cmd_namer   r   r   run+   s   zregister.runc                 C   s8   t dt | jd}|  | j|_d|_|  dS )zDeprecated API.zddistutils.command.register.check_metadata is deprecated,               use the check command insteadr
   r   N)r   PendingDeprecationWarningr   get_command_objensure_finalizedr   r   r!   )r   r
   r   r   r   check_metadata:   s   zregister.check_metadatac                 C   s|   |   }|i kr!|d | _|d | _|d | _|d | _d| _d	S | jd| jfvr0td| j | jdkr9| j| _d| _d	S )
z: Reads the configuration file and set attributes.
        usernamepassword
repositoryrealmTpypiz%s not found in .pypircFN)_read_pypircr&   r'   r(   r)   
has_configDEFAULT_REPOSITORY
ValueError)r   configr   r   r   r   D   s   






zregister._set_configc                 C   s*   | j d }tj|}t| | dS )z8 Fetch the list of classifiers from the server.
        z?:action=list_classifiersN)r(   urllibrequesturlopenr   info_read_pypi_response)r   urlresponser   r   r   r   U   s   
zregister.classifiersc                 C   s&   |  | d\}}td|| dS )zF Send the metadata to the package index server to be checked.
        r	   Server response (%s): %sN)post_to_serverbuild_post_datar   r3   )r   coderesultr   r   r   r   \   s   zregister.verify_metadatac           
      C   s  | j rd}| j}| j}nd}d }}d }||vr5| dtj t }|s)d}n||vr1td ||vs|dkr|sAtd}|r;|sJt		d}|rCt
j }t
j| jd	 }|| j||| | | d
|\}}| d||f tj |dkr| j r|| j_dS | dtj | d|   tj d}| dvrtd}|sd}| dvs| dkr| || dS dS dS |dkr\ddi}	d |	d<  |	d< |	d< d|	d< |	d std|	d< |	d r|	d |	d kr+|	d st		d|	d< |	d r|	d st		d|	d< |	d r|	d |	d kr#d|	d< d|	d< td |	d |	d ks|	d s;td|	d< |	d r0| |	\}}|dkrPtd|| dS td td  dS |d!krdd"i}	d|	d< |	d sytd#|	d< |	d rn| |	\}}td|| dS dS )$a_   Send the metadata to the package index server.

            Well, do the following:
            1. figure who the user is, and then
            2. send the data as a Basic auth'ed POST.

            First we try to read the username/password from $HOME/.pypirc,
            which is a ConfigParser-formatted file with a section
            [distutils] containing username and password entries (both
            in clear text). Eg:

                [distutils]
                index-servers =
                    pypi

                [pypi]
                username: fred
                password: sekrit

            Otherwise, to figure who the user is, we offer the user three
            choices:

             1. use existing login,
             2. register as a new user, or
             3. set the password to a random string and email the user.

        1x z1 2 3 4zWe need to know who you are, so please choose either:
 1. use your existing login,
 2. register as a new user,
 3. have the server generate a new password for you (and email it to you), or
 4. quit
Your selection [default 1]: z&Please choose one of the four options!z
Username: z
Password: r   submitr7      zAI can store your PyPI login so future submissions will be faster.z (the login will be stored in %s)XynzSave your login (y/N)?ny2:actionusernamer'   emailNconfirmz
 Confirm: z!Password and confirm don't match!z
   EMail: z"You will receive an email shortly.z7Follow the instructions in it to complete registration.3password_resetzYour email address: )r,   r&   r'   splitannouncer   INFOinputprintgetpassr0   r1   HTTPPasswordMgrparseurlparser(   add_passwordr)   r8   r9   r   _get_rc_filelower_store_pypircr3   )
r   choicer&   r'   choicesauthhostr:   r;   datar   r   r   r   c   s   





	





zregister.send_metadatac                 C   s   | j j}i d|ddd| d| d| d| d| d	| d
| d|	 d|
 d| d| d| d| d| d| }|d sc|d sc|d rgd|d< |S )NrF   metadata_versionz1.0rH   versionsummary	home_pageauthorauthor_emaillicensedescriptionkeywordsplatformr   download_urlprovidesrequires	obsoletesz1.1)r   metadataget_nameget_versionget_descriptionget_urlget_contactget_contact_emailget_licenceget_long_descriptionget_keywordsget_platformsget_classifiersget_download_urlget_providesget_requiresget_obsoletes)r   actionmetar^   r   r   r   r9      sN   	
zregister.build_post_dataNc              
   C   s  d|v r|  d|d | jf tj d}d| }|d }t }| D ]?\}}t|tg tdfvr7|g}|D ])}t|}|	| |	d|  |	d |	| |rb|d	 d
krb|	d q9q$|	| |	d |
 d}d| tt|d}	tj| j||	}
tjtjj|d}d}z||
}W n; tjjy } z| jr|j }|j|jf}W Y d}~n(d}~w tjjy } zdt|f}W Y d}~nd}~ww | jr| |}d}| jrdd|df}|  |tj |S )zC Post a query to the server, and return a string response.
        rH   zRegistering %s to %sz3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254z
--z--r   z*
Content-Disposition: form-data; name="%s"z


zutf-8z/multipart/form-data; boundary=%s; charset=utf-8)zContent-typezContent-length)password_mgrr>   Ni  )r@   OKzK---------------------------------------------------------------------------)rN   r(   r   rO   ioStringIOitemstypestrwritegetvalueencodelenr0   r1   Requestbuild_openerHTTPBasicAuthHandleropenerror	HTTPErrorshow_responsefpreadr:   msgURLErrorr4   join)r   r^   r\   boundarysep_boundaryend_boundarybodykeyvalueheadersreqopenerr;   er   r   r   r   r8      sh   








zregister.post_to_serverr   )__name__
__module____qualname__rf   r   user_optionsboolean_optionssub_commandsr   r   r!   r%   r   r   r   r   r9   r8   r   r   r   r   r      s$    
zr   )__doc__rR   r   urllib.parser0   urllib.requestwarningsr   distutils.corer   distutils.errors	distutilsr   r   r   r   r   r   <module>   s    PK       ! sDL    )  __pycache__/build_scripts.cpython-310.pycnu [        o
    bcX                     @   s   d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZ ddlZed	ZG d
d deZG dd deeZdS )zRdistutils.command.build_scripts

Implements the Distutils 'build_scripts' command.    N)ST_MODE)	sysconfig)Command)newer)convert_path	Mixin2to3)logs   ^#!.*python[0-9.]*([ 	].*)?$c                   @   sF   e Zd ZdZg dZdgZdd Zdd Zdd	 Zd
d Z	dd Z
dS )build_scriptsz("build" scripts (copy and fixup #! line)))z
build-dir=dzdirectory to "build" (copy) to)forcefz1forcibly build everything (ignore file timestamps)zexecutable=ez*specify final destination interpreter pathr   c                 C   s"   d | _ d | _d | _d | _d | _d S N)	build_dirscriptsr   
executableoutfilesself r   6/usr/lib/python3.10/distutils/command/build_scripts.pyinitialize_options   s
   
z build_scripts.initialize_optionsc                 C   s   |  dddd | jj| _d S )Nbuild)r	   r   )r   r   )r   r   )set_undefined_optionsdistributionr   r   r   r   r   finalize_options%   s   zbuild_scripts.finalize_optionsc                 C   s   | j S r   )r   r   r   r   r   get_source_files,   s   zbuild_scripts.get_source_filesc                 C   s   | j sd S |   d S r   )r   copy_scriptsr   r   r   r   run/   s   zbuild_scripts.runc              	   C   s  |  | j g }g }| jD ]}d}t|}tj| jtj|}|| | j	s6t
||s6td| qzt|d}W n tyL   | jsH d}Y n,w t|j\}}|d | }	|	sh| d|  qt|	}
|
rxd}|
dpwd	}|r
td
|| j || | jstjs| j}ntjtddtdtdf }t|}d| | d }z|d W n ty   t d!|w z|| W n ty   t d!||w t|d}|"| |#|$  W d   n1 sw   Y  |r	|%  q|r|%  || | &|| qtj'dkrW|D ]1}| jr3td| q%t(|t) d@ }|dB d@ }||krUtd||| t*|| q%||fS )a"  Copy each script listed in 'self.scripts'; if it's marked as a
        Python script in the Unix way (first line matches 'first_line_re',
        ie. starts with "\#!" and contains "python"), then adjust the first
        line to refer to the current Python interpreter as we copy.
        Fznot copying %s (up-to-date)rbNr   z%s is an empty file (skipping)T       zcopying and adjusting %s -> %sBINDIRz
python%s%sVERSIONEXEs   #!   
zutf-8z.The shebang ({!r}) is not decodable from utf-8zAThe shebang ({!r}) is not decodable from the script encoding ({})wbposixzchanging mode of %si  im  z!changing mode of %s from %o to %o)+mkpathr   r   r   ospathjoinbasenameappendr   r   r   debugopenOSErrordry_runtokenizedetect_encodingreadlineseekwarnfirst_line_rematchgroupinfor   python_buildr   get_config_varfsencodedecodeUnicodeDecodeError
ValueErrorformatwrite
writelines	readlinesclose	copy_filenamestatr   chmod)r   r   updated_filesscriptadjustoutfiler   encodinglines
first_liner8   post_interpr   shebangoutffileoldmodenewmoder   r   r   r   5   s   








zbuild_scripts.copy_scriptsN)__name__
__module____qualname__descriptionuser_optionsboolean_optionsr   r   r   r   r   r   r   r   r   r	      s    r	   c                   @   s   e Zd Zdd ZdS )build_scripts_2to3c                 C   s&   t | \}}| js| | ||fS r   )r	   r   r1   run_2to3)r   r   rJ   r   r   r   r      s   
zbuild_scripts_2to3.copy_scriptsN)rW   rX   rY   r   r   r   r   r   r]      s    r]   )__doc__r)   rerH   r   	distutilsr   distutils.corer   distutils.dep_utilr   distutils.utilr   r   r   r2   compiler7   r	   r]   r   r   r   r   <module>   s    
 
PK       ! ]$B>  >  %  __pycache__/build_ext.cpython-310.pycnu [        o
    bc{                     @   s   d Z ddlZddlZddlZddlZddlmZ ddlT ddlm	Z	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ edZdd ZG dd deZdS )zdistutils.command.build_ext

Implements the Distutils 'build_ext' command, for building extension
modules (currently limited to C extensions, should accommodate C++
extensions ASAP).    N)Command)*)customize_compilerget_python_version)get_config_h_filename)newer_group)	Extension)get_platform)log)	USER_BASEz3^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$c                  C   s   ddl m}  |   d S )Nr   show_compilers)distutils.ccompilerr   r    r   2/usr/lib/python3.10/distutils/command/build_ext.pyr      s   
r   c                   @   s  e Zd ZdZdej Zddddde  fdd	d
de fdddddde fddddddddddgZg dZ	ddde
fgZd d! Zd"d# Zd$d% Zd&d' Zd(d) Zd*d+ Zd,d- Zd.d/ Zd0d1 Zejd2d3 Zd4d5 Zd6d7 Zd8d9 Zd:d; Zd<d= Zd>d? Zd@dA ZdBdC ZdS )D	build_extz8build C/C++ extensions (compile/link to build directory)z (separated by '%s'))z
build-lib=bz(directory for compiled extension modules)zbuild-temp=tz1directory for temporary files (build by-products)z
plat-name=pz>platform name to cross-compile for, if supported (default: %s))inplaceiziignore build-lib and put compiled extensions into the source directory alongside your pure Python moduleszinclude-dirs=Iz.list of directories to search for header files)zdefine=DzC preprocessor macros to define)zundef=Uz!C preprocessor macros to undefine)z
libraries=lz!external C libraries to link withzlibrary-dirs=Lz.directories to search for external C libraries)zrpath=Rz7directories to search for shared C libraries at runtime)zlink-objects=Oz2extra explicit link objects to include in the link)debuggz'compile/link with debugging information)forcefz2forcibly build everything (ignore file timestamps))z	compiler=czspecify the compiler type)z	parallel=jznumber of parallel build jobs)swig-cppNz)make SWIG create C++ files (default is C))z
swig-opts=Nz!list of SWIG command line options)zswig=Nzpath to the SWIG executable)userNz#add user include, library and rpath)r   r   r    r$   r%   zhelp-compilerNzlist available compilersc                 C   s   d | _ d | _d | _d | _d| _d | _d | _d | _d | _d | _	d | _
d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d S )Nr   )
extensions	build_lib	plat_name
build_tempr   packageinclude_dirsdefineundef	librarieslibrary_dirsrpathlink_objectsr   r    compilerswigswig_cpp	swig_optsr%   parallelselfr   r   r   initialize_optionsj   s*   
zbuild_ext.initialize_optionsc           
   
   C   s  ddl m} | ddddddd	d
 | jd u r| jj| _| jj| _| }|jdd}| j	d u r7| jj	p5g | _	t
| j	trE| j	tj| _	tjtjkrW| j	tjtjd | j	|tjj ||krq| j	|tjj | d | d | jd u rg | _| jd u rg | _nt
| jtr| jtj| _| jd u rg | _nt
| jtr| jtj| _tjdkr-| jtjtjd tjtjkr| jtjtjd | jrtj| jd| _n	tj| jd| _| j	tjt  t tdd }|r| j| | j!dkrd}n| j!dd  }tjtjd}|r'tj||}| j| tj"d d dkr\tj#$tjtjdrV| jtjtjddt%  d n| jd 	 | j(ro| j(d"}d#d$ |D | _(| j)rz| j)d"| _)| j*d u rg | _*n| j*d%| _*| j+rtjt,d}tjt,d}	tj-|r| j	| tj-|	r| j|	 | j|	 t
| j.trz	t/| j.| _.W d S  t0y   t1d&w d S )'Nr   )	sysconfigbuild)r'   r'   )r)   r)   )r2   r2   )r   r   )r    r    )r6   r6   )r(   r(      )plat_specificincluder.   r1   ntlibsDebugRelease_homewin32   PCbuild   cygwinbinlibpythonconfig.FPy_ENABLE_SHAREDLIBDIR,c                 S   s   g | ]}|d fqS )1r   ).0symbolr   r   r   
<listcomp>   s    z.build_ext.finalize_options.<locals>.<listcomp> zparallel should be an integer)2	distutilsr:   set_undefined_optionsr*   distributionext_packageext_modulesr&   get_python_incr+   
isinstancestrsplitospathsepsysexec_prefixbase_exec_prefixappendpathjoinextendensure_string_listr.   r/   r0   nameprefixr   r)   dirnamer   getattrr(   platform
executable
startswithr   get_config_varpython_buildr,   r-   r5   r%   r   isdirr6   int
ValueErrorDistutilsOptionError)
r8   r:   
py_includeplat_py_include	_sys_homesuffixnew_libdefinesuser_includeuser_libr   r   r   finalize_options   s   









zbuild_ext.finalize_optionsc                 C   sb  ddl m} | jsd S | j r&| d}| j| pg  | j	
|j || j| j| j| jd| _t| j tjdkrJ| jt krJ| j| j | jd urV| j| j | jd urj| jD ]\}}| j|| q^| jd ur{| jD ]}| j| qr| jd ur| j| j | j	d ur| j| j	 | jd ur| j| j | j d ur| j!| j  | "  d S )Nr   )new_compiler
build_clib)r2   verbosedry_runr    r?   )#r   r   r&   rX   has_c_librariesget_finalized_commandr.   rg   get_library_namesr/   rd   r   r2   r   r   r    r   r_   ri   r(   r	   
initializer+   set_include_dirsr,   define_macror-   undefine_macroset_librariesset_library_dirsr0   set_runtime_library_dirsr1   set_link_objectsbuild_extensions)r8   r   r   ri   valuemacror   r   r   run  s@   










zbuild_ext.runc           
      C   sh  t |ts	tdt|D ]\}}t |trqt |tr"t|dkr&td|\}}td| t |t	r:t
|s>tdt |tsGtdt||d }dD ]}||}|d	urat||| qP|d
|_d|v rqtd |d}|rg |_g |_|D ],}	t |	trt|	dv stdt|	dkr|j|	d  qt|	dkr|j|	 q|||< qd	S )a  Ensure that the list of extensions (presumably provided as a
        command option 'extensions') is valid, i.e. it is a list of
        Extension objects.  We also support the old-style list of 2-tuples,
        where the tuples are (ext_name, build_info), which are converted to
        Extension instances here.

        Raise DistutilsSetupError if the structure is invalid anywhere;
        just returns otherwise.
        z:'ext_modules' option must be a list of Extension instances   zMeach element of 'ext_modules' option must be an Extension instance or 2-tuplezvold-style (ext_name, build_info) tuple found in ext_modules for extension '%s' -- please convert to Extension instancezRfirst element of each tuple in 'ext_modules' must be the extension name (a string)zOsecond element of each tuple in 'ext_modules' must be a dictionary (build info)sources)r+   r/   r.   extra_objectsextra_compile_argsextra_link_argsNr0   def_filez9'def_file' element of build info dict no longer supportedmacros)r<   r   z9'macros' element of build info dict must be 1- or 2-tupler<   r   )r\   listDistutilsSetupError	enumerater   tuplelenr
   warnr]   extension_name_rematchdictgetsetattrruntime_library_dirsdefine_macrosundef_macrosrd   )
r8   r&   r   extext_name
build_infokeyvalr   r   r   r   r   check_extensions_listV  sd   








zbuild_ext.check_extensions_listc                 C   s,   |  | j g }| jD ]}||j q|S N)r   r&   rg   r   )r8   	filenamesr   r   r   r   get_source_files  s
   
zbuild_ext.get_source_filesc                 C   s2   |  | j g }| jD ]}|| |j q|S r   )r   r&   rd   get_ext_fullpathri   )r8   outputsr   r   r   r   get_outputs  s
   
zbuild_ext.get_outputsc                 C   s*   |  | j | jr|   d S |   d S r   )r   r&   r6   _build_extensions_parallel_build_extensions_serialr7   r   r   r   r     s   zbuild_ext.build_extensionsc              
      s   j }j du rt }zddlm} W n ty   d }Y nw |d u r*  d S ||d8  fddjD }tj|D ]\}}	| |
  W d    n1 sYw   Y  qAW d    d S 1 sjw   Y  d S )NTr   )ThreadPoolExecutor)max_workersc                    s   g | ]	}  j|qS r   )submitbuild_extension)rR   r   executorr8   r   r   rT     s    z8build_ext._build_extensions_parallel.<locals>.<listcomp>)r6   r_   	cpu_countconcurrent.futuresr   ImportErrorr   r&   zip_filter_build_errorsresult)r8   workersr   futuresr   futr   r   r   r     s,   

"z$build_ext._build_extensions_parallelc              	   C   sD   | j D ]}| | | | W d    n1 sw   Y  qd S r   )r&   r   r   )r8   r   r   r   r   r     s   
z"build_ext._build_extensions_serialc              
   c   sX    zd V  W d S  t ttfy+ } z|js | d|j|f  W Y d }~d S d }~ww )Nz"building extension "%s" failed: %s)CCompilerErrorDistutilsErrorCompileErroroptionalr   ri   )r8   r   er   r   r   r     s   zbuild_ext._filter_build_errorsc           
      C   sL  |j }|d u st|ttfstd|j t|}| |j}||j }| j	s6t
||ds6td|j d S td|j | ||}|jpGg }|jd d  }|jD ]}||f qR| jj|| j||j| j||jd}|d d  | _|jr|||j |jpg }|jp| j|}	| jj||| ||j|j || !|| j| j|	d
 d S )Nzjin 'ext_modules' option (extension '%s'), 'sources' must be present and must be a list of source filenamesnewerz$skipping '%s' extension (up-to-date)zbuilding '%s' extension)
output_dirr   r+   r   extra_postargsdepends)r.   r/   r   r   export_symbolsr   r)   target_lang)"r   r\   r   r   r   ri   sortedr   r   r    r   r
   r   infoswig_sourcesr   r   r   rd   r2   compiler)   r+   _built_objectsr   rg   r   languagedetect_languagelink_shared_objectget_librariesr/   r   get_export_symbols)
r8   r   r   ext_pathr   
extra_argsr   r-   objectsr   r   r   r   r     sV   





zbuild_ext.build_extensionc                 C   s$  g }g }i }| j rtd | j sd| jv sd|jv rd}nd}|D ](}tj|\}}	|	dkrE||d |  || |d ||< q"|| q"|sO|S | jpU| 	 }
|
dg}|
| j | j rh|d | jsv|jD ]}|| qn|D ]}|| }td	|| | |d
||g  qx|S )zWalk the list of source files in 'sources', looking for SWIG
        interface (.i) files.  Run SWIG on all that are found, and
        return a modified 'sources' list with SWIG source files replaced
        by the generated C (or C++) files.
        z/--swig-cpp is deprecated - use --swig-opts=-c++z-c++z.cppz.cz.i_wrapz-pythonzswigging %s to %sz-o)r4   r
   r   r5   r_   re   splitextrd   r3   	find_swigrg   r   spawn)r8   r   	extensionnew_sourcesr   swig_targets
target_extsourcebaser   r3   swig_cmdotargetr   r   r   r   2  s>   




zbuild_ext.swig_sourcesc                 C   sZ   t jdkrdS t jdkr&dD ]}t jd| d}t j|r#|  S qdS tdt j )zReturn the name of the SWIG executable.  On Unix, this is
        just "swig" -- it should be in the PATH.  Tries a bit harder on
        Windows.
        posixr3   r?   )z1.3z1.2z1.1z	c:\swig%szswig.exez>I don't know how to find (much less run) SWIG on platform '%s')r_   ri   re   rf   isfileDistutilsPlatformError)r8   versfnr   r   r   r   h  s   

zbuild_ext.find_swigc                 C   s   |  |}|d}| |d }| js)tjj|dd |g  }tj| j|S d|dd }| d}tj	|
|}tj||S )zReturns the path of the filename for a given extension.

        The file is located in `build_lib` or directly in the package
        (inplace option).
        rM   r   Nr   build_py)get_ext_fullnamer^   get_ext_filenamer   r_   re   rf   r'   r   abspathget_package_dir)r8   r   fullnamemodpathfilenamer*   r   package_dirr   r   r   r     s   


zbuild_ext.get_ext_fullpathc                 C   s   | j du r|S | j d | S )zSReturns the fullname of a given extension name.

        Adds the `package.` prefixNrM   )r*   )r8   r   r   r   r   r     s   
zbuild_ext.get_ext_fullnamec                 C   s.   ddl m} |d}|d}tjj| | S )zConvert the name of an extension (eg. "foo.bar") into the name
        of the file from which it will be loaded (eg. "foo/bar.so", or
        "foo\bar.pyd").
        r   rp   rM   
EXT_SUFFIX)distutils.sysconfigrp   r^   r_   re   rf   )r8   r   rp   r   
ext_suffixr   r   r   r     s   
zbuild_ext.get_ext_filenamec                 C   sv   d|j dd  }z|d W n ty(   d|dddd }Y nw d	| }||jvr8|j| |jS )
a  Return the list of symbols that a shared extension has to
        export.  This either uses 'ext.export_symbols' or, if it's not
        provided, "PyInit_" + module_name.  Only relevant on Windows, where
        the .pyd file (DLL) must export the module "PyInit_" function.
        _rM   r   asciir   punycode   -   _PyInit)ri   r^   encodeUnicodeEncodeErrorreplacedecoder   rd   )r8   r   ry   initfunc_namer   r   r   r     s    
zbuild_ext.get_export_symbolsc                 C   s   t jdkr1ddlm} t| j|s.d}| jr|d }|t jd? t jd? d@ f }|j|g S |jS dd	l	m
} d
}	 |rH|d}|jd| g S |jS )zReturn the list of libraries to link against when building a
        shared extension.  On most platforms, this is just 'ext.libraries';
        on Windows, we add the Python library (eg. python20.dll).
        rD   r   )MSVCCompilerz
python%d%d_d         r   FrN   getandroidapilevelTrH   _PYTHON_HOST_PLATFORMANDROID_API_LEVELMACHDEP	LDVERSIONrK   )ra   rm   distutils._msvccompilerr  r\   r2   r   
hexversionr.   r   rp   hasattrr_   environ)r8   r   r  template	pythonlibrp   link_libpython	ldversionr   r   r   r     s$   

zbuild_ext.get_libraries) __name__
__module____qualname__descriptionr_   r`   sep_byr	   user_optionsboolean_optionsr   help_optionsr9   r~   r   r   r   r   r   r   r   
contextlibcontextmanagerr   r   r   r   r   r   r   r   r   r   r   r   r   r   !   sp    
+ @N	
	L6	
r   )__doc__r!  r_   rera   distutils.corer   distutils.errorsr   r   r   r   distutils.dep_utilr   distutils.extensionr   distutils.utilr	   rV   r
   siter   r   r   r   r   r   r   r   r   <module>   s&    PK       ! iNߓ(  (  $  __pycache__/build_py.cpython-310.pycnu [        o
    bc&C                     @   sz   d Z ddlZddlZddlZddlZddlmZ ddlT ddl	m
Z
mZ ddlmZ G dd deZG d	d
 d
eeZdS )zHdistutils.command.build_py

Implements the Distutils 'build_py' command.    N)Command)*)convert_path	Mixin2to3)logc                   @   s   e Zd ZdZg dZddgZddiZdd Zdd	 Zd
d Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zd d! Zd.d#d$Zd%d& Zd'd( Zd)d* Zd+d, Zd-S )/build_pyz5"build" pure Python modules (copy to build directory)))z
build-lib=dzdirectory to "build" (copy) to)compileczcompile .py to .pyc)
no-compileNz!don't compile .py files [default])z	optimize=Ozlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])forcefz2forcibly build everything (ignore file timestamps)r	   r   r   c                 C   s4   d | _ d | _d | _d | _d | _d| _d| _d | _d S )Nr   )	build_lib
py_modulespackagepackage_datapackage_dirr	   optimizer   self r   1/usr/lib/python3.10/distutils/command/build_py.pyinitialize_options    s   
zbuild_py.initialize_optionsc              	   C   s   |  ddd | jj| _| jj| _| jj| _i | _| jjr/| jj D ]\}}t|| j|< q#|  | _	t
| jts`zt| j| _d| j  krMdksPJ  J W d S  ttfy_   tdw d S )Nbuild)r   r   )r   r   r      zoptimize must be 0, 1, or 2)set_undefined_optionsdistributionpackagesr   r   r   itemsr   get_data_files
data_files
isinstancer   int
ValueErrorAssertionErrorDistutilsOptionError)r   namepathr   r   r   finalize_options*   s(   



$zbuild_py.finalize_optionsc                 C   s:   | j r|   | jr|   |   | | jdd d S Nr   )include_bytecode)r   build_modulesr   build_packagesbuild_package_databyte_compileget_outputsr   r   r   r   runC   s   zbuild_py.runc                    s   g }| j s|S | j D ]4}| |}tjj| jg|d  }d |r(t|d   fdd| ||D }|	||||f q
|S )z?Generate list of '(package,src_dir,build_dir,filenames)' tuples.r      c                    s   g | ]}| d  qS Nr   ).0fileplenr   r   
<listcomp>s   s    z+build_py.get_data_files.<locals>.<listcomp>)
r   get_package_dirosr(   joinr   splitlenfind_data_filesappend)r   datar   src_dir	build_dir	filenamesr   r7   r   r    a   s   



zbuild_py.get_data_filesc                    sd   | j dg | j |g  }g  |D ]}ttjt|t|}  fdd|D  q S )z6Return filenames for package's data files in 'src_dir' c                    s$   g | ]}| vrt j|r|qS r   )r;   r(   isfile)r5   fnfilesr   r   r9      s    

z,build_py.find_data_files.<locals>.<listcomp>)	r   getglobr;   r(   r<   escaper   extend)r   r   rB   globspatternfilelistr   rH   r   r?   y   s   zbuild_py.find_data_filesc                 C   s`   d}| j D ](\}}}}|D ]}tj||}| tj| | jtj|||dd qqdS )z$Copy data files into build directoryNFpreserve_mode)r!   r;   r(   r<   mkpathdirname	copy_file)r   lastdirr   rB   rC   rD   filenametargetr   r   r   r.      s   zbuild_py.build_package_datac                 C   s   | d}| js|rtjj| S dS g }|rCz
| jd| }W n ty4   |d|d  |d= Y nw |d| tjj| S |s| jd}|durS|d| |r[tjj| S dS )zReturn the directory, relative to the top of the source
           distribution, where package 'package' should be found
           (at least according to the 'package_dir' option, if any).r2   rE   r   N)r=   r   r;   r(   r<   KeyErrorinsertrJ   )r   r   r(   tailpdirr   r   r   r:      s,   

zbuild_py.get_package_dirc                 C   sj   |dkrt j|std| t j|std| |r3t j|d}t j|r-|S td| d S )NrE   z%package directory '%s' does not existz>supposed package directory '%s' exists, but is not a directoryz__init__.pyz8package init file '%s' not found (or not a regular file))	r;   r(   existsDistutilsFileErrorisdirr<   rF   r   warn)r   r   r   init_pyr   r   r   check_package   s&   zbuild_py.check_packagec                 C   s"   t j|std|| dS dS )Nz!file %s (for module %s) not foundFT)r;   r(   rF   r   ra   )r   modulemodule_filer   r   r   check_module   s   zbuild_py.check_modulec           	      C   s   |  || ttjt|d}g }tj| jj}|D ](}tj|}||kr@tj	tj
|d }||||f q| d|  q|S )Nz*.pyr   zexcluding %s)rc   rK   r;   r(   r<   rL   abspathr   script_namesplitextbasenamer@   debug_print)	r   r   r   module_filesmodulessetup_scriptr   abs_frd   r   r   r   find_package_modules   s   zbuild_py.find_package_modulesc              	   C   s   i }g }| j D ]]}|d}d|dd }|d }z|| \}}W n ty3   | |}d}Y nw |sL| ||}	|df||< |	rL||d|	f tj||d }
| 	||
s\q||||
f q|S )a  Finds individually-specified Python modules, ie. those listed by
        module name in 'self.py_modules'.  Returns a list of tuples (package,
        module_base, filename): 'package' is a tuple of the path through
        package-space to the module; 'module_base' is the bare (no
        packages, no dots) module name, and 'filename' is the path to the
        ".py" file (relative to the distribution root) that implements the
        module.
        r2   r   rY   r3   __init__.py)
r   r=   r<   rZ   r:   rc   r@   r;   r(   rf   )r   r   rm   rd   r(   r   module_baser   checkedrb   re   r   r   r   find_modules   s,   


zbuild_py.find_modulesc                 C   sN   g }| j r||   | jr%| jD ]}| |}| ||}|| q|S )a4  Compute the list of all modules that will be built, whether
        they are specified one-module-at-a-time ('self.py_modules') or
        by whole packages ('self.packages').  Return a list of tuples
        (package, module, module_file), just like 'find_modules()' and
        'find_package_modules()' do.)r   rM   ru   r   r:   rp   )r   rm   r   r   mr   r   r   find_all_modules  s   

zbuild_py.find_all_modulesc                 C   s   dd |   D S )Nc                 S   s   g | ]}|d  qS )rY   r   )r5   rd   r   r   r   r9   -  s    z-build_py.get_source_files.<locals>.<listcomp>)rw   r   r   r   r   get_source_files,  s   zbuild_py.get_source_filesc                 C   s$   |gt | |d g }tjj| S )Nrr   )listr;   r(   r<   )r   rC   r   rd   outfile_pathr   r   r   get_module_outfile/  s   zbuild_py.get_module_outfiler3   c                 C   s   |   }g }|D ]8\}}}|d}| | j||}|| |r@| jr/|tjj|dd | j	dkr@|tjj|| j	d q|dd | j
D 7 }|S )Nr2   rE   )optimizationr   c                 S   s,   g | ]\}}}}|D ]	}t j||q
qS r   )r;   r(   r<   )r5   r   rB   rC   rD   rW   r   r   r   r9   B  s    
z(build_py.get_outputs.<locals>.<listcomp>)rw   r=   r{   r   r@   r	   	importlibutilcache_from_sourcer   r!   )r   r+   rm   outputsr   rd   re   rW   r   r   r   r0   3  s(   




zbuild_py.get_outputsc                 C   sb   t |tr|d}nt |ttfstd| | j||}tj	
|}| | | j||ddS )Nr2   z:'package' must be a string (dot-separated), list, or tupler   rQ   )r"   strr=   ry   tuple	TypeErrorr{   r   r;   r(   rT   rS   rU   )r   rd   re   r   outfiledirr   r   r   build_moduleJ  s   

zbuild_py.build_modulec                 C   s*   |   }|D ]\}}}| ||| qd S r4   )ru   r   )r   rm   r   rd   re   r   r   r   r,   Y  s   zbuild_py.build_modulesc                 C   sP   | j D ]"}| |}| ||}|D ]\}}}||ksJ | ||| qqd S r4   )r   r:   rp   r   )r   r   r   rm   package_rd   re   r   r   r   r-   b  s   


zbuild_py.build_packagesc                 C   s   t jr
| d d S ddlm} | j}|d tjkr|tj }| jr-||d| j	|| j
d | jdkr@||| j| j	|| j
d d S d S )Nz%byte-compiling is disabled, skipping.r   )r/   rY   )r   r   prefixdry_run)sysdont_write_bytecodera   distutils.utilr/   r   r;   sepr	   r   r   r   )r   rI   r/   r   r   r   r   r/   v  s    





zbuild_py.byte_compileN)r3   )__name__
__module____qualname__descriptionuser_optionsboolean_optionsnegative_optr   r)   r1   r    r?   r.   r:   rc   rf   rp   ru   rw   rx   r{   r0   r   r,   r-   r/   r   r   r   r   r      s0    


'4
	r   c                   @   s   e Zd Zdd Zdd ZdS )build_py_2to3c                 C   sL   g | _ | jr
|   | jr|   |   | | j  | | jdd d S r*   )	updated_filesr   r,   r   r-   r.   run_2to3r/   r0   r   r   r   r   r1     s   zbuild_py_2to3.runc                 C   s,   t | |||}|d r| j|d  |S )Nr3   r   )r   r   r   r@   )r   rd   re   r   resr   r   r   r     s   zbuild_py_2to3.build_moduleN)r   r   r   r1   r   r   r   r   r   r     s    r   )__doc__r;   importlib.utilr}   r   rK   distutils.corer   distutils.errorsr   r   r   	distutilsr   r   r   r   r   r   r   <module>   s      }PK       !     !  __pycache__/bdist.cpython-310.pycnu [        o
    bc9                     @   sH   d Z ddlZddlmZ ddlT ddlmZ dd ZG dd	 d	eZdS )
zidistutils.command.bdist

Implements the Distutils 'bdist' command (create a built [binary]
distribution).    N)Command)*)get_platformc                  C   sP   ddl m}  g }tjD ]}|d| dtj| d f q| |}|d dS )zFPrint list of available formats (arguments to "--format" option).
    r   )FancyGetoptformats=N   z'List of available distribution formats:)distutils.fancy_getoptr   bdistformat_commandsappendformat_command
print_help)r   formatsformatpretty_printer r   ./usr/lib/python3.10/distutils/command/bdist.pyshow_formats   s   
r   c                	   @   s   e Zd ZdZdddde  fdddd	d
gZdgZdddefgZdZ	dddZ
g dZdddddddddZdd Zdd Zd d! ZdS )"r	   z$create a built (binary) distribution)zbdist-base=bz4temporary directory for creating built distributionsz
plat-name=pz;platform name to embed in generated filenames (default: %s))r   Nz/formats for distribution (comma-separated list))z	dist-dir=dz=directory to put final built distributions in [default: dist])
skip-buildNz2skip rebuilding everything (for testing/debugging))zowner=uz@Owner name used when creating a tar file [default: current user])zgroup=gzAGroup name used when creating a tar file [default: current group]r   zhelp-formatsNz$lists available distribution formats)	bdist_rpmgztarzip)posixnt)rpmr   bztarxztarztartarr   msi)r   zRPM distribution)
bdist_dumbzgzip'ed tar file)r%   zbzip2'ed tar file)r%   zxz'ed tar file)r%   zcompressed tar file)r%   ztar file)r%   zZIP file)	bdist_msizMicrosoft Installerc                 C   s.   d | _ d | _d | _d | _d| _d | _d | _d S )Nr   )
bdist_base	plat_namer   dist_dir
skip_buildgroupowner)selfr   r   r   initialize_optionsO   s   
zbdist.initialize_optionsc                 C   s   | j d u r| jrt | _ n| dj | _ | jd u r*| dj}tj|d| j  | _| 	d | j
d u rMz
| jtj g| _
W n tyL   tdtj w | jd u rWd| _d S d S )Nbuildzbdist.r   z;don't know how to create built distributions on platform %sdist)r(   r*   r   get_finalized_commandr'   
build_baseospathjoinensure_string_listr   default_formatnameKeyErrorDistutilsPlatformErrorr)   )r-   r2   r   r   r   finalize_optionsX   s.   






zbdist.finalize_optionsc              	   C   s   g }| j D ]}z|| j| d  W q ty    td| w tt| j D ]4}|| }| |}|| jvr>| j | |_	|dkrJ| j
|_
| j|_|||d d  v rWd|_| | q(d S )Nr   zinvalid format '%s'r%   r   )r   r   r   r9   DistutilsOptionErrorrangelenreinitialize_commandno_format_optionr   r,   r+   	keep_temprun_command)r-   commandsr   icmd_namesub_cmdr   r   r   runt   s&   


z	bdist.run)__name__
__module____qualname__descriptionr   user_optionsboolean_optionsr   help_optionsr@   r7   r
   r   r.   r;   rG   r   r   r   r   r	      sH    	r	   )	__doc__r3   distutils.corer   distutils.errorsdistutils.utilr   r   r	   r   r   r   r   <module>   s    PK       ! Z`  `  +  __pycache__/install_scripts.cpython-310.pycnu [        o
    bc                     @   sD   d Z ddlZddlmZ ddlmZ ddlmZ G dd deZdS )zudistutils.command.install_scripts

Implements the Distutils 'install_scripts' command, for installing
Python scripts.    N)Command)log)ST_MODEc                   @   sH   e Zd ZdZg dZddgZdd Zdd Zd	d
 Zdd Z	dd Z
dS )install_scriptsz%install scripts (Python or otherwise)))zinstall-dir=dzdirectory to install scripts to)z
build-dir=bz'build directory (where to install from))forcefz-force installation (overwrite existing files))
skip-buildNzskip the build stepsr   r
   c                 C   s   d | _ d| _d | _d | _d S )Nr   )install_dirr   	build_dir
skip_buildself r   8/usr/lib/python3.10/distutils/command/install_scripts.pyinitialize_options   s   
z"install_scripts.initialize_optionsc                 C   s    |  dd |  dddd d S )Nbuild)build_scriptsr   install)r   r   )r   r   )r   r   )set_undefined_optionsr   r   r   r   finalize_options!   s   z install_scripts.finalize_optionsc                 C   s   | j s| d | | j| j| _tjdkr?|  D ]&}| j	r&t
d| qt|t dB d@ }t
d|| t|| qd S d S )Nr   posixzchanging mode of %sim  i  zchanging mode of %s to %o)r   run_command	copy_treer   r   outfilesosnameget_outputsdry_runr   infostatr   chmod)r   filemoder   r   r   run)   s   

zinstall_scripts.runc                 C   s   | j jpg S N)distributionscriptsr   r   r   r   
get_inputs8   s   zinstall_scripts.get_inputsc                 C   s
   | j pg S r&   )r   r   r   r   r   r   ;   s   
zinstall_scripts.get_outputsN)__name__
__module____qualname__descriptionuser_optionsboolean_optionsr   r   r%   r)   r   r   r   r   r   r      s    r   )	__doc__r   distutils.corer   	distutilsr   r!   r   r   r   r   r   r   <module>   s    PK       ! 21L  L  %  __pycache__/bdist_msi.cpython-310.pycnu [        o
    bc                     @   s   d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZ dd	lmZ ddlZdd
lmZmZmZ ddlmZmZmZmZ G dd deZG dd deZdS )z#
Implements the bdist_msi command.
    N)Command)remove_tree)get_python_version)StrictVersion)DistutilsOptionError)get_platform)log)schemasequencetext)	DirectoryFeatureDialogadd_datac                   @   sF   e Zd ZdZdd Zdd Zddd	ZdddZdddZdd Z	dS )PyDialogzDialog class with a fixed layout: controls at the top, then a ruler,
    then a list of buttons: back, next, cancel. Optionally a bitmap at the
    left.c                 O   s@   t j| g|R   | jd }d| d }| dd|| jd dS )zbDialog(database, name, x, y, w, h, attributes, title, first,
        default, cancel, bitmap=true)$      iH  
BottomLiner   N)r   __init__hlinew)selfargskwrulerbmwidth r   2/usr/lib/python3.10/distutils/command/bdist_msi.pyr      s   
zPyDialog.__init__c              
   C   s   |  ddddddd|  dS )	z,Set the title text of the dialog at the top.Title   
   @  <     z{\VerdanaBold10}%sN)r   )r   titler   r   r   r%   #   s   zPyDialog.titleBack   c              
   C   ,   |rd}nd}|  |d| jd dd|||S )zAdd a back button with a given title, the tab-next button,
        its name in the Control table, possibly initially disabled.

        Return the button, so that events can be associated   r'         8      
pushbuttonr   r   r%   nextnameactiveflagsr   r   r   back*      zPyDialog.backCancelc              
   C   r(   )zAdd a cancel button with a given title, the tab-next button,
        its name in the Control table, possibly initially disabled.

        Return the button, so that events can be associatedr)   r'   i0  r+   r,   r-   r.   r0   r   r   r   cancel5   r6   zPyDialog.cancelNextc              
   C   r(   )zAdd a Next button with a given title, the tab-next button,
        its name in the Control table, possibly initially disabled.

        Return the button, so that events can be associatedr)   r'      r+   r,   r-   r.   r0   r   r   r   r1   @   r6   zPyDialog.nextc              
   C   s,   |  |t| j| d | jd ddd||S )zAdd a button with a given title, the tab-next button,
        its name in the Control table, giving its x position; the
        y-position is aligned with the other buttons.

        Return the button, so that events can be associated   r+   r,   r-   r)   )r/   intr   r   )r   r2   r%   r1   xposr   r   r   xbuttonK   s   ,zPyDialog.xbuttonN)r&   r'   )r7   r'   )r9   r'   )
__name__
__module____qualname____doc__r   r%   r5   r8   r1   r>   r   r   r   r   r      s    



r   c                
       s   e Zd ZdZdddde  fdddd	d
dddg
Zg dZg dZdZ fddZ	dd Z
dd Zdd Zdd Zdd Zdd Zdd  Zd!d" Z  ZS )#	bdist_msiz7create a Microsoft Installer (.msi) binary distribution)z
bdist-dir=Nz1temporary directory for creating the distributionz
plat-name=pz;platform name to embed in generated filenames (default: %s))	keep-tempkzPkeep the pseudo-installation tree around after creating the distribution archive)ztarget-version=Nz6require a specific python version on the target system)no-target-compilecz/do not compile .py to .pyc on the target system)no-target-optimizeoz;do not compile .py to .pyo (optimized) on the target system)z	dist-dir=dz-directory to put final built distributions in)
skip-buildNz2skip rebuilding everything (for testing/debugging))zinstall-script=NzUbasename of installation script to be run after installation or before deinstallation)zpre-install-script=Nz{Fully qualified filename of a script to be run before any files are installed.  This script need not be in the distribution)rE   rG   rI   rL   )z2.0z2.1z2.2z2.3z2.4z2.5z2.6z2.7z2.8z2.9z3.0z3.1z3.2z3.3z3.4z3.5z3.6z3.7z3.8z3.9Xc                    s$   t  j|i | tdtd d S )NzZbdist_msi command is deprecated since Python 3.9, use bdist_wheel (wheel packages) instead   )superr   warningswarnDeprecationWarning)r   r   r   	__class__r   r   r   }   s   zbdist_msi.__init__c                 C   sF   d | _ d | _d| _d| _d| _d | _d | _d | _d | _d | _	d | _
d S )Nr   )	bdist_dir	plat_name	keep_tempno_target_compileno_target_optimizetarget_versiondist_dir
skip_buildinstall_scriptpre_install_scriptversions)r   r   r   r   initialize_options   s   
zbdist_msi.initialize_optionsc                 C   s   |  dd | jd u r| dj}tj|d| _t }| js'| j	
 r'|| _| jrD| jg| _| jsC| j	
 rC| j|krCtd|f nt| j| _|  ddd | jrXtd| jrt| j	jD ]}| jtj|krl nq_td| j d | _d S )	Nbdist)r\   r\   msizMtarget version can only be %s, or the '--skip-build' option must be specified)r[   r[   )rV   rV   z5the pre-install-script feature is not yet implementedz(install_script '%s' not found in scripts)set_undefined_optionsrU   get_finalized_command
bdist_baseospathjoinr   rZ   distributionhas_ext_modulesr_   r\   r   listall_versionsr^   r]   scriptsbasenameinstall_script_key)r   re   short_versionscriptr   r   r   finalize_options   sJ   



zbdist_msi.finalize_optionsc                 C   s~  | j s| d | jddd}| j|_| j |_ d|_| d}d|_d|_| j	 rV| j
}|s?| j s6J ddtjd d	  }d
| j|f }| d}tj|jd| |_td| j |  tjdtj| jd |  tjd= | | j | j }| |}tj|}tj|rt| | jj }|j!}	|	s|j"}	|	sd}	|# }
dt$|
j% }| j }| j
rd| j
|f }nd| }t&'|t(|t&) ||	| _*t&+| j*t, d|
fg}|j-p|j.}|r|/d|f |j0r|/d|j0f |rt1| j*d| | 2  | 3  | 4  | 5  | j*6  t7| jdr/d| j
p%d|f}| jj8/| | j9s=t:| j| j;d d S d S )Nbuildinstallr'   )reinit_subcommandsr   install_libz Should have already checked thisz%d.%drN   z.%s-%slibzinstalling to %sPURELIBUNKNOWNz%d.%d.%dzPython %s %sz	Python %sDistVersion
ARPCONTACTARPURLINFOABOUTProperty
dist_filesrC   any)dry_run)<r\   run_commandreinitialize_commandrU   prefixwarn_dircompileoptimizeri   rj   rZ   sysversion_inforV   rd   rf   rg   rh   
build_base	build_libr   infoensure_finalizedinsertrunmkpathr[   get_fullnameget_installer_filenameabspathexistsunlinkmetadataauthor
maintainerget_versionr   versionmsilibinit_databaser	   gen_uuiddb
add_tablesr
   author_emailmaintainer_emailappendurlr   add_find_python	add_filesadd_scriptsadd_uiCommithasattrr~   rW   r   r   )r   rt   rv   rZ   plat_specifierrs   fullnameinstaller_namer   r   r   sversionproduct_namepropsemailtupr   r   r   r      s   









zbdist_msi.runc              
   C   s  | j }td}tj| j}t||d |dd}t|ddddddd}||d	fg}| j	| j
g D ]:}d| }d|  }	}
d}|| j
u rHd
}d}nd| }d}t||	||d||d}t||||||
}||||f q0|  i }|D ]\}}}|g}|r| }t|jD ]m}tj|j|}tj|rd|||f }|| }
t|||||
|}|| q|js||j|d ||vr|| }||< || jkr| jrtd| d| | _q|| }t| j d|| |j|d |jfg q|s}|  qs|| d S )N	distfiles	TARGETDIR	SourceDirPython
Everythingr   r'   )	directory zPython from another locationrN   zPython %s from registryz%s|%szMultiple files with name %sz[#%s]DuplicateFile)r   r   CABrf   rg   r   rU   r   r   r_   other_versionr   r   poplistdirabsoluterh   isdir
make_short	componentstart_componentlogicaladd_filer]   ro   r   r   commit)r   r   cabrootdirrootfitemsr   targetr2   defaultdescr%   leveldirseenfeaturetodofileafileshortnewdirkeyr   r   r   r     sf   





zbdist_msi.add_filesc                 C   s  d}| j D ]}d| }d| }d| }d| }d| }d| }d| }	d	| }
d
| }d| }tjr5d}nd}t| jd|d|d|f|d|d|fg t| jd||f||fg t| jd|d|d| d f|	d|d| d f|
d|d| d fg t| jd|||f|	||d f|
d|d fg t| jd|||f|	||d f|
d|d fg t| jdd| dd| fg |d7 }|dk sJ qdS )as  Adds code to the installer to compute the location of Python.

        Properties PYTHON.MACHINE.X.Y and PYTHON.USER.X.Y will be set from the
        registry for each version of Python.

        Properties TARGETDIRX.Y will be set from PYTHON.USER.X.Y if defined,
        else from PYTHON.MACHINE.X.Y.

        Properties PYTHONX.Y will be set to TARGETDIRX.Y\python.exei  z)SOFTWARE\Python\PythonCore\%s\InstallPathzpython.machine.zpython.user.zPYTHON.MACHINE.zPYTHON.USER.PythonFromMachinePythonFromUser	PythonExer   PYTHON   rN   
RegLocatorNr'   	AppSearchCustomActioni3  []z]\python.exeInstallExecuteSequenceInstallUISequence	Conditionr   r   zNOT TARGETDIR   i  )r_   r   Win64r   r   )r   startverinstall_pathmachine_reguser_regmachine_prop	user_propmachine_actionuser_action
exe_actiontarget_dir_propexe_propTyper   r   r   r   I  sb   
zbdist_msi.add_find_pythonc              	   C   s.  | j r5d}| j| jg D ](}d| }d| }t| jd|d|| jfg t| jd|d| |fg |d7 }q| jrtj	| j
d	}t|d
)}|d t| j}||  W d    n1 sbw   Y  W d    n1 sqw   Y  t| jddt|fg t| jddg t| jddg d S d S )Ni  zinstall_script.r   r   2   r   z&Python%s=3r'   zpreinstall.batr   zrem ="""
%1 %0
exit
"""
Binary
PreInstall)r   rN   r   N)r   zNOT Installedi  )r]   r_   r   r   r   ro   r^   rf   rg   rh   rU   openwritereadr   r   )r   r   r   install_actionr   scriptfnr   finr   r   r   r     s>   

	zbdist_msi.add_scriptsc                 C   s
  | j }d }}d}d}d}d}d}d}	t|dg d	 t|d
g d t|dg d t|dtj t|dtj t|d||||||ddd}
|
d |
jdddd |
jdddd |
ddddddd |
ddd dd!dd" |
j	dddd#}|
d$d% t|d&||||||ddd}|d' |jdddd |jdddd |ddddddd( |ddd dd!dd" |j	dddd#}|
d$d% t|d)||||||ddd}|d* |jdddd |jdddd |d+dd,dd!dd" |j	dddd#}|
d$d- t|d.||||d/|d0d0d0d1d2}|d3dd4d5ddd6 |d+d!d7d8d!dd9 |d:d!d;d<ddd= |d>d?d!d@d<dAdBdCd d d  |jd%dDd%d#}|
d$d% |j	dDd0dDd#}|
d$dD |jd0d%d0d#}|
d$d0 t|dEddFd<dGdH|dId d }|dIddJd8dKddL |dMdNdOdPdQddRd 
d$dS |dTdUdOdPdQddVd 
d$dW |dXddOdPdQddYd 
d$dZ |d[d\dOdPdQddd 
d$d] |d^dPdOdPdQddDd 
d$d_ |d`dadOdPdQddbd 
d$dc |dddedOdPdQdd0d 
d$df t|dgddFdhdid|dRdRdR}|d:dKddjdkddl |dVdOdmdndoddVdR}|
d$d% |dRdpdmdndoddRdV}|
d$d- t|dqddFdhdi||d-d-d-}|d:dKddjdkddr |d-dsdmdndodd-d }|
d$d% t|dt||||||ddd}|d+dddduddv |dw |dddxdd!ddy}|dd: |dzdd{ddkdd }|dzd: |jdd dd |j	d|d dd |dd }|
d}dg t|d~||||||d|d|d}|d |dddkdd!dd| j   |jdd dd |	dd}d}|j
dd|d | j| jg D ]}|d7 }|j
dd| d| |d q|j
ddq|d d |j
d$d-|d d |dd}|
d}dg |ddddddNddd dd }|
dd | j}d| }d| }|ddd5dddd}|d| |d| |d| |d| |dddddddd| d d|d }|d| |d| |d| |d| t|d||||||dddd1d2}|d3dd4d5ddd |d+d!d!d8d!dd |d:d!dd<ddd |ddd!dd<ddd dd d  |ddbd d
d$d- t|d||||||dd|d}|d |ddddhddddLd|	}|ddddd!d |ddddd!d |jdd dd |	dd}|
dddd |j
d$d-dd |dd}|
d}dg t|d||||||dddd1d2}|d3d!dd5ddd |d:ddddkdd |ddddd!dd |ddd|d d!ddy}|dd: |ddddNddFdd dd d }|dd |jdd|d1d |j	ddd1d |dd
d}dg t|d||||||d|d|d}|d |dddd<d\ddġ |dddd<ddddLd|	}|dddd5dodʡ |dddd5dod͡ |jdd d1d |	dd}|
dddd |
dddd4 |
ddddB |
ddddա |
ddddء |
ddddڡ |
ddddܡ |
ddddݡ |
d$d-dd! |ddš
d}dg d S )Nr   ir  i,  z[ProductName] Setupr)   r'       r}   ))DefaultUIFontDlgFont8)ErrorDialogErrorDlg)	Progress1Install)	Progress2installs)MaintenanceForm_ActionRepair)
WhichUsersALL	TextStyle))r   Tahoma	   Nr   )DlgFontBold8r
     Nr'   )VerdanaBold10Verdanar!   Nr'   )VerdanaRed9r  r     r   r   ))
PrepareDlgz(Not Privileged or Windows9x or Installed   )WhichUsersDlgz.Privileged and not Windows9x and not Installed   )SelectFeaturesDlgzNot Installedi  )MaintenanceTypeDlgz,Installed AND NOT RESUME AND NOT Preselectedi  )ProgressDlgNi   
ActionTextUIText
FatalErrorFinishz)[ProductName] Installer ended prematurelyz< Backr   )r3   r7   r&   Description1r    F   r"   P   r$   z[ProductName] setup ended prematurely because of an error.  Your system has not been modified.  To install this program at a later time, please run the installation again.Description2      z.Click the Finish button to exit the Installer.)r2   	EndDialogExitUserExitz'[ProductName] Installer was interruptedz[ProductName] setup was interrupted.  Your system has not been modified.  To install this program at a later time, please run the installation again.
ExitDialogz&Completing the [ProductName] InstallerDescription   Return
FilesInUse   RetryF)bitmapr         z{\DlgFontBold8}Files in Use   i  z8Some files that need to be updated are currently in use.Text7   iJ  zThe following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.ListListBoxk         FileInUseProcessIgnorer   r!   e   i  	ErrorTextr  0   r   Nx   H   Q      NoErrorNoY   YesErrorYesAAbort
ErrorAbortC*   ErrorCancelIErrorIgnoreO   OkErrorOkR   
ErrorRetry	CancelDlgi  U         z;Are you sure you want to cancel [ProductName] installation?9   r,   r-      WaitForCostingDlgzRPlease wait while the installer finishes determining your disk space requirements.f   r  (   zOPlease wait while the Installer prepares to guide you through the installation.z&Welcome to the [ProductName] Installern   zPondering...
ActionData   r9   SpawnDialogr  zSelect Python InstallationsHintz9Select the Python locations where %s should be installed.zNext >z[TARGETDIR]z[SourceDir])orderingz[TARGETDIR%s]z FEATURE_SELECTED AND &Python%s=3SpawnWaitDialogrN   FeaturesSelectionTreer#   FEATUREPathEditz[FEATURE_SELECTED]1z!FEATURE_SELECTED AND &Python%s<>3Otherz$Provide an alternate Python locationEnableShowDisableHide      r   DiskCostDlgOKz&{\DlgFontBold8}Disk Space RequirementszFThe disk space required for the installation of the selected features.5   a  The highlighted volumes (if any) do not have enough disk space available for the currently selected features.  You can either remove some files from the highlighted volumes, or choose to install less features onto local drive(s), or select different destination drive(s).
VolumeListVolumeCostListd      i  z{120}{70}{70}{70}{70}g      ?r  AdminInstallzGSelect whether to install [ProductName] for all users of this computer.r  r     zInstall for all usersJUSTME   zInstall just for mez
[ALLUSERS]zWhichUsers="ALL"r  z({\DlgFontBold8}[Progress1] [ProductName]#   A   zYPlease wait while the Installer [Progress2] [ProductName]. This may take several minutes.StatusLabelzStatus:ProgressBari  zProgress doneSetProgressProgressr  z)Welcome to the [ProductName] Setup WizardBodyText?   z:Select whether you want to repair or remove [ProductName].RepairRadioGroupl   r  r  r   z&Repair [ProductName]Remover   zRe&move [ProductName]z[REINSTALL]zMaintenanceForm_Action="Repair"z[Progress1]	Repairingz[Progress2]repairs	Reinstallr  z[REMOVE]zMaintenanceForm_Action="Remove"   Removing   removes      z MaintenanceForm_Action<>"Change")r   r   r   r  r  r   r%   r5   r8   r1   eventcontrolr   r/   mappingri   r   r_   r   	conditionr>   
radiogroupadd)r   r   xyr   r   r%   modalmodelesstrack_disk_spacefatalrH   	user_exitexit_dialoginuseerrorr8   costingprepseldlgorderr   r   install_other_conddont_install_other_condcost
whichusersgprogressmaintr   r   r   r     s  	



       




zbdist_msi.add_uic                 C   s<   | j rd|| j| j f }nd|| jf }tj| j|}|S )Nz%s.%s-py%s.msiz	%s.%s.msi)rZ   rV   rf   rg   rh   r[   )r   r   	base_namer   r   r   r   r     s   z bdist_msi.get_installer_filename)r?   r@   rA   descriptionr   user_optionsboolean_optionsrl   r   r   r`   rr   r   r   r   r   r   r   __classcell__r   r   rS   r   rC   S   s>    ([66&  @rC   )rB   rf   r   rP   distutils.corer   distutils.dir_utilr   distutils.sysconfigr   distutils.versionr   distutils.errorsr   distutils.utilr   	distutilsr   r   r	   r
   r   r   r   r   r   r   rC   r   r   r   r   <module>   s    >PK       ! 1F    (  __pycache__/install_data.cpython-310.pycnu [        o
    bc                     @   s<   d Z ddlZddlmZ ddlmZmZ G dd deZdS )zdistutils.command.install_data

Implements the Distutils 'install_data' command, for installing
platform-independent data files.    N)Command)change_rootconvert_pathc                   @   sF   e Zd ZdZg dZdgZdd Zdd Zdd	 Zd
d Z	dd Z
dS )install_datazinstall data files))zinstall-dir=dzIbase directory for installing data files (default: installation base dir))zroot=Nz<install everything relative to this alternate root directory)forcefz-force installation (overwrite existing files)r   c                 C   s,   d | _ g | _d | _d| _| jj| _d| _d S )Nr      )install_diroutfilesrootr   distribution
data_fileswarn_dirself r   5/usr/lib/python3.10/distutils/command/install_data.pyinitialize_options   s   

zinstall_data.initialize_optionsc                 C   s   |  dddd d S )Ninstall)r   r
   )r   r   )r   r   )set_undefined_optionsr   r   r   r   finalize_options#   s
   zinstall_data.finalize_optionsc                 C   s   |  | j | jD ]q}t|tr1t|}| jr!| d|| jf  | || j\}}| j	
| q	t|d }tj|sFtj| j|}n	| jrOt| j|}|  | |d g kra| j	
| q	|d D ]}t|}| ||\}}| j	
| qeq	d S )NzMsetup script did not provide a directory for '%s' -- installing right in '%s'r   r	   )mkpathr
   r   
isinstancestrr   r   warn	copy_filer   appendospathisabsjoinr   r   )r   r   out_dirdatar   r   r   run*   s0   


zinstall_data.runc                 C   s
   | j pg S N)r   r   r   r   r   
get_inputsK   s   
zinstall_data.get_inputsc                 C   s   | j S r'   )r   r   r   r   r   get_outputsN   s   zinstall_data.get_outputsN)__name__
__module____qualname__descriptionuser_optionsboolean_optionsr   r   r&   r(   r)   r   r   r   r   r      s    	!r   )__doc__r   distutils.corer   distutils.utilr   r   r   r   r   r   r   <module>   s
    PK       ! u<    "  __pycache__/upload.cpython-310.pycnu [        o
    bc                     @   s   d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ ddlmZmZ ddlmZ dd	lmZ dd
lmZ eeddeeddeedddZG dd deZdS )zm
distutils.command.upload

Implements the Distutils 'upload' subcommand (upload package to a package
index).
    N)standard_b64encode)	HTTPError)urlopenRequest)urlparse)DistutilsErrorDistutilsOptionError)PyPIRCCommand)spawn)logmd5sha256blake2b)
md5_digestsha256_digestblake2_256_digestc                   @   sJ   e Zd ZdZejddg Zejdg Zdd Zdd Zd	d
 Z	dd Z
dS )uploadzupload binary package to PyPI)signszsign files to upload using gpg)z	identity=izGPG identity used to sign filesr   c                 C   s,   t |  d| _d| _d| _d| _d | _d S )N r   F)r	   initialize_optionsusernamepasswordshow_responser   identity)self r   //usr/lib/python3.10/distutils/command/upload.pyr   *   s   

zupload.initialize_optionsc                 C   sz   t |  | jr| jstd|  }|i kr+|d | _|d | _|d | _|d | _	| js9| j
jr;| j
j| _d S d S d S )Nz.Must use --sign for --identity to have meaningr   r   
repositoryrealm)r	   finalize_optionsr   r   r   _read_pypircr   r   r   r    distribution)r   configr   r   r   r!   2   s   




zupload.finalize_optionsc                 C   s:   | j js
d}t|| j jD ]\}}}| ||| qd S )NzHMust create and upload files in one command (e.g. setup.py sdist upload))r#   
dist_filesr   upload_file)r   msgcommand	pyversionfilenamer   r   r   runD   s   z
upload.runc           "   
   C   s>  t | j\}}}}}}	|s|s|	rtd| j |dvr"td| | jr>ddd|g}
| jr7d| jg|
dd< t|
| jd	 t|d
}z
| }W |	  n|	  w | j
j}i ddddd| d| dtj||fd|d|ddd| d| d| d| d| d| d| d| d| | | | | d}d |d!< t D ]\}}|d u rqz
||  ||< W q t!y   Y qw | jrt|d" d
}tj|d" | f|d#< W d    n	1 sw   Y  | j"d$ | j# $d%}d&t%|&d% }d'}d(|$d% }|d) }t'( }| D ]J\}}d*| }t)|t*s@|g}|D ]5}t+|t,u rX|d+|d,  7 }|d- }nt-|$d.}|.| |.|$d. |.d/ |.| qBq/|.| |/ }d0|| jf }| 0|t1j2 d1| t-t3||d2}t4| j||d3}zt5|}|6 }|j7}W n/ t8y }  z| j9}| j7}W Y d } ~ nd } ~ w t:y }  z
| 0t-| t1j;  d } ~ ww |d4kr| 0d5||f t1j2 | j<r| =|}!d6>d7|!d7f}| 0|t1j2 d S d S d8||f }| 0|t1j; t?|)9NzIncompatible url %s)httphttpszunsupported schema gpgz--detach-signz-az--local-user   )dry_runrbz:actionfile_uploadprotocol_version1nameversioncontentfiletyper)   metadata_versionz1.0summary	home_pageauthorauthor_emaillicensedescriptionkeywordsplatformclassifiers)download_urlprovidesrequires	obsoletesr   commentz.ascgpg_signature:asciizBasic z3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s   
--s   --
z+
Content-Disposition: form-data; name="%s"z; filename="%s"r      zutf-8s   

zSubmitting %s to %sz multipart/form-data; boundary=%s)zContent-typezContent-lengthAuthorization)dataheaders   zServer response (%s): %s
zK---------------------------------------------------------------------------zUpload failed (%s): %s)@r   r   AssertionErrorr   r   r
   r0   openreadcloser#   metadataget_nameget_versionospathbasenameget_descriptionget_urlget_contactget_contact_emailget_licenceget_long_descriptionget_keywordsget_platformsget_classifiersget_download_urlget_providesget_requiresget_obsoletes_FILE_CONTENT_DIGESTSitems	hexdigest
ValueErrorr   r   encoder   decodeioBytesIO
isinstancelisttypetuplestrwritegetvalueannouncer   INFOlenr   r   getcoder'   r   codeOSErrorERRORr   _read_pypi_responsejoinr   )"r   r(   r)   r*   schemanetlocurlparamsquery	fragmentsgpg_argsfr7   metarM   digest_namedigest_cons	user_passauthboundarysep_boundaryend_boundarybodykeyvaluetitler'   rN   requestresultstatusreasonetextr   r   r   r&   L   s  


 









zupload.upload_fileN)__name__
__module____qualname__r?   r	   user_optionsboolean_optionsr   r!   r+   r&   r   r   r   r   r      s    r   )__doc__rX   rn   hashlibbase64r   urllib.errorr   urllib.requestr   r   urllib.parser   distutils.errorsr   r   distutils.corer	   distutils.spawnr
   	distutilsr   getattrrh   r   r   r   r   r   <module>   s"    


PK       ! =}c{  {    build_ext.pynu [        """distutils.command.build_ext

Implements the Distutils 'build_ext' command, for building extension
modules (currently limited to C extensions, should accommodate C++
extensions ASAP)."""

import contextlib
import os
import re
import sys
from distutils.core import Command
from distutils.errors import *
from distutils.sysconfig import customize_compiler, get_python_version
from distutils.sysconfig import get_config_h_filename
from distutils.dep_util import newer_group
from distutils.extension import Extension
from distutils.util import get_platform
from distutils import log

from site import USER_BASE

# An extension name is just a dot-separated list of Python NAMEs (ie.
# the same as a fully-qualified module name).
extension_name_re = re.compile \
    (r'^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$')


def show_compilers ():
    from distutils.ccompiler import show_compilers
    show_compilers()


class build_ext(Command):

    description = "build C/C++ extensions (compile/link to build directory)"

    # XXX thoughts on how to deal with complex command-line options like
    # these, i.e. how to make it so fancy_getopt can suck them off the
    # command line and make it look like setup.py defined the appropriate
    # lists of tuples of what-have-you.
    #   - each command needs a callback to process its command-line options
    #   - Command.__init__() needs access to its share of the whole
    #     command line (must ultimately come from
    #     Distribution.parse_command_line())
    #   - it then calls the current command class' option-parsing
    #     callback to deal with weird options like -D, which have to
    #     parse the option text and churn out some custom data
    #     structure
    #   - that data structure (in this case, a list of 2-tuples)
    #     will then be present in the command object by the time
    #     we get to finalize_options() (i.e. the constructor
    #     takes care of both command-line and client options
    #     in between initialize_options() and finalize_options())

    sep_by = " (separated by '%s')" % os.pathsep
    user_options = [
        ('build-lib=', 'b',
         "directory for compiled extension modules"),
        ('build-temp=', 't',
         "directory for temporary files (build by-products)"),
        ('plat-name=', 'p',
         "platform name to cross-compile for, if supported "
         "(default: %s)" % get_platform()),
        ('inplace', 'i',
         "ignore build-lib and put compiled extensions into the source " +
         "directory alongside your pure Python modules"),
        ('include-dirs=', 'I',
         "list of directories to search for header files" + sep_by),
        ('define=', 'D',
         "C preprocessor macros to define"),
        ('undef=', 'U',
         "C preprocessor macros to undefine"),
        ('libraries=', 'l',
         "external C libraries to link with"),
        ('library-dirs=', 'L',
         "directories to search for external C libraries" + sep_by),
        ('rpath=', 'R',
         "directories to search for shared C libraries at runtime"),
        ('link-objects=', 'O',
         "extra explicit link objects to include in the link"),
        ('debug', 'g',
         "compile/link with debugging information"),
        ('force', 'f',
         "forcibly build everything (ignore file timestamps)"),
        ('compiler=', 'c',
         "specify the compiler type"),
        ('parallel=', 'j',
         "number of parallel build jobs"),
        ('swig-cpp', None,
         "make SWIG create C++ files (default is C)"),
        ('swig-opts=', None,
         "list of SWIG command line options"),
        ('swig=', None,
         "path to the SWIG executable"),
        ('user', None,
         "add user include, library and rpath")
        ]

    boolean_options = ['inplace', 'debug', 'force', 'swig-cpp', 'user']

    help_options = [
        ('help-compiler', None,
         "list available compilers", show_compilers),
        ]

    def initialize_options(self):
        self.extensions = None
        self.build_lib = None
        self.plat_name = None
        self.build_temp = None
        self.inplace = 0
        self.package = None

        self.include_dirs = None
        self.define = None
        self.undef = None
        self.libraries = None
        self.library_dirs = None
        self.rpath = None
        self.link_objects = None
        self.debug = None
        self.force = None
        self.compiler = None
        self.swig = None
        self.swig_cpp = None
        self.swig_opts = None
        self.user = None
        self.parallel = None

    def finalize_options(self):
        from distutils import sysconfig

        self.set_undefined_options('build',
                                   ('build_lib', 'build_lib'),
                                   ('build_temp', 'build_temp'),
                                   ('compiler', 'compiler'),
                                   ('debug', 'debug'),
                                   ('force', 'force'),
                                   ('parallel', 'parallel'),
                                   ('plat_name', 'plat_name'),
                                   )

        if self.package is None:
            self.package = self.distribution.ext_package

        self.extensions = self.distribution.ext_modules

        # Make sure Python's include directories (for Python.h, pyconfig.h,
        # etc.) are in the include search path.
        py_include = sysconfig.get_python_inc()
        plat_py_include = sysconfig.get_python_inc(plat_specific=1)
        if self.include_dirs is None:
            self.include_dirs = self.distribution.include_dirs or []
        if isinstance(self.include_dirs, str):
            self.include_dirs = self.include_dirs.split(os.pathsep)

        # If in a virtualenv, add its include directory
        # Issue 16116
        if sys.exec_prefix != sys.base_exec_prefix:
            self.include_dirs.append(os.path.join(sys.exec_prefix, 'include'))

        # Put the Python "system" include dir at the end, so that
        # any local include dirs take precedence.
        self.include_dirs.extend(py_include.split(os.path.pathsep))
        if plat_py_include != py_include:
            self.include_dirs.extend(
                plat_py_include.split(os.path.pathsep))

        self.ensure_string_list('libraries')
        self.ensure_string_list('link_objects')

        # Life is easier if we're not forever checking for None, so
        # simplify these options to empty lists if unset
        if self.libraries is None:
            self.libraries = []
        if self.library_dirs is None:
            self.library_dirs = []
        elif isinstance(self.library_dirs, str):
            self.library_dirs = self.library_dirs.split(os.pathsep)

        if self.rpath is None:
            self.rpath = []
        elif isinstance(self.rpath, str):
            self.rpath = self.rpath.split(os.pathsep)

        # for extensions under windows use different directories
        # for Release and Debug builds.
        # also Python's library directory must be appended to library_dirs
        if os.name == 'nt':
            # the 'libs' directory is for binary installs - we assume that
            # must be the *native* platform.  But we don't really support
            # cross-compiling via a binary install anyway, so we let it go.
            self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs'))
            if sys.base_exec_prefix != sys.prefix:  # Issue 16116
                self.library_dirs.append(os.path.join(sys.base_exec_prefix, 'libs'))
            if self.debug:
                self.build_temp = os.path.join(self.build_temp, "Debug")
            else:
                self.build_temp = os.path.join(self.build_temp, "Release")

            # Append the source distribution include and library directories,
            # this allows distutils on windows to work in the source tree
            self.include_dirs.append(os.path.dirname(get_config_h_filename()))
            _sys_home = getattr(sys, '_home', None)
            if _sys_home:
                self.library_dirs.append(_sys_home)

            # Use the .lib files for the correct architecture
            if self.plat_name == 'win32':
                suffix = 'win32'
            else:
                # win-amd64
                suffix = self.plat_name[4:]
            new_lib = os.path.join(sys.exec_prefix, 'PCbuild')
            if suffix:
                new_lib = os.path.join(new_lib, suffix)
            self.library_dirs.append(new_lib)

        # For extensions under Cygwin, Python's library directory must be
        # appended to library_dirs
        if sys.platform[:6] == 'cygwin':
            if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
                # building third party extensions
                self.library_dirs.append(os.path.join(sys.prefix, "lib",
                                                      "python" + get_python_version(),
                                                      "config"))
            else:
                # building python standard extensions
                self.library_dirs.append('.')

        # For building extensions with a shared Python library,
        # Python's library directory must be appended to library_dirs
        # See Issues: #1600860, #4366
        if False and (sysconfig.get_config_var('Py_ENABLE_SHARED')):
            if not sysconfig.python_build:
                # building third party extensions
                self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
            else:
                # building python standard extensions
                self.library_dirs.append('.')

        # The argument parsing will result in self.define being a string, but
        # it has to be a list of 2-tuples.  All the preprocessor symbols
        # specified by the 'define' option will be set to '1'.  Multiple
        # symbols can be separated with commas.

        if self.define:
            defines = self.define.split(',')
            self.define = [(symbol, '1') for symbol in defines]

        # The option for macros to undefine is also a string from the
        # option parsing, but has to be a list.  Multiple symbols can also
        # be separated with commas here.
        if self.undef:
            self.undef = self.undef.split(',')

        if self.swig_opts is None:
            self.swig_opts = []
        else:
            self.swig_opts = self.swig_opts.split(' ')

        # Finally add the user include and library directories if requested
        if self.user:
            user_include = os.path.join(USER_BASE, "include")
            user_lib = os.path.join(USER_BASE, "lib")
            if os.path.isdir(user_include):
                self.include_dirs.append(user_include)
            if os.path.isdir(user_lib):
                self.library_dirs.append(user_lib)
                self.rpath.append(user_lib)

        if isinstance(self.parallel, str):
            try:
                self.parallel = int(self.parallel)
            except ValueError:
                raise DistutilsOptionError("parallel should be an integer")

    def run(self):
        from distutils.ccompiler import new_compiler

        # 'self.extensions', as supplied by setup.py, is a list of
        # Extension instances.  See the documentation for Extension (in
        # distutils.extension) for details.
        #
        # For backwards compatibility with Distutils 0.8.2 and earlier, we
        # also allow the 'extensions' list to be a list of tuples:
        #    (ext_name, build_info)
        # where build_info is a dictionary containing everything that
        # Extension instances do except the name, with a few things being
        # differently named.  We convert these 2-tuples to Extension
        # instances as needed.

        if not self.extensions:
            return

        # If we were asked to build any C/C++ libraries, make sure that the
        # directory where we put them is in the library search path for
        # linking extensions.
        if self.distribution.has_c_libraries():
            build_clib = self.get_finalized_command('build_clib')
            self.libraries.extend(build_clib.get_library_names() or [])
            self.library_dirs.append(build_clib.build_clib)

        # Setup the CCompiler object that we'll use to do all the
        # compiling and linking
        self.compiler = new_compiler(compiler=self.compiler,
                                     verbose=self.verbose,
                                     dry_run=self.dry_run,
                                     force=self.force)
        customize_compiler(self.compiler)
        # If we are cross-compiling, init the compiler now (if we are not
        # cross-compiling, init would not hurt, but people may rely on
        # late initialization of compiler even if they shouldn't...)
        if os.name == 'nt' and self.plat_name != get_platform():
            self.compiler.initialize(self.plat_name)

        # And make sure that any compile/link-related options (which might
        # come from the command-line or from the setup script) are set in
        # that CCompiler object -- that way, they automatically apply to
        # all compiling and linking done here.
        if self.include_dirs is not None:
            self.compiler.set_include_dirs(self.include_dirs)
        if self.define is not None:
            # 'define' option is a list of (name,value) tuples
            for (name, value) in self.define:
                self.compiler.define_macro(name, value)
        if self.undef is not None:
            for macro in self.undef:
                self.compiler.undefine_macro(macro)
        if self.libraries is not None:
            self.compiler.set_libraries(self.libraries)
        if self.library_dirs is not None:
            self.compiler.set_library_dirs(self.library_dirs)
        if self.rpath is not None:
            self.compiler.set_runtime_library_dirs(self.rpath)
        if self.link_objects is not None:
            self.compiler.set_link_objects(self.link_objects)

        # Now actually compile and link everything.
        self.build_extensions()

    def check_extensions_list(self, extensions):
        """Ensure that the list of extensions (presumably provided as a
        command option 'extensions') is valid, i.e. it is a list of
        Extension objects.  We also support the old-style list of 2-tuples,
        where the tuples are (ext_name, build_info), which are converted to
        Extension instances here.

        Raise DistutilsSetupError if the structure is invalid anywhere;
        just returns otherwise.
        """
        if not isinstance(extensions, list):
            raise DistutilsSetupError(
                  "'ext_modules' option must be a list of Extension instances")

        for i, ext in enumerate(extensions):
            if isinstance(ext, Extension):
                continue                # OK! (assume type-checking done
                                        # by Extension constructor)

            if not isinstance(ext, tuple) or len(ext) != 2:
                raise DistutilsSetupError(
                       "each element of 'ext_modules' option must be an "
                       "Extension instance or 2-tuple")

            ext_name, build_info = ext

            log.warn("old-style (ext_name, build_info) tuple found in "
                     "ext_modules for extension '%s' "
                     "-- please convert to Extension instance", ext_name)

            if not (isinstance(ext_name, str) and
                    extension_name_re.match(ext_name)):
                raise DistutilsSetupError(
                       "first element of each tuple in 'ext_modules' "
                       "must be the extension name (a string)")

            if not isinstance(build_info, dict):
                raise DistutilsSetupError(
                       "second element of each tuple in 'ext_modules' "
                       "must be a dictionary (build info)")

            # OK, the (ext_name, build_info) dict is type-safe: convert it
            # to an Extension instance.
            ext = Extension(ext_name, build_info['sources'])

            # Easy stuff: one-to-one mapping from dict elements to
            # instance attributes.
            for key in ('include_dirs', 'library_dirs', 'libraries',
                        'extra_objects', 'extra_compile_args',
                        'extra_link_args'):
                val = build_info.get(key)
                if val is not None:
                    setattr(ext, key, val)

            # Medium-easy stuff: same syntax/semantics, different names.
            ext.runtime_library_dirs = build_info.get('rpath')
            if 'def_file' in build_info:
                log.warn("'def_file' element of build info dict "
                         "no longer supported")

            # Non-trivial stuff: 'macros' split into 'define_macros'
            # and 'undef_macros'.
            macros = build_info.get('macros')
            if macros:
                ext.define_macros = []
                ext.undef_macros = []
                for macro in macros:
                    if not (isinstance(macro, tuple) and len(macro) in (1, 2)):
                        raise DistutilsSetupError(
                              "'macros' element of build info dict "
                              "must be 1- or 2-tuple")
                    if len(macro) == 1:
                        ext.undef_macros.append(macro[0])
                    elif len(macro) == 2:
                        ext.define_macros.append(macro)

            extensions[i] = ext

    def get_source_files(self):
        self.check_extensions_list(self.extensions)
        filenames = []

        # Wouldn't it be neat if we knew the names of header files too...
        for ext in self.extensions:
            filenames.extend(ext.sources)
        return filenames

    def get_outputs(self):
        # Sanity check the 'extensions' list -- can't assume this is being
        # done in the same run as a 'build_extensions()' call (in fact, we
        # can probably assume that it *isn't*!).
        self.check_extensions_list(self.extensions)

        # And build the list of output (built) filenames.  Note that this
        # ignores the 'inplace' flag, and assumes everything goes in the
        # "build" tree.
        outputs = []
        for ext in self.extensions:
            outputs.append(self.get_ext_fullpath(ext.name))
        return outputs

    def build_extensions(self):
        # First, sanity-check the 'extensions' list
        self.check_extensions_list(self.extensions)
        if self.parallel:
            self._build_extensions_parallel()
        else:
            self._build_extensions_serial()

    def _build_extensions_parallel(self):
        workers = self.parallel
        if self.parallel is True:
            workers = os.cpu_count()  # may return None
        try:
            from concurrent.futures import ThreadPoolExecutor
        except ImportError:
            workers = None

        if workers is None:
            self._build_extensions_serial()
            return

        with ThreadPoolExecutor(max_workers=workers) as executor:
            futures = [executor.submit(self.build_extension, ext)
                       for ext in self.extensions]
            for ext, fut in zip(self.extensions, futures):
                with self._filter_build_errors(ext):
                    fut.result()

    def _build_extensions_serial(self):
        for ext in self.extensions:
            with self._filter_build_errors(ext):
                self.build_extension(ext)

    @contextlib.contextmanager
    def _filter_build_errors(self, ext):
        try:
            yield
        except (CCompilerError, DistutilsError, CompileError) as e:
            if not ext.optional:
                raise
            self.warn('building extension "%s" failed: %s' %
                      (ext.name, e))

    def build_extension(self, ext):
        sources = ext.sources
        if sources is None or not isinstance(sources, (list, tuple)):
            raise DistutilsSetupError(
                  "in 'ext_modules' option (extension '%s'), "
                  "'sources' must be present and must be "
                  "a list of source filenames" % ext.name)
        # sort to make the resulting .so file build reproducible
        sources = sorted(sources)

        ext_path = self.get_ext_fullpath(ext.name)
        depends = sources + ext.depends
        if not (self.force or newer_group(depends, ext_path, 'newer')):
            log.debug("skipping '%s' extension (up-to-date)", ext.name)
            return
        else:
            log.info("building '%s' extension", ext.name)

        # First, scan the sources for SWIG definition files (.i), run
        # SWIG on 'em to create .c files, and modify the sources list
        # accordingly.
        sources = self.swig_sources(sources, ext)

        # Next, compile the source code to object files.

        # XXX not honouring 'define_macros' or 'undef_macros' -- the
        # CCompiler API needs to change to accommodate this, and I
        # want to do one thing at a time!

        # Two possible sources for extra compiler arguments:
        #   - 'extra_compile_args' in Extension object
        #   - CFLAGS environment variable (not particularly
        #     elegant, but people seem to expect it and I
        #     guess it's useful)
        # The environment variable should take precedence, and
        # any sensible compiler will give precedence to later
        # command line args.  Hence we combine them in order:
        extra_args = ext.extra_compile_args or []

        macros = ext.define_macros[:]
        for undef in ext.undef_macros:
            macros.append((undef,))

        objects = self.compiler.compile(sources,
                                         output_dir=self.build_temp,
                                         macros=macros,
                                         include_dirs=ext.include_dirs,
                                         debug=self.debug,
                                         extra_postargs=extra_args,
                                         depends=ext.depends)

        # XXX outdated variable, kept here in case third-part code
        # needs it.
        self._built_objects = objects[:]

        # Now link the object files together into a "shared object" --
        # of course, first we have to figure out all the other things
        # that go into the mix.
        if ext.extra_objects:
            objects.extend(ext.extra_objects)
        extra_args = ext.extra_link_args or []

        # Detect target language, if not provided
        language = ext.language or self.compiler.detect_language(sources)

        self.compiler.link_shared_object(
            objects, ext_path,
            libraries=self.get_libraries(ext),
            library_dirs=ext.library_dirs,
            runtime_library_dirs=ext.runtime_library_dirs,
            extra_postargs=extra_args,
            export_symbols=self.get_export_symbols(ext),
            debug=self.debug,
            build_temp=self.build_temp,
            target_lang=language)

    def swig_sources(self, sources, extension):
        """Walk the list of source files in 'sources', looking for SWIG
        interface (.i) files.  Run SWIG on all that are found, and
        return a modified 'sources' list with SWIG source files replaced
        by the generated C (or C++) files.
        """
        new_sources = []
        swig_sources = []
        swig_targets = {}

        # XXX this drops generated C/C++ files into the source tree, which
        # is fine for developers who want to distribute the generated
        # source -- but there should be an option to put SWIG output in
        # the temp dir.

        if self.swig_cpp:
            log.warn("--swig-cpp is deprecated - use --swig-opts=-c++")

        if self.swig_cpp or ('-c++' in self.swig_opts) or \
           ('-c++' in extension.swig_opts):
            target_ext = '.cpp'
        else:
            target_ext = '.c'

        for source in sources:
            (base, ext) = os.path.splitext(source)
            if ext == ".i":             # SWIG interface file
                new_sources.append(base + '_wrap' + target_ext)
                swig_sources.append(source)
                swig_targets[source] = new_sources[-1]
            else:
                new_sources.append(source)

        if not swig_sources:
            return new_sources

        swig = self.swig or self.find_swig()
        swig_cmd = [swig, "-python"]
        swig_cmd.extend(self.swig_opts)
        if self.swig_cpp:
            swig_cmd.append("-c++")

        # Do not override commandline arguments
        if not self.swig_opts:
            for o in extension.swig_opts:
                swig_cmd.append(o)

        for source in swig_sources:
            target = swig_targets[source]
            log.info("swigging %s to %s", source, target)
            self.spawn(swig_cmd + ["-o", target, source])

        return new_sources

    def find_swig(self):
        """Return the name of the SWIG executable.  On Unix, this is
        just "swig" -- it should be in the PATH.  Tries a bit harder on
        Windows.
        """
        if os.name == "posix":
            return "swig"
        elif os.name == "nt":
            # Look for SWIG in its standard installation directory on
            # Windows (or so I presume!).  If we find it there, great;
            # if not, act like Unix and assume it's in the PATH.
            for vers in ("1.3", "1.2", "1.1"):
                fn = os.path.join("c:\\swig%s" % vers, "swig.exe")
                if os.path.isfile(fn):
                    return fn
            else:
                return "swig.exe"
        else:
            raise DistutilsPlatformError(
                  "I don't know how to find (much less run) SWIG "
                  "on platform '%s'" % os.name)

    # -- Name generators -----------------------------------------------
    # (extension names, filenames, whatever)
    def get_ext_fullpath(self, ext_name):
        """Returns the path of the filename for a given extension.

        The file is located in `build_lib` or directly in the package
        (inplace option).
        """
        fullname = self.get_ext_fullname(ext_name)
        modpath = fullname.split('.')
        filename = self.get_ext_filename(modpath[-1])

        if not self.inplace:
            # no further work needed
            # returning :
            #   build_dir/package/path/filename
            filename = os.path.join(*modpath[:-1]+[filename])
            return os.path.join(self.build_lib, filename)

        # the inplace option requires to find the package directory
        # using the build_py command for that
        package = '.'.join(modpath[0:-1])
        build_py = self.get_finalized_command('build_py')
        package_dir = os.path.abspath(build_py.get_package_dir(package))

        # returning
        #   package_dir/filename
        return os.path.join(package_dir, filename)

    def get_ext_fullname(self, ext_name):
        """Returns the fullname of a given extension name.

        Adds the `package.` prefix"""
        if self.package is None:
            return ext_name
        else:
            return self.package + '.' + ext_name

    def get_ext_filename(self, ext_name):
        r"""Convert the name of an extension (eg. "foo.bar") into the name
        of the file from which it will be loaded (eg. "foo/bar.so", or
        "foo\bar.pyd").
        """
        from distutils.sysconfig import get_config_var
        ext_path = ext_name.split('.')
        ext_suffix = get_config_var('EXT_SUFFIX')
        return os.path.join(*ext_path) + ext_suffix

    def get_export_symbols(self, ext):
        """Return the list of symbols that a shared extension has to
        export.  This either uses 'ext.export_symbols' or, if it's not
        provided, "PyInit_" + module_name.  Only relevant on Windows, where
        the .pyd file (DLL) must export the module "PyInit_" function.
        """
        suffix = '_' + ext.name.split('.')[-1]
        try:
            # Unicode module name support as defined in PEP-489
            # https://www.python.org/dev/peps/pep-0489/#export-hook-name
            suffix.encode('ascii')
        except UnicodeEncodeError:
            suffix = 'U' + suffix.encode('punycode').replace(b'-', b'_').decode('ascii')

        initfunc_name = "PyInit" + suffix
        if initfunc_name not in ext.export_symbols:
            ext.export_symbols.append(initfunc_name)
        return ext.export_symbols

    def get_libraries(self, ext):
        """Return the list of libraries to link against when building a
        shared extension.  On most platforms, this is just 'ext.libraries';
        on Windows, we add the Python library (eg. python20.dll).
        """
        # The python library is always needed on Windows.  For MSVC, this
        # is redundant, since the library is mentioned in a pragma in
        # pyconfig.h that MSVC groks.  The other Windows compilers all seem
        # to need it mentioned explicitly, though, so that's what we do.
        # Append '_d' to the python import library on debug builds.
        if sys.platform == "win32":
            from distutils._msvccompiler import MSVCCompiler
            if not isinstance(self.compiler, MSVCCompiler):
                template = "python%d%d"
                if self.debug:
                    template = template + '_d'
                pythonlib = (template %
                       (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
                # don't extend ext.libraries, it may be shared with other
                # extensions, it is a reference to the original list
                return ext.libraries + [pythonlib]
        else:
            # On Android only the main executable and LD_PRELOADs are considered
            # to be RTLD_GLOBAL, all the dependencies of the main executable
            # remain RTLD_LOCAL and so the shared libraries must be linked with
            # libpython when python is built with a shared python library (issue
            # bpo-21536).
            # On Cygwin (and if required, other POSIX-like platforms based on
            # Windows like MinGW) it is simply necessary that all symbols in
            # shared libraries are resolved at link time.
            from distutils.sysconfig import get_config_var
            link_libpython = False
            if False and get_config_var('Py_ENABLE_SHARED'):
                # A native build on an Android device or on Cygwin
                if hasattr(sys, 'getandroidapilevel'):
                    link_libpython = True
                elif sys.platform == 'cygwin':
                    link_libpython = True
                elif '_PYTHON_HOST_PLATFORM' in os.environ:
                    # We are cross-compiling for one of the relevant platforms
                    if get_config_var('ANDROID_API_LEVEL') != 0:
                        link_libpython = True
                    elif get_config_var('MACHDEP') == 'cygwin':
                        link_libpython = True

            if link_libpython:
                ldversion = get_config_var('LDVERSION')
                return ext.libraries + ['python' + ldversion]

        return ext.libraries
PK       !       install_data.pynu [        """distutils.command.install_data

Implements the Distutils 'install_data' command, for installing
platform-independent data files."""

# contributed by Bastian Kleineidam

import os
from distutils.core import Command
from distutils.util import change_root, convert_path

class install_data(Command):

    description = "install data files"

    user_options = [
        ('install-dir=', 'd',
         "base directory for installing data files "
         "(default: installation base dir)"),
        ('root=', None,
         "install everything relative to this alternate root directory"),
        ('force', 'f', "force installation (overwrite existing files)"),
        ]

    boolean_options = ['force']

    def initialize_options(self):
        self.install_dir = None
        self.outfiles = []
        self.root = None
        self.force = 0
        self.data_files = self.distribution.data_files
        self.warn_dir = 1

    def finalize_options(self):
        self.set_undefined_options('install',
                                   ('install_data', 'install_dir'),
                                   ('root', 'root'),
                                   ('force', 'force'),
                                  )

    def run(self):
        self.mkpath(self.install_dir)
        for f in self.data_files:
            if isinstance(f, str):
                # it's a simple file, so copy it
                f = convert_path(f)
                if self.warn_dir:
                    self.warn("setup script did not provide a directory for "
                              "'%s' -- installing right in '%s'" %
                              (f, self.install_dir))
                (out, _) = self.copy_file(f, self.install_dir)
                self.outfiles.append(out)
            else:
                # it's a tuple with path to install to and a list of files
                dir = convert_path(f[0])
                if not os.path.isabs(dir):
                    dir = os.path.join(self.install_dir, dir)
                elif self.root:
                    dir = change_root(self.root, dir)
                self.mkpath(dir)

                if f[1] == []:
                    # If there are no files listed, the user must be
                    # trying to create an empty directory, so add the
                    # directory to the list of output files.
                    self.outfiles.append(dir)
                else:
                    # Copy files, adding them to the list of output files.
                    for data in f[1]:
                        data = convert_path(data)
                        (out, _) = self.copy_file(data, dir)
                        self.outfiles.append(out)

    def get_inputs(self):
        return self.data_files or []

    def get_outputs(self):
        return self.outfiles
PK       ! w1  1    bdist_dumb.pynu [        """distutils.command.bdist_dumb

Implements the Distutils 'bdist_dumb' command (create a "dumb" built
distribution -- i.e., just an archive to be unpacked under $prefix or
$exec_prefix)."""

import os
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log

class bdist_dumb(Command):

    description = "create a \"dumb\" built distribution"

    user_options = [('bdist-dir=', 'd',
                     "temporary directory for creating the distribution"),
                    ('plat-name=', 'p',
                     "platform name to embed in generated filenames "
                     "(default: %s)" % get_platform()),
                    ('format=', 'f',
                     "archive format to create (tar, gztar, bztar, xztar, "
                     "ztar, zip)"),
                    ('keep-temp', 'k',
                     "keep the pseudo-installation tree around after " +
                     "creating the distribution archive"),
                    ('dist-dir=', 'd',
                     "directory to put final built distributions in"),
                    ('skip-build', None,
                     "skip rebuilding everything (for testing/debugging)"),
                    ('relative', None,
                     "build the archive using relative paths "
                     "(default: false)"),
                    ('owner=', 'u',
                     "Owner name used when creating a tar file"
                     " [default: current user]"),
                    ('group=', 'g',
                     "Group name used when creating a tar file"
                     " [default: current group]"),
                   ]

    boolean_options = ['keep-temp', 'skip-build', 'relative']

    default_format = { 'posix': 'gztar',
                       'nt': 'zip' }

    def initialize_options(self):
        self.bdist_dir = None
        self.plat_name = None
        self.format = None
        self.keep_temp = 0
        self.dist_dir = None
        self.skip_build = None
        self.relative = 0
        self.owner = None
        self.group = None

    def finalize_options(self):
        if self.bdist_dir is None:
            bdist_base = self.get_finalized_command('bdist').bdist_base
            self.bdist_dir = os.path.join(bdist_base, 'dumb')

        if self.format is None:
            try:
                self.format = self.default_format[os.name]
            except KeyError:
                raise DistutilsPlatformError(
                       "don't know how to create dumb built distributions "
                       "on platform %s" % os.name)

        self.set_undefined_options('bdist',
                                   ('dist_dir', 'dist_dir'),
                                   ('plat_name', 'plat_name'),
                                   ('skip_build', 'skip_build'))

    def run(self):
        if not self.skip_build:
            self.run_command('build')

        install = self.reinitialize_command('install', reinit_subcommands=1)
        install.root = self.bdist_dir
        install.skip_build = self.skip_build
        install.warn_dir = 0

        log.info("installing to %s", self.bdist_dir)
        self.run_command('install')

        # And make an archive relative to the root of the
        # pseudo-installation tree.
        archive_basename = "%s.%s" % (self.distribution.get_fullname(),
                                      self.plat_name)

        pseudoinstall_root = os.path.join(self.dist_dir, archive_basename)
        if not self.relative:
            archive_root = self.bdist_dir
        else:
            if (self.distribution.has_ext_modules() and
                (install.install_base != install.install_platbase)):
                raise DistutilsPlatformError(
                       "can't make a dumb built distribution where "
                       "base and platbase are different (%s, %s)"
                       % (repr(install.install_base),
                          repr(install.install_platbase)))
            else:
                archive_root = os.path.join(self.bdist_dir,
                                   ensure_relative(install.install_base))

        # Make the archive
        filename = self.make_archive(pseudoinstall_root,
                                     self.format, root_dir=archive_root,
                                     owner=self.owner, group=self.group)
        if self.distribution.has_ext_modules():
            pyversion = get_python_version()
        else:
            pyversion = 'any'
        self.distribution.dist_files.append(('bdist_dumb', pyversion,
                                             filename))

        if not self.keep_temp:
            remove_tree(self.bdist_dir, dry_run=self.dry_run)
PK       ! H    	  upload.pynu [        """
distutils.command.upload

Implements the Distutils 'upload' subcommand (upload package to a package
index).
"""

import os
import io
import hashlib
from base64 import standard_b64encode
from urllib.error import HTTPError
from urllib.request import urlopen, Request
from urllib.parse import urlparse
from distutils.errors import DistutilsError, DistutilsOptionError
from distutils.core import PyPIRCCommand
from distutils.spawn import spawn
from distutils import log


# PyPI Warehouse supports MD5, SHA256, and Blake2 (blake2-256)
# https://bugs.python.org/issue40698
_FILE_CONTENT_DIGESTS = {
    "md5_digest": getattr(hashlib, "md5", None),
    "sha256_digest": getattr(hashlib, "sha256", None),
    "blake2_256_digest": getattr(hashlib, "blake2b", None),
}


class upload(PyPIRCCommand):

    description = "upload binary package to PyPI"

    user_options = PyPIRCCommand.user_options + [
        ('sign', 's',
         'sign files to upload using gpg'),
        ('identity=', 'i', 'GPG identity used to sign files'),
        ]

    boolean_options = PyPIRCCommand.boolean_options + ['sign']

    def initialize_options(self):
        PyPIRCCommand.initialize_options(self)
        self.username = ''
        self.password = ''
        self.show_response = 0
        self.sign = False
        self.identity = None

    def finalize_options(self):
        PyPIRCCommand.finalize_options(self)
        if self.identity and not self.sign:
            raise DistutilsOptionError(
                "Must use --sign for --identity to have meaning"
            )
        config = self._read_pypirc()
        if config != {}:
            self.username = config['username']
            self.password = config['password']
            self.repository = config['repository']
            self.realm = config['realm']

        # getting the password from the distribution
        # if previously set by the register command
        if not self.password and self.distribution.password:
            self.password = self.distribution.password

    def run(self):
        if not self.distribution.dist_files:
            msg = ("Must create and upload files in one command "
                   "(e.g. setup.py sdist upload)")
            raise DistutilsOptionError(msg)
        for command, pyversion, filename in self.distribution.dist_files:
            self.upload_file(command, pyversion, filename)

    def upload_file(self, command, pyversion, filename):
        # Makes sure the repository URL is compliant
        schema, netloc, url, params, query, fragments = \
            urlparse(self.repository)
        if params or query or fragments:
            raise AssertionError("Incompatible url %s" % self.repository)

        if schema not in ('http', 'https'):
            raise AssertionError("unsupported schema " + schema)

        # Sign if requested
        if self.sign:
            gpg_args = ["gpg", "--detach-sign", "-a", filename]
            if self.identity:
                gpg_args[2:2] = ["--local-user", self.identity]
            spawn(gpg_args,
                  dry_run=self.dry_run)

        # Fill in the data - send all the meta-data in case we need to
        # register a new release
        f = open(filename,'rb')
        try:
            content = f.read()
        finally:
            f.close()

        meta = self.distribution.metadata
        data = {
            # action
            ':action': 'file_upload',
            'protocol_version': '1',

            # identify release
            'name': meta.get_name(),
            'version': meta.get_version(),

            # file content
            'content': (os.path.basename(filename),content),
            'filetype': command,
            'pyversion': pyversion,

            # additional meta-data
            'metadata_version': '1.0',
            'summary': meta.get_description(),
            'home_page': meta.get_url(),
            'author': meta.get_contact(),
            'author_email': meta.get_contact_email(),
            'license': meta.get_licence(),
            'description': meta.get_long_description(),
            'keywords': meta.get_keywords(),
            'platform': meta.get_platforms(),
            'classifiers': meta.get_classifiers(),
            'download_url': meta.get_download_url(),
            # PEP 314
            'provides': meta.get_provides(),
            'requires': meta.get_requires(),
            'obsoletes': meta.get_obsoletes(),
            }

        data['comment'] = ''

        # file content digests
        for digest_name, digest_cons in _FILE_CONTENT_DIGESTS.items():
            if digest_cons is None:
                continue
            try:
                data[digest_name] = digest_cons(content).hexdigest()
            except ValueError:
                # hash digest not available or blocked by security policy
                pass

        if self.sign:
            with open(filename + ".asc", "rb") as f:
                data['gpg_signature'] = (os.path.basename(filename) + ".asc",
                                         f.read())

        # set up the authentication
        user_pass = (self.username + ":" + self.password).encode('ascii')
        # The exact encoding of the authentication string is debated.
        # Anyway PyPI only accepts ascii for both username or password.
        auth = "Basic " + standard_b64encode(user_pass).decode('ascii')

        # Build up the MIME payload for the POST data
        boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
        sep_boundary = b'\r\n--' + boundary.encode('ascii')
        end_boundary = sep_boundary + b'--\r\n'
        body = io.BytesIO()
        for key, value in data.items():
            title = '\r\nContent-Disposition: form-data; name="%s"' % key
            # handle multiple entries for the same name
            if not isinstance(value, list):
                value = [value]
            for value in value:
                if type(value) is tuple:
                    title += '; filename="%s"' % value[0]
                    value = value[1]
                else:
                    value = str(value).encode('utf-8')
                body.write(sep_boundary)
                body.write(title.encode('utf-8'))
                body.write(b"\r\n\r\n")
                body.write(value)
        body.write(end_boundary)
        body = body.getvalue()

        msg = "Submitting %s to %s" % (filename, self.repository)
        self.announce(msg, log.INFO)

        # build the Request
        headers = {
            'Content-type': 'multipart/form-data; boundary=%s' % boundary,
            'Content-length': str(len(body)),
            'Authorization': auth,
        }

        request = Request(self.repository, data=body,
                          headers=headers)
        # send the data
        try:
            result = urlopen(request)
            status = result.getcode()
            reason = result.msg
        except HTTPError as e:
            status = e.code
            reason = e.msg
        except OSError as e:
            self.announce(str(e), log.ERROR)
            raise

        if status == 200:
            self.announce('Server response (%s): %s' % (status, reason),
                          log.INFO)
            if self.show_response:
                text = self._read_pypi_response(result)
                msg = '\n'.join(('-' * 75, text, '-' * 75))
                self.announce(msg, log.INFO)
        else:
            msg = 'Upload failed (%s): %s' % (status, reason)
            self.announce(msg, log.ERROR)
            raise DistutilsError(msg)
PK       ! ^      __init__.pynu [        """distutils.command

Package containing implementation of all the standard Distutils
commands."""

__all__ = ['build',
           'build_py',
           'build_ext',
           'build_clib',
           'build_scripts',
           'clean',
           'install',
           'install_lib',
           'install_headers',
           'install_scripts',
           'install_data',
           'sdist',
           'register',
           'bdist',
           'bdist_dumb',
           'bdist_rpm',
           'check',
           'upload',
           # These two are reserved for future use:
           #'bdist_sdux',
           #'bdist_pkgtool',
           # Note:
           # bdist_packager is not included because it only provides
           # an abstract base class
          ]
PK       ! s&C  &C    build_py.pynu [        """distutils.command.build_py

Implements the Distutils 'build_py' command."""

import os
import importlib.util
import sys
import glob

from distutils.core import Command
from distutils.errors import *
from distutils.util import convert_path, Mixin2to3
from distutils import log

class build_py (Command):

    description = "\"build\" pure Python modules (copy to build directory)"

    user_options = [
        ('build-lib=', 'd', "directory to \"build\" (copy) to"),
        ('compile', 'c', "compile .py to .pyc"),
        ('no-compile', None, "don't compile .py files [default]"),
        ('optimize=', 'O',
         "also compile with optimization: -O1 for \"python -O\", "
         "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),
        ('force', 'f', "forcibly build everything (ignore file timestamps)"),
        ]

    boolean_options = ['compile', 'force']
    negative_opt = {'no-compile' : 'compile'}

    def initialize_options(self):
        self.build_lib = None
        self.py_modules = None
        self.package = None
        self.package_data = None
        self.package_dir = None
        self.compile = 0
        self.optimize = 0
        self.force = None

    def finalize_options(self):
        self.set_undefined_options('build',
                                   ('build_lib', 'build_lib'),
                                   ('force', 'force'))

        # Get the distribution options that are aliases for build_py
        # options -- list of packages and list of modules.
        self.packages = self.distribution.packages
        self.py_modules = self.distribution.py_modules
        self.package_data = self.distribution.package_data
        self.package_dir = {}
        if self.distribution.package_dir:
            for name, path in self.distribution.package_dir.items():
                self.package_dir[name] = convert_path(path)
        self.data_files = self.get_data_files()

        # Ick, copied straight from install_lib.py (fancy_getopt needs a
        # type system!  Hell, *everything* needs a type system!!!)
        if not isinstance(self.optimize, int):
            try:
                self.optimize = int(self.optimize)
                assert 0 <= self.optimize <= 2
            except (ValueError, AssertionError):
                raise DistutilsOptionError("optimize must be 0, 1, or 2")

    def run(self):
        # XXX copy_file by default preserves atime and mtime.  IMHO this is
        # the right thing to do, but perhaps it should be an option -- in
        # particular, a site administrator might want installed files to
        # reflect the time of installation rather than the last
        # modification time before the installed release.

        # XXX copy_file by default preserves mode, which appears to be the
        # wrong thing to do: if a file is read-only in the working
        # directory, we want it to be installed read/write so that the next
        # installation of the same module distribution can overwrite it
        # without problems.  (This might be a Unix-specific issue.)  Thus
        # we turn off 'preserve_mode' when copying to the build directory,
        # since the build directory is supposed to be exactly what the
        # installation will look like (ie. we preserve mode when
        # installing).

        # Two options control which modules will be installed: 'packages'
        # and 'py_modules'.  The former lets us work with whole packages, not
        # specifying individual modules at all; the latter is for
        # specifying modules one-at-a-time.

        if self.py_modules:
            self.build_modules()
        if self.packages:
            self.build_packages()
            self.build_package_data()

        self.byte_compile(self.get_outputs(include_bytecode=0))

    def get_data_files(self):
        """Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
        data = []
        if not self.packages:
            return data
        for package in self.packages:
            # Locate package source directory
            src_dir = self.get_package_dir(package)

            # Compute package build directory
            build_dir = os.path.join(*([self.build_lib] + package.split('.')))

            # Length of path to strip from found files
            plen = 0
            if src_dir:
                plen = len(src_dir)+1

            # Strip directory from globbed filenames
            filenames = [
                file[plen:] for file in self.find_data_files(package, src_dir)
                ]
            data.append((package, src_dir, build_dir, filenames))
        return data

    def find_data_files(self, package, src_dir):
        """Return filenames for package's data files in 'src_dir'"""
        globs = (self.package_data.get('', [])
                 + self.package_data.get(package, []))
        files = []
        for pattern in globs:
            # Each pattern has to be converted to a platform-specific path
            filelist = glob.glob(os.path.join(glob.escape(src_dir), convert_path(pattern)))
            # Files that match more than one pattern are only added once
            files.extend([fn for fn in filelist if fn not in files
                and os.path.isfile(fn)])
        return files

    def build_package_data(self):
        """Copy data files into build directory"""
        lastdir = None
        for package, src_dir, build_dir, filenames in self.data_files:
            for filename in filenames:
                target = os.path.join(build_dir, filename)
                self.mkpath(os.path.dirname(target))
                self.copy_file(os.path.join(src_dir, filename), target,
                               preserve_mode=False)

    def get_package_dir(self, package):
        """Return the directory, relative to the top of the source
           distribution, where package 'package' should be found
           (at least according to the 'package_dir' option, if any)."""
        path = package.split('.')

        if not self.package_dir:
            if path:
                return os.path.join(*path)
            else:
                return ''
        else:
            tail = []
            while path:
                try:
                    pdir = self.package_dir['.'.join(path)]
                except KeyError:
                    tail.insert(0, path[-1])
                    del path[-1]
                else:
                    tail.insert(0, pdir)
                    return os.path.join(*tail)
            else:
                # Oops, got all the way through 'path' without finding a
                # match in package_dir.  If package_dir defines a directory
                # for the root (nameless) package, then fallback on it;
                # otherwise, we might as well have not consulted
                # package_dir at all, as we just use the directory implied
                # by 'tail' (which should be the same as the original value
                # of 'path' at this point).
                pdir = self.package_dir.get('')
                if pdir is not None:
                    tail.insert(0, pdir)

                if tail:
                    return os.path.join(*tail)
                else:
                    return ''

    def check_package(self, package, package_dir):
        # Empty dir name means current directory, which we can probably
        # assume exists.  Also, os.path.exists and isdir don't know about
        # my "empty string means current dir" convention, so we have to
        # circumvent them.
        if package_dir != "":
            if not os.path.exists(package_dir):
                raise DistutilsFileError(
                      "package directory '%s' does not exist" % package_dir)
            if not os.path.isdir(package_dir):
                raise DistutilsFileError(
                       "supposed package directory '%s' exists, "
                       "but is not a directory" % package_dir)

        # Require __init__.py for all but the "root package"
        if package:
            init_py = os.path.join(package_dir, "__init__.py")
            if os.path.isfile(init_py):
                return init_py
            else:
                log.warn(("package init file '%s' not found " +
                          "(or not a regular file)"), init_py)

        # Either not in a package at all (__init__.py not expected), or
        # __init__.py doesn't exist -- so don't return the filename.
        return None

    def check_module(self, module, module_file):
        if not os.path.isfile(module_file):
            log.warn("file %s (for module %s) not found", module_file, module)
            return False
        else:
            return True

    def find_package_modules(self, package, package_dir):
        self.check_package(package, package_dir)
        module_files = glob.glob(os.path.join(glob.escape(package_dir), "*.py"))
        modules = []
        setup_script = os.path.abspath(self.distribution.script_name)

        for f in module_files:
            abs_f = os.path.abspath(f)
            if abs_f != setup_script:
                module = os.path.splitext(os.path.basename(f))[0]
                modules.append((package, module, f))
            else:
                self.debug_print("excluding %s" % setup_script)
        return modules

    def find_modules(self):
        """Finds individually-specified Python modules, ie. those listed by
        module name in 'self.py_modules'.  Returns a list of tuples (package,
        module_base, filename): 'package' is a tuple of the path through
        package-space to the module; 'module_base' is the bare (no
        packages, no dots) module name, and 'filename' is the path to the
        ".py" file (relative to the distribution root) that implements the
        module.
        """
        # Map package names to tuples of useful info about the package:
        #    (package_dir, checked)
        # package_dir - the directory where we'll find source files for
        #   this package
        # checked - true if we have checked that the package directory
        #   is valid (exists, contains __init__.py, ... ?)
        packages = {}

        # List of (package, module, filename) tuples to return
        modules = []

        # We treat modules-in-packages almost the same as toplevel modules,
        # just the "package" for a toplevel is empty (either an empty
        # string or empty list, depending on context).  Differences:
        #   - don't check for __init__.py in directory for empty package
        for module in self.py_modules:
            path = module.split('.')
            package = '.'.join(path[0:-1])
            module_base = path[-1]

            try:
                (package_dir, checked) = packages[package]
            except KeyError:
                package_dir = self.get_package_dir(package)
                checked = 0

            if not checked:
                init_py = self.check_package(package, package_dir)
                packages[package] = (package_dir, 1)
                if init_py:
                    modules.append((package, "__init__", init_py))

            # XXX perhaps we should also check for just .pyc files
            # (so greedy closed-source bastards can distribute Python
            # modules too)
            module_file = os.path.join(package_dir, module_base + ".py")
            if not self.check_module(module, module_file):
                continue

            modules.append((package, module_base, module_file))

        return modules

    def find_all_modules(self):
        """Compute the list of all modules that will be built, whether
        they are specified one-module-at-a-time ('self.py_modules') or
        by whole packages ('self.packages').  Return a list of tuples
        (package, module, module_file), just like 'find_modules()' and
        'find_package_modules()' do."""
        modules = []
        if self.py_modules:
            modules.extend(self.find_modules())
        if self.packages:
            for package in self.packages:
                package_dir = self.get_package_dir(package)
                m = self.find_package_modules(package, package_dir)
                modules.extend(m)
        return modules

    def get_source_files(self):
        return [module[-1] for module in self.find_all_modules()]

    def get_module_outfile(self, build_dir, package, module):
        outfile_path = [build_dir] + list(package) + [module + ".py"]
        return os.path.join(*outfile_path)

    def get_outputs(self, include_bytecode=1):
        modules = self.find_all_modules()
        outputs = []
        for (package, module, module_file) in modules:
            package = package.split('.')
            filename = self.get_module_outfile(self.build_lib, package, module)
            outputs.append(filename)
            if include_bytecode:
                if self.compile:
                    outputs.append(importlib.util.cache_from_source(
                        filename, optimization=''))
                if self.optimize > 0:
                    outputs.append(importlib.util.cache_from_source(
                        filename, optimization=self.optimize))

        outputs += [
            os.path.join(build_dir, filename)
            for package, src_dir, build_dir, filenames in self.data_files
            for filename in filenames
            ]

        return outputs

    def build_module(self, module, module_file, package):
        if isinstance(package, str):
            package = package.split('.')
        elif not isinstance(package, (list, tuple)):
            raise TypeError(
                  "'package' must be a string (dot-separated), list, or tuple")

        # Now put the module source file into the "build" area -- this is
        # easy, we just copy it somewhere under self.build_lib (the build
        # directory for Python source).
        outfile = self.get_module_outfile(self.build_lib, package, module)
        dir = os.path.dirname(outfile)
        self.mkpath(dir)
        return self.copy_file(module_file, outfile, preserve_mode=0)

    def build_modules(self):
        modules = self.find_modules()
        for (package, module, module_file) in modules:
            # Now "build" the module -- ie. copy the source file to
            # self.build_lib (the build directory for Python source).
            # (Actually, it gets copied to the directory for this package
            # under self.build_lib.)
            self.build_module(module, module_file, package)

    def build_packages(self):
        for package in self.packages:
            # Get list of (package, module, module_file) tuples based on
            # scanning the package directory.  'package' is only included
            # in the tuple so that 'find_modules()' and
            # 'find_package_tuples()' have a consistent interface; it's
            # ignored here (apart from a sanity check).  Also, 'module' is
            # the *unqualified* module name (ie. no dots, no package -- we
            # already know its package!), and 'module_file' is the path to
            # the .py file, relative to the current directory
            # (ie. including 'package_dir').
            package_dir = self.get_package_dir(package)
            modules = self.find_package_modules(package, package_dir)

            # Now loop over the modules we found, "building" each one (just
            # copy it to self.build_lib).
            for (package_, module, module_file) in modules:
                assert package == package_
                self.build_module(module, module_file, package)

    def byte_compile(self, files):
        if sys.dont_write_bytecode:
            self.warn('byte-compiling is disabled, skipping.')
            return

        from distutils.util import byte_compile
        prefix = self.build_lib
        if prefix[-1] != os.sep:
            prefix = prefix + os.sep

        # XXX this code is essentially the same as the 'byte_compile()
        # method of the "install_lib" command, except for the determination
        # of the 'prefix' string.  Hmmm.
        if self.compile:
            byte_compile(files, optimize=0,
                         force=self.force, prefix=prefix, dry_run=self.dry_run)
        if self.optimize > 0:
            byte_compile(files, optimize=self.optimize,
                         force=self.force, prefix=prefix, dry_run=self.dry_run)

class build_py_2to3(build_py, Mixin2to3):
    def run(self):
        self.updated_files = []

        # Base class code
        if self.py_modules:
            self.build_modules()
        if self.packages:
            self.build_packages()
            self.build_package_data()

        # 2to3
        self.run_2to3(self.updated_files)

        # Remaining base class code
        self.byte_compile(self.get_outputs(include_bytecode=0))

    def build_module(self, module, module_file, package):
        res = build_py.build_module(self, module, module_file, package)
        if res[1]:
            # file was copied
            self.updated_files.append(res[0])
        return res
PK       ! -  -    register.pynu [        """distutils.command.register

Implements the Distutils 'register' command (register with the repository).
"""

# created 2002/10/21, Richard Jones

import getpass
import io
import urllib.parse, urllib.request
from warnings import warn

from distutils.core import PyPIRCCommand
from distutils.errors import *
from distutils import log

class register(PyPIRCCommand):

    description = ("register the distribution with the Python package index")
    user_options = PyPIRCCommand.user_options + [
        ('list-classifiers', None,
         'list the valid Trove classifiers'),
        ('strict', None ,
         'Will stop the registering if the meta-data are not fully compliant')
        ]
    boolean_options = PyPIRCCommand.boolean_options + [
        'verify', 'list-classifiers', 'strict']

    sub_commands = [('check', lambda self: True)]

    def initialize_options(self):
        PyPIRCCommand.initialize_options(self)
        self.list_classifiers = 0
        self.strict = 0

    def finalize_options(self):
        PyPIRCCommand.finalize_options(self)
        # setting options for the `check` subcommand
        check_options = {'strict': ('register', self.strict),
                         'restructuredtext': ('register', 1)}
        self.distribution.command_options['check'] = check_options

    def run(self):
        self.finalize_options()
        self._set_config()

        # Run sub commands
        for cmd_name in self.get_sub_commands():
            self.run_command(cmd_name)

        if self.dry_run:
            self.verify_metadata()
        elif self.list_classifiers:
            self.classifiers()
        else:
            self.send_metadata()

    def check_metadata(self):
        """Deprecated API."""
        warn("distutils.command.register.check_metadata is deprecated, \
              use the check command instead", PendingDeprecationWarning)
        check = self.distribution.get_command_obj('check')
        check.ensure_finalized()
        check.strict = self.strict
        check.restructuredtext = 1
        check.run()

    def _set_config(self):
        ''' Reads the configuration file and set attributes.
        '''
        config = self._read_pypirc()
        if config != {}:
            self.username = config['username']
            self.password = config['password']
            self.repository = config['repository']
            self.realm = config['realm']
            self.has_config = True
        else:
            if self.repository not in ('pypi', self.DEFAULT_REPOSITORY):
                raise ValueError('%s not found in .pypirc' % self.repository)
            if self.repository == 'pypi':
                self.repository = self.DEFAULT_REPOSITORY
            self.has_config = False

    def classifiers(self):
        ''' Fetch the list of classifiers from the server.
        '''
        url = self.repository+'?:action=list_classifiers'
        response = urllib.request.urlopen(url)
        log.info(self._read_pypi_response(response))

    def verify_metadata(self):
        ''' Send the metadata to the package index server to be checked.
        '''
        # send the info to the server and report the result
        (code, result) = self.post_to_server(self.build_post_data('verify'))
        log.info('Server response (%s): %s', code, result)

    def send_metadata(self):
        ''' Send the metadata to the package index server.

            Well, do the following:
            1. figure who the user is, and then
            2. send the data as a Basic auth'ed POST.

            First we try to read the username/password from $HOME/.pypirc,
            which is a ConfigParser-formatted file with a section
            [distutils] containing username and password entries (both
            in clear text). Eg:

                [distutils]
                index-servers =
                    pypi

                [pypi]
                username: fred
                password: sekrit

            Otherwise, to figure who the user is, we offer the user three
            choices:

             1. use existing login,
             2. register as a new user, or
             3. set the password to a random string and email the user.

        '''
        # see if we can short-cut and get the username/password from the
        # config
        if self.has_config:
            choice = '1'
            username = self.username
            password = self.password
        else:
            choice = 'x'
            username = password = ''

        # get the user's login info
        choices = '1 2 3 4'.split()
        while choice not in choices:
            self.announce('''\
We need to know who you are, so please choose either:
 1. use your existing login,
 2. register as a new user,
 3. have the server generate a new password for you (and email it to you), or
 4. quit
Your selection [default 1]: ''', log.INFO)
            choice = input()
            if not choice:
                choice = '1'
            elif choice not in choices:
                print('Please choose one of the four options!')

        if choice == '1':
            # get the username and password
            while not username:
                username = input('Username: ')
            while not password:
                password = getpass.getpass('Password: ')

            # set up the authentication
            auth = urllib.request.HTTPPasswordMgr()
            host = urllib.parse.urlparse(self.repository)[1]
            auth.add_password(self.realm, host, username, password)
            # send the info to the server and report the result
            code, result = self.post_to_server(self.build_post_data('submit'),
                auth)
            self.announce('Server response (%s): %s' % (code, result),
                          log.INFO)

            # possibly save the login
            if code == 200:
                if self.has_config:
                    # sharing the password in the distribution instance
                    # so the upload command can reuse it
                    self.distribution.password = password
                else:
                    self.announce(('I can store your PyPI login so future '
                                   'submissions will be faster.'), log.INFO)
                    self.announce('(the login will be stored in %s)' % \
                                  self._get_rc_file(), log.INFO)
                    choice = 'X'
                    while choice.lower() not in 'yn':
                        choice = input('Save your login (y/N)?')
                        if not choice:
                            choice = 'n'
                    if choice.lower() == 'y':
                        self._store_pypirc(username, password)

        elif choice == '2':
            data = {':action': 'user'}
            data['name'] = data['password'] = data['email'] = ''
            data['confirm'] = None
            while not data['name']:
                data['name'] = input('Username: ')
            while data['password'] != data['confirm']:
                while not data['password']:
                    data['password'] = getpass.getpass('Password: ')
                while not data['confirm']:
                    data['confirm'] = getpass.getpass(' Confirm: ')
                if data['password'] != data['confirm']:
                    data['password'] = ''
                    data['confirm'] = None
                    print("Password and confirm don't match!")
            while not data['email']:
                data['email'] = input('   EMail: ')
            code, result = self.post_to_server(data)
            if code != 200:
                log.info('Server response (%s): %s', code, result)
            else:
                log.info('You will receive an email shortly.')
                log.info(('Follow the instructions in it to '
                          'complete registration.'))
        elif choice == '3':
            data = {':action': 'password_reset'}
            data['email'] = ''
            while not data['email']:
                data['email'] = input('Your email address: ')
            code, result = self.post_to_server(data)
            log.info('Server response (%s): %s', code, result)

    def build_post_data(self, action):
        # figure the data to send - the metadata plus some additional
        # information used by the package server
        meta = self.distribution.metadata
        data = {
            ':action': action,
            'metadata_version' : '1.0',
            'name': meta.get_name(),
            'version': meta.get_version(),
            'summary': meta.get_description(),
            'home_page': meta.get_url(),
            'author': meta.get_contact(),
            'author_email': meta.get_contact_email(),
            'license': meta.get_licence(),
            'description': meta.get_long_description(),
            'keywords': meta.get_keywords(),
            'platform': meta.get_platforms(),
            'classifiers': meta.get_classifiers(),
            'download_url': meta.get_download_url(),
            # PEP 314
            'provides': meta.get_provides(),
            'requires': meta.get_requires(),
            'obsoletes': meta.get_obsoletes(),
        }
        if data['provides'] or data['requires'] or data['obsoletes']:
            data['metadata_version'] = '1.1'
        return data

    def post_to_server(self, data, auth=None):
        ''' Post a query to the server, and return a string response.
        '''
        if 'name' in data:
            self.announce('Registering %s to %s' % (data['name'],
                                                    self.repository),
                                                    log.INFO)
        # Build up the MIME payload for the urllib2 POST data
        boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
        sep_boundary = '\n--' + boundary
        end_boundary = sep_boundary + '--'
        body = io.StringIO()
        for key, value in data.items():
            # handle multiple entries for the same name
            if type(value) not in (type([]), type( () )):
                value = [value]
            for value in value:
                value = str(value)
                body.write(sep_boundary)
                body.write('\nContent-Disposition: form-data; name="%s"'%key)
                body.write("\n\n")
                body.write(value)
                if value and value[-1] == '\r':
                    body.write('\n')  # write an extra newline (lurve Macs)
        body.write(end_boundary)
        body.write("\n")
        body = body.getvalue().encode("utf-8")

        # build the Request
        headers = {
            'Content-type': 'multipart/form-data; boundary=%s; charset=utf-8'%boundary,
            'Content-length': str(len(body))
        }
        req = urllib.request.Request(self.repository, body, headers)

        # handle HTTP and include the Basic Auth handler
        opener = urllib.request.build_opener(
            urllib.request.HTTPBasicAuthHandler(password_mgr=auth)
        )
        data = ''
        try:
            result = opener.open(req)
        except urllib.error.HTTPError as e:
            if self.show_response:
                data = e.fp.read()
            result = e.code, e.msg
        except urllib.error.URLError as e:
            result = 500, str(e)
        else:
            if self.show_response:
                data = self._read_pypi_response(result)
            result = 200, 'OK'
        if self.show_response:
            msg = '\n'.join(('-' * 75, data, '-' * 75))
            self.announce(msg, log.INFO)
        return result
PK       ! x      build.pynu [        """distutils.command.build

Implements the Distutils 'build' command."""

import sys, os
from distutils.core import Command
from distutils.errors import DistutilsOptionError
from distutils.util import get_platform


def show_compilers():
    from distutils.ccompiler import show_compilers
    show_compilers()


class build(Command):

    description = "build everything needed to install"

    user_options = [
        ('build-base=', 'b',
         "base directory for build library"),
        ('build-purelib=', None,
         "build directory for platform-neutral distributions"),
        ('build-platlib=', None,
         "build directory for platform-specific distributions"),
        ('build-lib=', None,
         "build directory for all distribution (defaults to either " +
         "build-purelib or build-platlib"),
        ('build-scripts=', None,
         "build directory for scripts"),
        ('build-temp=', 't',
         "temporary build directory"),
        ('plat-name=', 'p',
         "platform name to build for, if supported "
         "(default: %s)" % get_platform()),
        ('compiler=', 'c',
         "specify the compiler type"),
        ('parallel=', 'j',
         "number of parallel build jobs"),
        ('debug', 'g',
         "compile extensions and libraries with debugging information"),
        ('force', 'f',
         "forcibly build everything (ignore file timestamps)"),
        ('executable=', 'e',
         "specify final destination interpreter path (build.py)"),
        ]

    boolean_options = ['debug', 'force']

    help_options = [
        ('help-compiler', None,
         "list available compilers", show_compilers),
        ]

    def initialize_options(self):
        self.build_base = 'build'
        # these are decided only after 'build_base' has its final value
        # (unless overridden by the user or client)
        self.build_purelib = None
        self.build_platlib = None
        self.build_lib = None
        self.build_temp = None
        self.build_scripts = None
        self.compiler = None
        self.plat_name = None
        self.debug = None
        self.force = 0
        self.executable = None
        self.parallel = None

    def finalize_options(self):
        if self.plat_name is None:
            self.plat_name = get_platform()
        else:
            # plat-name only supported for windows (other platforms are
            # supported via ./configure flags, if at all).  Avoid misleading
            # other platforms.
            if os.name != 'nt':
                raise DistutilsOptionError(
                            "--plat-name only supported on Windows (try "
                            "using './configure --help' on your platform)")

        plat_specifier = ".%s-%d.%d" % (self.plat_name, *sys.version_info[:2])

        # Make it so Python 2.x and Python 2.x with --with-pydebug don't
        # share the same build directories. Doing so confuses the build
        # process for C modules
        if hasattr(sys, 'gettotalrefcount'):
            plat_specifier += '-pydebug'

        # 'build_purelib' and 'build_platlib' just default to 'lib' and
        # 'lib.<plat>' under the base build directory.  We only use one of
        # them for a given distribution, though --
        if self.build_purelib is None:
            self.build_purelib = os.path.join(self.build_base, 'lib')
        if self.build_platlib is None:
            self.build_platlib = os.path.join(self.build_base,
                                              'lib' + plat_specifier)

        # 'build_lib' is the actual directory that we will use for this
        # particular module distribution -- if user didn't supply it, pick
        # one of 'build_purelib' or 'build_platlib'.
        if self.build_lib is None:
            if self.distribution.ext_modules:
                self.build_lib = self.build_platlib
            else:
                self.build_lib = self.build_purelib

        # 'build_temp' -- temporary directory for compiler turds,
        # "build/temp.<plat>"
        if self.build_temp is None:
            self.build_temp = os.path.join(self.build_base,
                                           'temp' + plat_specifier)
        if self.build_scripts is None:
            self.build_scripts = os.path.join(self.build_base,
                                              'scripts-%d.%d' % sys.version_info[:2])

        if self.executable is None and sys.executable:
            self.executable = os.path.normpath(sys.executable)

        if isinstance(self.parallel, str):
            try:
                self.parallel = int(self.parallel)
            except ValueError:
                raise DistutilsOptionError("parallel should be an integer")

    def run(self):
        # Run all relevant sub-commands.  This will be some subset of:
        #  - build_py      - pure Python modules
        #  - build_clib    - standalone C libraries
        #  - build_ext     - Python extensions
        #  - build_scripts - (Python) scripts
        for cmd_name in self.get_sub_commands():
            self.run_command(cmd_name)


    # -- Predicates for the sub-command list ---------------------------

    def has_pure_modules(self):
        return self.distribution.has_pure_modules()

    def has_c_libraries(self):
        return self.distribution.has_c_libraries()

    def has_ext_modules(self):
        return self.distribution.has_ext_modules()

    def has_scripts(self):
        return self.distribution.has_scripts()


    sub_commands = [('build_py',      has_pure_modules),
                    ('build_clib',    has_c_libraries),
                    ('build_ext',     has_ext_modules),
                    ('build_scripts', has_scripts),
                   ]
PK       ! t=J  =J    sdist.pynu [        """distutils.command.sdist

Implements the Distutils 'sdist' command (create a source distribution)."""

import os
import sys
from glob import glob
from warnings import warn

from distutils.core import Command
from distutils import dir_util
from distutils import file_util
from distutils import archive_util
from distutils.text_file import TextFile
from distutils.filelist import FileList
from distutils import log
from distutils.util import convert_path
from distutils.errors import DistutilsTemplateError, DistutilsOptionError


def show_formats():
    """Print all possible values for the 'formats' option (used by
    the "--help-formats" command-line option).
    """
    from distutils.fancy_getopt import FancyGetopt
    from distutils.archive_util import ARCHIVE_FORMATS
    formats = []
    for format in ARCHIVE_FORMATS.keys():
        formats.append(("formats=" + format, None,
                        ARCHIVE_FORMATS[format][2]))
    formats.sort()
    FancyGetopt(formats).print_help(
        "List of available source distribution formats:")


class sdist(Command):

    description = "create a source distribution (tarball, zip file, etc.)"

    def checking_metadata(self):
        """Callable used for the check sub-command.

        Placed here so user_options can view it"""
        return self.metadata_check

    user_options = [
        ('template=', 't',
         "name of manifest template file [default: MANIFEST.in]"),
        ('manifest=', 'm',
         "name of manifest file [default: MANIFEST]"),
        ('use-defaults', None,
         "include the default file set in the manifest "
         "[default; disable with --no-defaults]"),
        ('no-defaults', None,
         "don't include the default file set"),
        ('prune', None,
         "specifically exclude files/directories that should not be "
         "distributed (build tree, RCS/CVS dirs, etc.) "
         "[default; disable with --no-prune]"),
        ('no-prune', None,
         "don't automatically exclude anything"),
        ('manifest-only', 'o',
         "just regenerate the manifest and then stop "
         "(implies --force-manifest)"),
        ('force-manifest', 'f',
         "forcibly regenerate the manifest and carry on as usual. "
         "Deprecated: now the manifest is always regenerated."),
        ('formats=', None,
         "formats for source distribution (comma-separated list)"),
        ('keep-temp', 'k',
         "keep the distribution tree around after creating " +
         "archive file(s)"),
        ('dist-dir=', 'd',
         "directory to put the source distribution archive(s) in "
         "[default: dist]"),
        ('metadata-check', None,
         "Ensure that all required elements of meta-data "
         "are supplied. Warn if any missing. [default]"),
        ('owner=', 'u',
         "Owner name used when creating a tar file [default: current user]"),
        ('group=', 'g',
         "Group name used when creating a tar file [default: current group]"),
        ]

    boolean_options = ['use-defaults', 'prune',
                       'manifest-only', 'force-manifest',
                       'keep-temp', 'metadata-check']

    help_options = [
        ('help-formats', None,
         "list available distribution formats", show_formats),
        ]

    negative_opt = {'no-defaults': 'use-defaults',
                    'no-prune': 'prune' }

    sub_commands = [('check', checking_metadata)]

    READMES = ('README', 'README.txt', 'README.rst')

    def initialize_options(self):
        # 'template' and 'manifest' are, respectively, the names of
        # the manifest template and manifest file.
        self.template = None
        self.manifest = None

        # 'use_defaults': if true, we will include the default file set
        # in the manifest
        self.use_defaults = 1
        self.prune = 1

        self.manifest_only = 0
        self.force_manifest = 0

        self.formats = ['gztar']
        self.keep_temp = 0
        self.dist_dir = None

        self.archive_files = None
        self.metadata_check = 1
        self.owner = None
        self.group = None

    def finalize_options(self):
        if self.manifest is None:
            self.manifest = "MANIFEST"
        if self.template is None:
            self.template = "MANIFEST.in"

        self.ensure_string_list('formats')

        bad_format = archive_util.check_archive_formats(self.formats)
        if bad_format:
            raise DistutilsOptionError(
                  "unknown archive format '%s'" % bad_format)

        if self.dist_dir is None:
            self.dist_dir = "dist"

    def run(self):
        # 'filelist' contains the list of files that will make up the
        # manifest
        self.filelist = FileList()

        # Run sub commands
        for cmd_name in self.get_sub_commands():
            self.run_command(cmd_name)

        # Do whatever it takes to get the list of files to process
        # (process the manifest template, read an existing manifest,
        # whatever).  File list is accumulated in 'self.filelist'.
        self.get_file_list()

        # If user just wanted us to regenerate the manifest, stop now.
        if self.manifest_only:
            return

        # Otherwise, go ahead and create the source distribution tarball,
        # or zipfile, or whatever.
        self.make_distribution()

    def check_metadata(self):
        """Deprecated API."""
        warn("distutils.command.sdist.check_metadata is deprecated, \
              use the check command instead", PendingDeprecationWarning)
        check = self.distribution.get_command_obj('check')
        check.ensure_finalized()
        check.run()

    def get_file_list(self):
        """Figure out the list of files to include in the source
        distribution, and put it in 'self.filelist'.  This might involve
        reading the manifest template (and writing the manifest), or just
        reading the manifest, or just using the default file set -- it all
        depends on the user's options.
        """
        # new behavior when using a template:
        # the file list is recalculated every time because
        # even if MANIFEST.in or setup.py are not changed
        # the user might have added some files in the tree that
        # need to be included.
        #
        #  This makes --force the default and only behavior with templates.
        template_exists = os.path.isfile(self.template)
        if not template_exists and self._manifest_is_not_generated():
            self.read_manifest()
            self.filelist.sort()
            self.filelist.remove_duplicates()
            return

        if not template_exists:
            self.warn(("manifest template '%s' does not exist " +
                        "(using default file list)") %
                        self.template)
        self.filelist.findall()

        if self.use_defaults:
            self.add_defaults()

        if template_exists:
            self.read_template()

        if self.prune:
            self.prune_file_list()

        self.filelist.sort()
        self.filelist.remove_duplicates()
        self.write_manifest()

    def add_defaults(self):
        """Add all the default files to self.filelist:
          - README or README.txt
          - setup.py
          - test/test*.py
          - all pure Python modules mentioned in setup script
          - all files pointed by package_data (build_py)
          - all files defined in data_files.
          - all files defined as scripts.
          - all C sources listed as part of extensions or C libraries
            in the setup script (doesn't catch C headers!)
        Warns if (README or README.txt) or setup.py are missing; everything
        else is optional.
        """
        self._add_defaults_standards()
        self._add_defaults_optional()
        self._add_defaults_python()
        self._add_defaults_data_files()
        self._add_defaults_ext()
        self._add_defaults_c_libs()
        self._add_defaults_scripts()

    @staticmethod
    def _cs_path_exists(fspath):
        """
        Case-sensitive path existence check

        >>> sdist._cs_path_exists(__file__)
        True
        >>> sdist._cs_path_exists(__file__.upper())
        False
        """
        if not os.path.exists(fspath):
            return False
        # make absolute so we always have a directory
        abspath = os.path.abspath(fspath)
        directory, filename = os.path.split(abspath)
        return filename in os.listdir(directory)

    def _add_defaults_standards(self):
        standards = [self.READMES, self.distribution.script_name]
        for fn in standards:
            if isinstance(fn, tuple):
                alts = fn
                got_it = False
                for fn in alts:
                    if self._cs_path_exists(fn):
                        got_it = True
                        self.filelist.append(fn)
                        break

                if not got_it:
                    self.warn("standard file not found: should have one of " +
                              ', '.join(alts))
            else:
                if self._cs_path_exists(fn):
                    self.filelist.append(fn)
                else:
                    self.warn("standard file '%s' not found" % fn)

    def _add_defaults_optional(self):
        optional = ['test/test*.py', 'setup.cfg']
        for pattern in optional:
            files = filter(os.path.isfile, glob(pattern))
            self.filelist.extend(files)

    def _add_defaults_python(self):
        # build_py is used to get:
        #  - python modules
        #  - files defined in package_data
        build_py = self.get_finalized_command('build_py')

        # getting python files
        if self.distribution.has_pure_modules():
            self.filelist.extend(build_py.get_source_files())

        # getting package_data files
        # (computed in build_py.data_files by build_py.finalize_options)
        for pkg, src_dir, build_dir, filenames in build_py.data_files:
            for filename in filenames:
                self.filelist.append(os.path.join(src_dir, filename))

    def _add_defaults_data_files(self):
        # getting distribution.data_files
        if self.distribution.has_data_files():
            for item in self.distribution.data_files:
                if isinstance(item, str):
                    # plain file
                    item = convert_path(item)
                    if os.path.isfile(item):
                        self.filelist.append(item)
                else:
                    # a (dirname, filenames) tuple
                    dirname, filenames = item
                    for f in filenames:
                        f = convert_path(f)
                        if os.path.isfile(f):
                            self.filelist.append(f)

    def _add_defaults_ext(self):
        if self.distribution.has_ext_modules():
            build_ext = self.get_finalized_command('build_ext')
            self.filelist.extend(build_ext.get_source_files())

    def _add_defaults_c_libs(self):
        if self.distribution.has_c_libraries():
            build_clib = self.get_finalized_command('build_clib')
            self.filelist.extend(build_clib.get_source_files())

    def _add_defaults_scripts(self):
        if self.distribution.has_scripts():
            build_scripts = self.get_finalized_command('build_scripts')
            self.filelist.extend(build_scripts.get_source_files())

    def read_template(self):
        """Read and parse manifest template file named by self.template.

        (usually "MANIFEST.in") The parsing and processing is done by
        'self.filelist', which updates itself accordingly.
        """
        log.info("reading manifest template '%s'", self.template)
        template = TextFile(self.template, strip_comments=1, skip_blanks=1,
                            join_lines=1, lstrip_ws=1, rstrip_ws=1,
                            collapse_join=1)

        try:
            while True:
                line = template.readline()
                if line is None:            # end of file
                    break

                try:
                    self.filelist.process_template_line(line)
                # the call above can raise a DistutilsTemplateError for
                # malformed lines, or a ValueError from the lower-level
                # convert_path function
                except (DistutilsTemplateError, ValueError) as msg:
                    self.warn("%s, line %d: %s" % (template.filename,
                                                   template.current_line,
                                                   msg))
        finally:
            template.close()

    def prune_file_list(self):
        """Prune off branches that might slip into the file list as created
        by 'read_template()', but really don't belong there:
          * the build tree (typically "build")
          * the release tree itself (only an issue if we ran "sdist"
            previously with --keep-temp, or it aborted)
          * any RCS, CVS, .svn, .hg, .git, .bzr, _darcs directories
        """
        build = self.get_finalized_command('build')
        base_dir = self.distribution.get_fullname()

        self.filelist.exclude_pattern(None, prefix=build.build_base)
        self.filelist.exclude_pattern(None, prefix=base_dir)

        if sys.platform == 'win32':
            seps = r'/|\\'
        else:
            seps = '/'

        vcs_dirs = ['RCS', 'CVS', r'\.svn', r'\.hg', r'\.git', r'\.bzr',
                    '_darcs']
        vcs_ptrn = r'(^|%s)(%s)(%s).*' % (seps, '|'.join(vcs_dirs), seps)
        self.filelist.exclude_pattern(vcs_ptrn, is_regex=1)

    def write_manifest(self):
        """Write the file list in 'self.filelist' (presumably as filled in
        by 'add_defaults()' and 'read_template()') to the manifest file
        named by 'self.manifest'.
        """
        if self._manifest_is_not_generated():
            log.info("not writing to manually maintained "
                     "manifest file '%s'" % self.manifest)
            return

        content = self.filelist.files[:]
        content.insert(0, '# file GENERATED by distutils, do NOT edit')
        self.execute(file_util.write_file, (self.manifest, content),
                     "writing manifest file '%s'" % self.manifest)

    def _manifest_is_not_generated(self):
        # check for special comment used in 3.1.3 and higher
        if not os.path.isfile(self.manifest):
            return False

        fp = open(self.manifest)
        try:
            first_line = fp.readline()
        finally:
            fp.close()
        return first_line != '# file GENERATED by distutils, do NOT edit\n'

    def read_manifest(self):
        """Read the manifest file (named by 'self.manifest') and use it to
        fill in 'self.filelist', the list of files to include in the source
        distribution.
        """
        log.info("reading manifest file '%s'", self.manifest)
        with open(self.manifest) as manifest:
            for line in manifest:
                # ignore comments and blank lines
                line = line.strip()
                if line.startswith('#') or not line:
                    continue
                self.filelist.append(line)

    def make_release_tree(self, base_dir, files):
        """Create the directory tree that will become the source
        distribution archive.  All directories implied by the filenames in
        'files' are created under 'base_dir', and then we hard link or copy
        (if hard linking is unavailable) those files into place.
        Essentially, this duplicates the developer's source tree, but in a
        directory named after the distribution, containing only the files
        to be distributed.
        """
        # Create all the directories under 'base_dir' necessary to
        # put 'files' there; the 'mkpath()' is just so we don't die
        # if the manifest happens to be empty.
        self.mkpath(base_dir)
        dir_util.create_tree(base_dir, files, dry_run=self.dry_run)

        # And walk over the list of files, either making a hard link (if
        # os.link exists) to each one that doesn't already exist in its
        # corresponding location under 'base_dir', or copying each file
        # that's out-of-date in 'base_dir'.  (Usually, all files will be
        # out-of-date, because by default we blow away 'base_dir' when
        # we're done making the distribution archives.)

        if hasattr(os, 'link'):        # can make hard links on this system
            link = 'hard'
            msg = "making hard links in %s..." % base_dir
        else:                           # nope, have to copy
            link = None
            msg = "copying files to %s..." % base_dir

        if not files:
            log.warn("no files to distribute -- empty manifest?")
        else:
            log.info(msg)
        for file in files:
            if not os.path.isfile(file):
                log.warn("'%s' not a regular file -- skipping", file)
            else:
                dest = os.path.join(base_dir, file)
                self.copy_file(file, dest, link=link)

        self.distribution.metadata.write_pkg_info(base_dir)

    def make_distribution(self):
        """Create the source distribution(s).  First, we create the release
        tree with 'make_release_tree()'; then, we create all required
        archive files (according to 'self.formats') from the release tree.
        Finally, we clean up by blowing away the release tree (unless
        'self.keep_temp' is true).  The list of archive files created is
        stored so it can be retrieved later by 'get_archive_files()'.
        """
        # Don't warn about missing meta-data here -- should be (and is!)
        # done elsewhere.
        base_dir = self.distribution.get_fullname()
        base_name = os.path.join(self.dist_dir, base_dir)

        self.make_release_tree(base_dir, self.filelist.files)
        archive_files = []              # remember names of files we create
        # tar archive must be created last to avoid overwrite and remove
        if 'tar' in self.formats:
            self.formats.append(self.formats.pop(self.formats.index('tar')))

        for fmt in self.formats:
            file = self.make_archive(base_name, fmt, base_dir=base_dir,
                                     owner=self.owner, group=self.group)
            archive_files.append(file)
            self.distribution.dist_files.append(('sdist', '', file))

        self.archive_files = archive_files

        if not self.keep_temp:
            dir_util.remove_tree(base_dir, dry_run=self.dry_run)

    def get_archive_files(self):
        """Return the list of archive files created when the command
        was run, or None if the command hasn't run yet.
        """
        return self.archive_files
PK       ! Z      install_egg_info.pynu [        """distutils.command.install_egg_info

Implements the Distutils 'install_egg_info' command, for installing
a package's PKG-INFO metadata."""


from distutils.cmd import Command
from distutils import log, dir_util
import os, sys, re

class install_egg_info(Command):
    """Install an .egg-info file for the package"""

    description = "Install package's PKG-INFO metadata as an .egg-info file"
    user_options = [
        ('install-dir=', 'd', "directory to install to"),
        ('install-layout', None, "custom installation layout"),
    ]

    def initialize_options(self):
        self.install_dir = None
        self.install_layout = None
        self.prefix_option = None

    def finalize_options(self):
        self.set_undefined_options('install_lib',('install_dir','install_dir'))
        self.set_undefined_options('install',('install_layout','install_layout'))
        self.set_undefined_options('install',('prefix_option','prefix_option'))
        if self.install_layout:
            if not self.install_layout.lower() in ['deb', 'unix']:
                raise DistutilsOptionError(
                    "unknown value for --install-layout")
            no_pyver = (self.install_layout.lower() == 'deb')
        elif self.prefix_option:
            no_pyver = False
        else:
            no_pyver = True
        if no_pyver:
            basename = "%s-%s.egg-info" % (
                to_filename(safe_name(self.distribution.get_name())),
                to_filename(safe_version(self.distribution.get_version()))
                )
        else:
            basename = "%s-%s-py%d.%d.egg-info" % (
                to_filename(safe_name(self.distribution.get_name())),
                to_filename(safe_version(self.distribution.get_version())),
                *sys.version_info[:2]
            )
        self.target = os.path.join(self.install_dir, basename)
        self.outputs = [self.target]

    def run(self):
        target = self.target
        if os.path.isdir(target) and not os.path.islink(target):
            dir_util.remove_tree(target, dry_run=self.dry_run)
        elif os.path.exists(target):
            self.execute(os.unlink,(self.target,),"Removing "+target)
        elif not os.path.isdir(self.install_dir):
            self.execute(os.makedirs, (self.install_dir,),
                         "Creating "+self.install_dir)
        log.info("Writing %s", target)
        if not self.dry_run:
            with open(target, 'w', encoding='UTF-8') as f:
                self.distribution.metadata.write_pkg_file(f)

    def get_outputs(self):
        return self.outputs


# The following routines are taken from setuptools' pkg_resources module and
# can be replaced by importing them from pkg_resources once it is included
# in the stdlib.

def safe_name(name):
    """Convert an arbitrary string to a standard distribution name

    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    """
    return re.sub('[^A-Za-z0-9.]+', '-', name)


def safe_version(version):
    """Convert an arbitrary string to a standard version string

    Spaces become dots, and all other non-alphanumeric characters become
    dashes, with runs of multiple dashes condensed to a single dash.
    """
    version = version.replace(' ','.')
    return re.sub('[^A-Za-z0-9.]+', '-', version)


def to_filename(name):
    """Convert a project or version name to its filename-escaped form

    Any '-' characters are currently replaced with '_'.
    """
    return name.replace('-','_')
PK       ! r|y  y    command_templatenu [        """distutils.command.x

Implements the Distutils 'x' command.
"""

# created 2000/mm/dd, John Doe

__revision__ = "$Id$"

from distutils.core import Command


class x(Command):

    # Brief (40-50 characters) description of the command
    description = ""

    # List of option tuples: long name, short name (None if no short
    # name), and help string.
    user_options = [('', '',
                     ""),
                   ]

    def initialize_options(self):
        self. = None
        self. = None
        self. = None

    def finalize_options(self):
        if self.x is None:
            self.x = 

    def run(self):
PK       ! ^Կ      bdist_msi.pynu [        # Copyright (C) 2005, 2006 Martin von Löwis
# Licensed to PSF under a Contributor Agreement.
"""
Implements the bdist_msi command.
"""

import os
import sys
import warnings
from distutils.core import Command
from distutils.dir_util import remove_tree
from distutils.sysconfig import get_python_version
from distutils.version import StrictVersion
from distutils.errors import DistutilsOptionError
from distutils.util import get_platform
from distutils import log
import msilib
from msilib import schema, sequence, text
from msilib import Directory, Feature, Dialog, add_data

class PyDialog(Dialog):
    """Dialog class with a fixed layout: controls at the top, then a ruler,
    then a list of buttons: back, next, cancel. Optionally a bitmap at the
    left."""
    def __init__(self, *args, **kw):
        """Dialog(database, name, x, y, w, h, attributes, title, first,
        default, cancel, bitmap=true)"""
        Dialog.__init__(self, *args)
        ruler = self.h - 36
        bmwidth = 152*ruler/328
        #if kw.get("bitmap", True):
        #    self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "PythonWin")
        self.line("BottomLine", 0, ruler, self.w, 0)

    def title(self, title):
        "Set the title text of the dialog at the top."
        # name, x, y, w, h, flags=Visible|Enabled|Transparent|NoPrefix,
        # text, in VerdanaBold10
        self.text("Title", 15, 10, 320, 60, 0x30003,
                  r"{\VerdanaBold10}%s" % title)

    def back(self, title, next, name = "Back", active = 1):
        """Add a back button with a given title, the tab-next button,
        its name in the Control table, possibly initially disabled.

        Return the button, so that events can be associated"""
        if active:
            flags = 3 # Visible|Enabled
        else:
            flags = 1 # Visible
        return self.pushbutton(name, 180, self.h-27 , 56, 17, flags, title, next)

    def cancel(self, title, next, name = "Cancel", active = 1):
        """Add a cancel button with a given title, the tab-next button,
        its name in the Control table, possibly initially disabled.

        Return the button, so that events can be associated"""
        if active:
            flags = 3 # Visible|Enabled
        else:
            flags = 1 # Visible
        return self.pushbutton(name, 304, self.h-27, 56, 17, flags, title, next)

    def next(self, title, next, name = "Next", active = 1):
        """Add a Next button with a given title, the tab-next button,
        its name in the Control table, possibly initially disabled.

        Return the button, so that events can be associated"""
        if active:
            flags = 3 # Visible|Enabled
        else:
            flags = 1 # Visible
        return self.pushbutton(name, 236, self.h-27, 56, 17, flags, title, next)

    def xbutton(self, name, title, next, xpos):
        """Add a button with a given title, the tab-next button,
        its name in the Control table, giving its x position; the
        y-position is aligned with the other buttons.

        Return the button, so that events can be associated"""
        return self.pushbutton(name, int(self.w*xpos - 28), self.h-27, 56, 17, 3, title, next)

class bdist_msi(Command):

    description = "create a Microsoft Installer (.msi) binary distribution"

    user_options = [('bdist-dir=', None,
                     "temporary directory for creating the distribution"),
                    ('plat-name=', 'p',
                     "platform name to embed in generated filenames "
                     "(default: %s)" % get_platform()),
                    ('keep-temp', 'k',
                     "keep the pseudo-installation tree around after " +
                     "creating the distribution archive"),
                    ('target-version=', None,
                     "require a specific python version" +
                     " on the target system"),
                    ('no-target-compile', 'c',
                     "do not compile .py to .pyc on the target system"),
                    ('no-target-optimize', 'o',
                     "do not compile .py to .pyo (optimized) "
                     "on the target system"),
                    ('dist-dir=', 'd',
                     "directory to put final built distributions in"),
                    ('skip-build', None,
                     "skip rebuilding everything (for testing/debugging)"),
                    ('install-script=', None,
                     "basename of installation script to be run after "
                     "installation or before deinstallation"),
                    ('pre-install-script=', None,
                     "Fully qualified filename of a script to be run before "
                     "any files are installed.  This script need not be in the "
                     "distribution"),
                   ]

    boolean_options = ['keep-temp', 'no-target-compile', 'no-target-optimize',
                       'skip-build']

    all_versions = ['2.0', '2.1', '2.2', '2.3', '2.4',
                    '2.5', '2.6', '2.7', '2.8', '2.9',
                    '3.0', '3.1', '3.2', '3.3', '3.4',
                    '3.5', '3.6', '3.7', '3.8', '3.9']
    other_version = 'X'

    def __init__(self, *args, **kw):
        super().__init__(*args, **kw)
        warnings.warn("bdist_msi command is deprecated since Python 3.9, "
                      "use bdist_wheel (wheel packages) instead",
                      DeprecationWarning, 2)

    def initialize_options(self):
        self.bdist_dir = None
        self.plat_name = None
        self.keep_temp = 0
        self.no_target_compile = 0
        self.no_target_optimize = 0
        self.target_version = None
        self.dist_dir = None
        self.skip_build = None
        self.install_script = None
        self.pre_install_script = None
        self.versions = None

    def finalize_options(self):
        self.set_undefined_options('bdist', ('skip_build', 'skip_build'))

        if self.bdist_dir is None:
            bdist_base = self.get_finalized_command('bdist').bdist_base
            self.bdist_dir = os.path.join(bdist_base, 'msi')

        short_version = get_python_version()
        if (not self.target_version) and self.distribution.has_ext_modules():
            self.target_version = short_version

        if self.target_version:
            self.versions = [self.target_version]
            if not self.skip_build and self.distribution.has_ext_modules()\
               and self.target_version != short_version:
                raise DistutilsOptionError(
                      "target version can only be %s, or the '--skip-build'"
                      " option must be specified" % (short_version,))
        else:
            self.versions = list(self.all_versions)

        self.set_undefined_options('bdist',
                                   ('dist_dir', 'dist_dir'),
                                   ('plat_name', 'plat_name'),
                                   )

        if self.pre_install_script:
            raise DistutilsOptionError(
                  "the pre-install-script feature is not yet implemented")

        if self.install_script:
            for script in self.distribution.scripts:
                if self.install_script == os.path.basename(script):
                    break
            else:
                raise DistutilsOptionError(
                      "install_script '%s' not found in scripts"
                      % self.install_script)
        self.install_script_key = None

    def run(self):
        if not self.skip_build:
            self.run_command('build')

        install = self.reinitialize_command('install', reinit_subcommands=1)
        install.prefix = self.bdist_dir
        install.skip_build = self.skip_build
        install.warn_dir = 0

        install_lib = self.reinitialize_command('install_lib')
        # we do not want to include pyc or pyo files
        install_lib.compile = 0
        install_lib.optimize = 0

        if self.distribution.has_ext_modules():
            # If we are building an installer for a Python version other
            # than the one we are currently running, then we need to ensure
            # our build_lib reflects the other Python version rather than ours.
            # Note that for target_version!=sys.version, we must have skipped the
            # build step, so there is no issue with enforcing the build of this
            # version.
            target_version = self.target_version
            if not target_version:
                assert self.skip_build, "Should have already checked this"
                target_version = '%d.%d' % sys.version_info[:2]
            plat_specifier = ".%s-%s" % (self.plat_name, target_version)
            build = self.get_finalized_command('build')
            build.build_lib = os.path.join(build.build_base,
                                           'lib' + plat_specifier)

        log.info("installing to %s", self.bdist_dir)
        install.ensure_finalized()

        # avoid warning of 'install_lib' about installing
        # into a directory not in sys.path
        sys.path.insert(0, os.path.join(self.bdist_dir, 'PURELIB'))

        install.run()

        del sys.path[0]

        self.mkpath(self.dist_dir)
        fullname = self.distribution.get_fullname()
        installer_name = self.get_installer_filename(fullname)
        installer_name = os.path.abspath(installer_name)
        if os.path.exists(installer_name): os.unlink(installer_name)

        metadata = self.distribution.metadata
        author = metadata.author
        if not author:
            author = metadata.maintainer
        if not author:
            author = "UNKNOWN"
        version = metadata.get_version()
        # ProductVersion must be strictly numeric
        # XXX need to deal with prerelease versions
        sversion = "%d.%d.%d" % StrictVersion(version).version
        # Prefix ProductName with Python x.y, so that
        # it sorts together with the other Python packages
        # in Add-Remove-Programs (APR)
        fullname = self.distribution.get_fullname()
        if self.target_version:
            product_name = "Python %s %s" % (self.target_version, fullname)
        else:
            product_name = "Python %s" % (fullname)
        self.db = msilib.init_database(installer_name, schema,
                product_name, msilib.gen_uuid(),
                sversion, author)
        msilib.add_tables(self.db, sequence)
        props = [('DistVersion', version)]
        email = metadata.author_email or metadata.maintainer_email
        if email:
            props.append(("ARPCONTACT", email))
        if metadata.url:
            props.append(("ARPURLINFOABOUT", metadata.url))
        if props:
            add_data(self.db, 'Property', props)

        self.add_find_python()
        self.add_files()
        self.add_scripts()
        self.add_ui()
        self.db.Commit()

        if hasattr(self.distribution, 'dist_files'):
            tup = 'bdist_msi', self.target_version or 'any', fullname
            self.distribution.dist_files.append(tup)

        if not self.keep_temp:
            remove_tree(self.bdist_dir, dry_run=self.dry_run)

    def add_files(self):
        db = self.db
        cab = msilib.CAB("distfiles")
        rootdir = os.path.abspath(self.bdist_dir)

        root = Directory(db, cab, None, rootdir, "TARGETDIR", "SourceDir")
        f = Feature(db, "Python", "Python", "Everything",
                    0, 1, directory="TARGETDIR")

        items = [(f, root, '')]
        for version in self.versions + [self.other_version]:
            target = "TARGETDIR" + version
            name = default = "Python" + version
            desc = "Everything"
            if version is self.other_version:
                title = "Python from another location"
                level = 2
            else:
                title = "Python %s from registry" % version
                level = 1
            f = Feature(db, name, title, desc, 1, level, directory=target)
            dir = Directory(db, cab, root, rootdir, target, default)
            items.append((f, dir, version))
        db.Commit()

        seen = {}
        for feature, dir, version in items:
            todo = [dir]
            while todo:
                dir = todo.pop()
                for file in os.listdir(dir.absolute):
                    afile = os.path.join(dir.absolute, file)
                    if os.path.isdir(afile):
                        short = "%s|%s" % (dir.make_short(file), file)
                        default = file + version
                        newdir = Directory(db, cab, dir, file, default, short)
                        todo.append(newdir)
                    else:
                        if not dir.component:
                            dir.start_component(dir.logical, feature, 0)
                        if afile not in seen:
                            key = seen[afile] = dir.add_file(file)
                            if file==self.install_script:
                                if self.install_script_key:
                                    raise DistutilsOptionError(
                                          "Multiple files with name %s" % file)
                                self.install_script_key = '[#%s]' % key
                        else:
                            key = seen[afile]
                            add_data(self.db, "DuplicateFile",
                                [(key + version, dir.component, key, None, dir.logical)])
            db.Commit()
        cab.commit(db)

    def add_find_python(self):
        """Adds code to the installer to compute the location of Python.

        Properties PYTHON.MACHINE.X.Y and PYTHON.USER.X.Y will be set from the
        registry for each version of Python.

        Properties TARGETDIRX.Y will be set from PYTHON.USER.X.Y if defined,
        else from PYTHON.MACHINE.X.Y.

        Properties PYTHONX.Y will be set to TARGETDIRX.Y\\python.exe"""

        start = 402
        for ver in self.versions:
            install_path = r"SOFTWARE\Python\PythonCore\%s\InstallPath" % ver
            machine_reg = "python.machine." + ver
            user_reg = "python.user." + ver
            machine_prop = "PYTHON.MACHINE." + ver
            user_prop = "PYTHON.USER." + ver
            machine_action = "PythonFromMachine" + ver
            user_action = "PythonFromUser" + ver
            exe_action = "PythonExe" + ver
            target_dir_prop = "TARGETDIR" + ver
            exe_prop = "PYTHON" + ver
            if msilib.Win64:
                # type: msidbLocatorTypeRawValue + msidbLocatorType64bit
                Type = 2+16
            else:
                Type = 2
            add_data(self.db, "RegLocator",
                    [(machine_reg, 2, install_path, None, Type),
                     (user_reg, 1, install_path, None, Type)])
            add_data(self.db, "AppSearch",
                    [(machine_prop, machine_reg),
                     (user_prop, user_reg)])
            add_data(self.db, "CustomAction",
                    [(machine_action, 51+256, target_dir_prop, "[" + machine_prop + "]"),
                     (user_action, 51+256, target_dir_prop, "[" + user_prop + "]"),
                     (exe_action, 51+256, exe_prop, "[" + target_dir_prop + "]\\python.exe"),
                    ])
            add_data(self.db, "InstallExecuteSequence",
                    [(machine_action, machine_prop, start),
                     (user_action, user_prop, start + 1),
                     (exe_action, None, start + 2),
                    ])
            add_data(self.db, "InstallUISequence",
                    [(machine_action, machine_prop, start),
                     (user_action, user_prop, start + 1),
                     (exe_action, None, start + 2),
                    ])
            add_data(self.db, "Condition",
                    [("Python" + ver, 0, "NOT TARGETDIR" + ver)])
            start += 4
            assert start < 500

    def add_scripts(self):
        if self.install_script:
            start = 6800
            for ver in self.versions + [self.other_version]:
                install_action = "install_script." + ver
                exe_prop = "PYTHON" + ver
                add_data(self.db, "CustomAction",
                        [(install_action, 50, exe_prop, self.install_script_key)])
                add_data(self.db, "InstallExecuteSequence",
                        [(install_action, "&Python%s=3" % ver, start)])
                start += 1
        # XXX pre-install scripts are currently refused in finalize_options()
        #     but if this feature is completed, it will also need to add
        #     entries for each version as the above code does
        if self.pre_install_script:
            scriptfn = os.path.join(self.bdist_dir, "preinstall.bat")
            with open(scriptfn, "w") as f:
                # The batch file will be executed with [PYTHON], so that %1
                # is the path to the Python interpreter; %0 will be the path
                # of the batch file.
                # rem ="""
                # %1 %0
                # exit
                # """
                # <actual script>
                f.write('rem ="""\n%1 %0\nexit\n"""\n')
                with open(self.pre_install_script) as fin:
                    f.write(fin.read())
            add_data(self.db, "Binary",
                [("PreInstall", msilib.Binary(scriptfn))
                ])
            add_data(self.db, "CustomAction",
                [("PreInstall", 2, "PreInstall", None)
                ])
            add_data(self.db, "InstallExecuteSequence",
                    [("PreInstall", "NOT Installed", 450)])


    def add_ui(self):
        db = self.db
        x = y = 50
        w = 370
        h = 300
        title = "[ProductName] Setup"

        # see "Dialog Style Bits"
        modal = 3      # visible | modal
        modeless = 1   # visible
        track_disk_space = 32

        # UI customization properties
        add_data(db, "Property",
                 # See "DefaultUIFont Property"
                 [("DefaultUIFont", "DlgFont8"),
                  # See "ErrorDialog Style Bit"
                  ("ErrorDialog", "ErrorDlg"),
                  ("Progress1", "Install"),   # modified in maintenance type dlg
                  ("Progress2", "installs"),
                  ("MaintenanceForm_Action", "Repair"),
                  # possible values: ALL, JUSTME
                  ("WhichUsers", "ALL")
                 ])

        # Fonts, see "TextStyle Table"
        add_data(db, "TextStyle",
                 [("DlgFont8", "Tahoma", 9, None, 0),
                  ("DlgFontBold8", "Tahoma", 8, None, 1), #bold
                  ("VerdanaBold10", "Verdana", 10, None, 1),
                  ("VerdanaRed9", "Verdana", 9, 255, 0),
                 ])

        # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table"
        # Numbers indicate sequence; see sequence.py for how these action integrate
        add_data(db, "InstallUISequence",
                 [("PrepareDlg", "Not Privileged or Windows9x or Installed", 140),
                  ("WhichUsersDlg", "Privileged and not Windows9x and not Installed", 141),
                  # In the user interface, assume all-users installation if privileged.
                  ("SelectFeaturesDlg", "Not Installed", 1230),
                  # XXX no support for resume installations yet
                  #("ResumeDlg", "Installed AND (RESUME OR Preselected)", 1240),
                  ("MaintenanceTypeDlg", "Installed AND NOT RESUME AND NOT Preselected", 1250),
                  ("ProgressDlg", None, 1280)])

        add_data(db, 'ActionText', text.ActionText)
        add_data(db, 'UIText', text.UIText)
        #####################################################################
        # Standard dialogs: FatalError, UserExit, ExitDialog
        fatal=PyDialog(db, "FatalError", x, y, w, h, modal, title,
                     "Finish", "Finish", "Finish")
        fatal.title("[ProductName] Installer ended prematurely")
        fatal.back("< Back", "Finish", active = 0)
        fatal.cancel("Cancel", "Back", active = 0)
        fatal.text("Description1", 15, 70, 320, 80, 0x30003,
                   "[ProductName] setup ended prematurely because of an error.  Your system has not been modified.  To install this program at a later time, please run the installation again.")
        fatal.text("Description2", 15, 155, 320, 20, 0x30003,
                   "Click the Finish button to exit the Installer.")
        c=fatal.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Exit")

        user_exit=PyDialog(db, "UserExit", x, y, w, h, modal, title,
                     "Finish", "Finish", "Finish")
        user_exit.title("[ProductName] Installer was interrupted")
        user_exit.back("< Back", "Finish", active = 0)
        user_exit.cancel("Cancel", "Back", active = 0)
        user_exit.text("Description1", 15, 70, 320, 80, 0x30003,
                   "[ProductName] setup was interrupted.  Your system has not been modified.  "
                   "To install this program at a later time, please run the installation again.")
        user_exit.text("Description2", 15, 155, 320, 20, 0x30003,
                   "Click the Finish button to exit the Installer.")
        c = user_exit.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Exit")

        exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title,
                             "Finish", "Finish", "Finish")
        exit_dialog.title("Completing the [ProductName] Installer")
        exit_dialog.back("< Back", "Finish", active = 0)
        exit_dialog.cancel("Cancel", "Back", active = 0)
        exit_dialog.text("Description", 15, 235, 320, 20, 0x30003,
                   "Click the Finish button to exit the Installer.")
        c = exit_dialog.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Return")

        #####################################################################
        # Required dialog: FilesInUse, ErrorDlg
        inuse = PyDialog(db, "FilesInUse",
                         x, y, w, h,
                         19,                # KeepModeless|Modal|Visible
                         title,
                         "Retry", "Retry", "Retry", bitmap=False)
        inuse.text("Title", 15, 6, 200, 15, 0x30003,
                   r"{\DlgFontBold8}Files in Use")
        inuse.text("Description", 20, 23, 280, 20, 0x30003,
               "Some files that need to be updated are currently in use.")
        inuse.text("Text", 20, 55, 330, 50, 3,
                   "The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.")
        inuse.control("List", "ListBox", 20, 107, 330, 130, 7, "FileInUseProcess",
                      None, None, None)
        c=inuse.back("Exit", "Ignore", name="Exit")
        c.event("EndDialog", "Exit")
        c=inuse.next("Ignore", "Retry", name="Ignore")
        c.event("EndDialog", "Ignore")
        c=inuse.cancel("Retry", "Exit", name="Retry")
        c.event("EndDialog","Retry")

        # See "Error Dialog". See "ICE20" for the required names of the controls.
        error = Dialog(db, "ErrorDlg",
                       50, 10, 330, 101,
                       65543,       # Error|Minimize|Modal|Visible
                       title,
                       "ErrorText", None, None)
        error.text("ErrorText", 50,9,280,48,3, "")
        #error.control("ErrorIcon", "Icon", 15, 9, 24, 24, 5242881, None, "py.ico", None, None)
        error.pushbutton("N",120,72,81,21,3,"No",None).event("EndDialog","ErrorNo")
        error.pushbutton("Y",240,72,81,21,3,"Yes",None).event("EndDialog","ErrorYes")
        error.pushbutton("A",0,72,81,21,3,"Abort",None).event("EndDialog","ErrorAbort")
        error.pushbutton("C",42,72,81,21,3,"Cancel",None).event("EndDialog","ErrorCancel")
        error.pushbutton("I",81,72,81,21,3,"Ignore",None).event("EndDialog","ErrorIgnore")
        error.pushbutton("O",159,72,81,21,3,"Ok",None).event("EndDialog","ErrorOk")
        error.pushbutton("R",198,72,81,21,3,"Retry",None).event("EndDialog","ErrorRetry")

        #####################################################################
        # Global "Query Cancel" dialog
        cancel = Dialog(db, "CancelDlg", 50, 10, 260, 85, 3, title,
                        "No", "No", "No")
        cancel.text("Text", 48, 15, 194, 30, 3,
                    "Are you sure you want to cancel [ProductName] installation?")
        #cancel.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None,
        #               "py.ico", None, None)
        c=cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No")
        c.event("EndDialog", "Exit")

        c=cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes")
        c.event("EndDialog", "Return")

        #####################################################################
        # Global "Wait for costing" dialog
        costing = Dialog(db, "WaitForCostingDlg", 50, 10, 260, 85, modal, title,
                         "Return", "Return", "Return")
        costing.text("Text", 48, 15, 194, 30, 3,
                     "Please wait while the installer finishes determining your disk space requirements.")
        c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None)
        c.event("EndDialog", "Exit")

        #####################################################################
        # Preparation dialog: no user input except cancellation
        prep = PyDialog(db, "PrepareDlg", x, y, w, h, modeless, title,
                        "Cancel", "Cancel", "Cancel")
        prep.text("Description", 15, 70, 320, 40, 0x30003,
                  "Please wait while the Installer prepares to guide you through the installation.")
        prep.title("Welcome to the [ProductName] Installer")
        c=prep.text("ActionText", 15, 110, 320, 20, 0x30003, "Pondering...")
        c.mapping("ActionText", "Text")
        c=prep.text("ActionData", 15, 135, 320, 30, 0x30003, None)
        c.mapping("ActionData", "Text")
        prep.back("Back", None, active=0)
        prep.next("Next", None, active=0)
        c=prep.cancel("Cancel", None)
        c.event("SpawnDialog", "CancelDlg")

        #####################################################################
        # Feature (Python directory) selection
        seldlg = PyDialog(db, "SelectFeaturesDlg", x, y, w, h, modal, title,
                        "Next", "Next", "Cancel")
        seldlg.title("Select Python Installations")

        seldlg.text("Hint", 15, 30, 300, 20, 3,
                    "Select the Python locations where %s should be installed."
                    % self.distribution.get_fullname())

        seldlg.back("< Back", None, active=0)
        c = seldlg.next("Next >", "Cancel")
        order = 1
        c.event("[TARGETDIR]", "[SourceDir]", ordering=order)
        for version in self.versions + [self.other_version]:
            order += 1
            c.event("[TARGETDIR]", "[TARGETDIR%s]" % version,
                    "FEATURE_SELECTED AND &Python%s=3" % version,
                    ordering=order)
        c.event("SpawnWaitDialog", "WaitForCostingDlg", ordering=order + 1)
        c.event("EndDialog", "Return", ordering=order + 2)
        c = seldlg.cancel("Cancel", "Features")
        c.event("SpawnDialog", "CancelDlg")

        c = seldlg.control("Features", "SelectionTree", 15, 60, 300, 120, 3,
                           "FEATURE", None, "PathEdit", None)
        c.event("[FEATURE_SELECTED]", "1")
        ver = self.other_version
        install_other_cond = "FEATURE_SELECTED AND &Python%s=3" % ver
        dont_install_other_cond = "FEATURE_SELECTED AND &Python%s<>3" % ver

        c = seldlg.text("Other", 15, 200, 300, 15, 3,
                        "Provide an alternate Python location")
        c.condition("Enable", install_other_cond)
        c.condition("Show", install_other_cond)
        c.condition("Disable", dont_install_other_cond)
        c.condition("Hide", dont_install_other_cond)

        c = seldlg.control("PathEdit", "PathEdit", 15, 215, 300, 16, 1,
                           "TARGETDIR" + ver, None, "Next", None)
        c.condition("Enable", install_other_cond)
        c.condition("Show", install_other_cond)
        c.condition("Disable", dont_install_other_cond)
        c.condition("Hide", dont_install_other_cond)

        #####################################################################
        # Disk cost
        cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title,
                        "OK", "OK", "OK", bitmap=False)
        cost.text("Title", 15, 6, 200, 15, 0x30003,
                 r"{\DlgFontBold8}Disk Space Requirements")
        cost.text("Description", 20, 20, 280, 20, 0x30003,
                  "The disk space required for the installation of the selected features.")
        cost.text("Text", 20, 53, 330, 60, 3,
                  "The highlighted volumes (if any) do not have enough disk space "
              "available for the currently selected features.  You can either "
              "remove some files from the highlighted volumes, or choose to "
              "install less features onto local drive(s), or select different "
              "destination drive(s).")
        cost.control("VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223,
                     None, "{120}{70}{70}{70}{70}", None, None)
        cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return")

        #####################################################################
        # WhichUsers Dialog. Only available on NT, and for privileged users.
        # This must be run before FindRelatedProducts, because that will
        # take into account whether the previous installation was per-user
        # or per-machine. We currently don't support going back to this
        # dialog after "Next" was selected; to support this, we would need to
        # find how to reset the ALLUSERS property, and how to re-run
        # FindRelatedProducts.
        # On Windows9x, the ALLUSERS property is ignored on the command line
        # and in the Property table, but installer fails according to the documentation
        # if a dialog attempts to set ALLUSERS.
        whichusers = PyDialog(db, "WhichUsersDlg", x, y, w, h, modal, title,
                            "AdminInstall", "Next", "Cancel")
        whichusers.title("Select whether to install [ProductName] for all users of this computer.")
        # A radio group with two options: allusers, justme
        g = whichusers.radiogroup("AdminInstall", 15, 60, 260, 50, 3,
                                  "WhichUsers", "", "Next")
        g.add("ALL", 0, 5, 150, 20, "Install for all users")
        g.add("JUSTME", 0, 25, 150, 20, "Install just for me")

        whichusers.back("Back", None, active=0)

        c = whichusers.next("Next >", "Cancel")
        c.event("[ALLUSERS]", "1", 'WhichUsers="ALL"', 1)
        c.event("EndDialog", "Return", ordering = 2)

        c = whichusers.cancel("Cancel", "AdminInstall")
        c.event("SpawnDialog", "CancelDlg")

        #####################################################################
        # Installation Progress dialog (modeless)
        progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title,
                            "Cancel", "Cancel", "Cancel", bitmap=False)
        progress.text("Title", 20, 15, 200, 15, 0x30003,
                     r"{\DlgFontBold8}[Progress1] [ProductName]")
        progress.text("Text", 35, 65, 300, 30, 3,
                      "Please wait while the Installer [Progress2] [ProductName]. "
                      "This may take several minutes.")
        progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:")

        c=progress.text("ActionText", 70, 100, w-70, 20, 3, "Pondering...")
        c.mapping("ActionText", "Text")

        #c=progress.text("ActionData", 35, 140, 300, 20, 3, None)
        #c.mapping("ActionData", "Text")

        c=progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10, 65537,
                           None, "Progress done", None, None)
        c.mapping("SetProgress", "Progress")

        progress.back("< Back", "Next", active=False)
        progress.next("Next >", "Cancel", active=False)
        progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg")

        ###################################################################
        # Maintenance type: repair/uninstall
        maint = PyDialog(db, "MaintenanceTypeDlg", x, y, w, h, modal, title,
                         "Next", "Next", "Cancel")
        maint.title("Welcome to the [ProductName] Setup Wizard")
        maint.text("BodyText", 15, 63, 330, 42, 3,
                   "Select whether you want to repair or remove [ProductName].")
        g=maint.radiogroup("RepairRadioGroup", 15, 108, 330, 60, 3,
                            "MaintenanceForm_Action", "", "Next")
        #g.add("Change", 0, 0, 200, 17, "&Change [ProductName]")
        g.add("Repair", 0, 18, 200, 17, "&Repair [ProductName]")
        g.add("Remove", 0, 36, 200, 17, "Re&move [ProductName]")

        maint.back("< Back", None, active=False)
        c=maint.next("Finish", "Cancel")
        # Change installation: Change progress dialog to "Change", then ask
        # for feature selection
        #c.event("[Progress1]", "Change", 'MaintenanceForm_Action="Change"', 1)
        #c.event("[Progress2]", "changes", 'MaintenanceForm_Action="Change"', 2)

        # Reinstall: Change progress dialog to "Repair", then invoke reinstall
        # Also set list of reinstalled features to "ALL"
        c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 5)
        c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"', 6)
        c.event("[Progress2]", "repairs", 'MaintenanceForm_Action="Repair"', 7)
        c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 8)

        # Uninstall: Change progress to "Remove", then invoke uninstall
        # Also set list of removed features to "ALL"
        c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11)
        c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"', 12)
        c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"', 13)
        c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14)

        # Close dialog when maintenance action scheduled
        c.event("EndDialog", "Return", 'MaintenanceForm_Action<>"Change"', 20)
        #c.event("NewDialog", "SelectFeaturesDlg", 'MaintenanceForm_Action="Change"', 21)

        maint.cancel("Cancel", "RepairRadioGroup").event("SpawnDialog", "CancelDlg")

    def get_installer_filename(self, fullname):
        # Factored out to allow overriding in subclasses
        if self.target_version:
            base_name = "%s.%s-py%s.msi" % (fullname, self.plat_name,
                                            self.target_version)
        else:
            base_name = "%s.%s.msi" % (fullname, self.plat_name)
        installer_name = os.path.join(self.dist_dir, base_name)
        return installer_name
PK         ! :                    install_scripts.pynu [        PK         ! ;Rx  Rx  
            #  install.pynu [        PK         ! d]!T  !T                bdist_rpm.pynu [        PK         ! *Rj&                  install_headers.pynu [        PK         ! 39  9              `  bdist.pynu [        PK         !                   check.pynu [        PK         ! ,
  
               clean.pynu [        PK         ! !  !               install_lib.pynu [        PK         ! v3;V  V              3 build_clib.pynu [        PK         ! d+X  X              R build_scripts.pynu [        PK         ! 7=3  =3  	            6k config.pynu [        PK         ! "    !             __pycache__/build.cpython-310.pycnu [        PK         ! S/  /  %             __pycache__/bdist_rpm.cpython-310.pycnu [        PK         ! e1l8  l8  !             __pycache__/sdist.cpython-310.pycnu [        PK         ! u    &             __pycache__/bdist_dumb.cpython-310.pycnu [        PK         ! X|  |  '            7% __pycache__/install_lib.cpython-310.pycnu [        PK         ! _]nY  Y  !            
: __pycache__/check.cpython-310.pycnu [        PK         ! i:  :  #            M __pycache__/install.cpython-310.pycnu [        PK         ! xY=    &             __pycache__/build_clib.cpython-310.pycnu [        PK         ! `d#(  #(  "             __pycache__/config.cpython-310.pycnu [        PK         ! rk}    +             __pycache__/install_headers.cpython-310.pycnu [        PK         ! PM    $             __pycache__/__init__.cpython-310.pycnu [        PK         ! ,-  -  !             __pycache__/clean.cpython-310.pycnu [        PK         ! 5'+w  w  ,            7 __pycache__/install_egg_info.cpython-310.pycnu [        PK         ! !稴!  !  $            
 __pycache__/register.cpython-310.pycnu [        PK         ! sDL    )             __pycache__/build_scripts.cpython-310.pycnu [        PK         ! ]$B>  >  %            T __pycache__/build_ext.cpython-310.pycnu [        PK         ! iNߓ(  (  $            OV __pycache__/build_py.cpython-310.pycnu [        PK         !     !             __pycache__/bdist.cpython-310.pycnu [        PK         ! Z`  `  +             __pycache__/install_scripts.cpython-310.pycnu [        PK         ! 21L  L  %            w __pycache__/bdist_msi.cpython-310.pycnu [        PK         ! 1F    (             __pycache__/install_data.cpython-310.pycnu [        PK         ! u<    "             __pycache__/upload.cpython-310.pycnu [        PK         ! =}c{  {               build_ext.pynu [        PK         !                  ~ install_data.pynu [        PK         ! w1  1              E bdist_dumb.pynu [        PK         ! H    	             upload.pynu [        PK         ! ^                 __init__.pynu [        PK         ! s&C  &C               build_py.pynu [        PK         ! -  -              P register.pynu [        PK         ! x                K/ build.pynu [        PK         ! t=J  =J              
F sdist.pynu [        PK         ! Z                 install_egg_info.pynu [        PK         ! r|y  y               command_templatenu [        PK         ! ^Կ                B bdist_msi.pynu [        PK    - -   =,   