usr/bin/command000075500000000037147207316110007473 0ustar00#!/bin/sh builtin command "$@" install_lib.py000064400000020315147210141470007414 0ustar00"""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 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'), ) 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): 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 __init__.py000064400000001437147210141470006663 0ustar00"""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', 'bdist_wininst', '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 ] setopt.py000064400000011735147210141470006444 0ustar00from distutils.util import convert_path from distutils import log from distutils.errors import DistutilsOptionError import distutils import os from setuptools.extern.six.moves import configparser from setuptools import Command __all__ = ['config_file', 'edit_config', 'option_base', 'setopt'] def config_file(kind="local"): """Get the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" """ if kind == 'local': return 'setup.cfg' if kind == 'global': return os.path.join( os.path.dirname(distutils.__file__), 'distutils.cfg' ) if kind == 'user': dot = os.name == 'posix' and '.' or '' return os.path.expanduser(convert_path("~/%spydistutils.cfg" % dot)) raise ValueError( "config_file() type must be 'local', 'global', or 'user'", kind ) def edit_config(filename, settings, dry_run=False): """Edit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or deleted in that section. A setting of ``None`` means to delete that setting. """ log.debug("Reading configuration from %s", filename) opts = configparser.RawConfigParser() opts.read([filename]) for section, options in settings.items(): if options is None: log.info("Deleting section [%s] from %s", section, filename) opts.remove_section(section) else: if not opts.has_section(section): log.debug("Adding new section [%s] to %s", section, filename) opts.add_section(section) for option, value in options.items(): if value is None: log.debug( "Deleting %s.%s from %s", section, option, filename ) opts.remove_option(section, option) if not opts.options(section): log.info("Deleting empty [%s] section from %s", section, filename) opts.remove_section(section) else: log.debug( "Setting %s.%s to %r in %s", section, option, value, filename ) opts.set(section, option, value) log.info("Writing %s", filename) if not dry_run: with open(filename, 'w') as f: opts.write(f) class option_base(Command): """Abstract base class for commands that mess with config files""" user_options = [ ('global-config', 'g', "save options to the site-wide distutils.cfg file"), ('user-config', 'u', "save options to the current user's pydistutils.cfg file"), ('filename=', 'f', "configuration file to use (default=setup.cfg)"), ] boolean_options = [ 'global-config', 'user-config', ] def initialize_options(self): self.global_config = None self.user_config = None self.filename = None def finalize_options(self): filenames = [] if self.global_config: filenames.append(config_file('global')) if self.user_config: filenames.append(config_file('user')) if self.filename is not None: filenames.append(self.filename) if not filenames: filenames.append(config_file('local')) if len(filenames) > 1: raise DistutilsOptionError( "Must specify only one configuration file option", filenames ) self.filename, = filenames class setopt(option_base): """Save command-line options to a file""" description = "set an option in setup.cfg or another config file" user_options = [ ('command=', 'c', 'command to set an option for'), ('option=', 'o', 'option to set'), ('set-value=', 's', 'value of the option'), ('remove', 'r', 'remove (unset) the value'), ] + option_base.user_options boolean_options = option_base.boolean_options + ['remove'] def initialize_options(self): option_base.initialize_options(self) self.command = None self.option = None self.set_value = None self.remove = None def finalize_options(self): option_base.finalize_options(self) if self.command is None or self.option is None: raise DistutilsOptionError("Must specify --command *and* --option") if self.set_value is None and not self.remove: raise DistutilsOptionError("Must specify --set-value or --remove") def run(self): edit_config( self.filename, { self.command: {self.option.replace('-', '_'): self.set_value} }, self.dry_run ) test.py000064400000021776147210141470006113 0ustar00import os import operator import sys import contextlib import itertools import unittest from distutils.errors import DistutilsError, DistutilsOptionError from distutils import log from unittest import TestLoader from setuptools.extern import six from setuptools.extern.six.moves import map, filter from pkg_resources import (resource_listdir, resource_exists, normalize_path, working_set, _namespace_packages, evaluate_marker, add_activation_listener, require, EntryPoint) from setuptools import Command class ScanningLoader(TestLoader): def __init__(self): TestLoader.__init__(self) self._visited = set() def loadTestsFromModule(self, module, pattern=None): """Return a suite of all tests cases contained in the given module If the module is a package, load tests from all the modules in it. If the module has an ``additional_tests`` function, call it and add the return value to the tests. """ if module in self._visited: return None self._visited.add(module) tests = [] tests.append(TestLoader.loadTestsFromModule(self, module)) if hasattr(module, "additional_tests"): tests.append(module.additional_tests()) if hasattr(module, '__path__'): for file in resource_listdir(module.__name__, ''): if file.endswith('.py') and file != '__init__.py': submodule = module.__name__ + '.' + file[:-3] else: if resource_exists(module.__name__, file + '/__init__.py'): submodule = module.__name__ + '.' + file else: continue tests.append(self.loadTestsFromName(submodule)) if len(tests) != 1: return self.suiteClass(tests) else: return tests[0] # don't create a nested suite for only one return # adapted from jaraco.classes.properties:NonDataProperty class NonDataProperty(object): def __init__(self, fget): self.fget = fget def __get__(self, obj, objtype=None): if obj is None: return self return self.fget(obj) class test(Command): """Command to run unit tests after in-place build""" description = "run unit tests after in-place build" user_options = [ ('test-module=', 'm', "Run 'test_suite' in specified module"), ('test-suite=', 's', "Run single test, case or suite (e.g. 'module.test_suite')"), ('test-runner=', 'r', "Test runner to use"), ] def initialize_options(self): self.test_suite = None self.test_module = None self.test_loader = None self.test_runner = None def finalize_options(self): if self.test_suite and self.test_module: msg = "You may specify a module or a suite, but not both" raise DistutilsOptionError(msg) if self.test_suite is None: if self.test_module is None: self.test_suite = self.distribution.test_suite else: self.test_suite = self.test_module + ".test_suite" if self.test_loader is None: self.test_loader = getattr(self.distribution, 'test_loader', None) if self.test_loader is None: self.test_loader = "setuptools.command.test:ScanningLoader" if self.test_runner is None: self.test_runner = getattr(self.distribution, 'test_runner', None) @NonDataProperty def test_args(self): return list(self._test_args()) def _test_args(self): if not self.test_suite and sys.version_info >= (2, 7): yield 'discover' if self.verbose: yield '--verbose' if self.test_suite: yield self.test_suite def with_project_on_sys_path(self, func): """ Backward compatibility for project_on_sys_path context. """ with self.project_on_sys_path(): func() @contextlib.contextmanager def project_on_sys_path(self, include_dists=[]): with_2to3 = six.PY3 and getattr(self.distribution, 'use_2to3', False) if with_2to3: # If we run 2to3 we can not do this inplace: # Ensure metadata is up-to-date self.reinitialize_command('build_py', inplace=0) self.run_command('build_py') bpy_cmd = self.get_finalized_command("build_py") build_path = normalize_path(bpy_cmd.build_lib) # Build extensions self.reinitialize_command('egg_info', egg_base=build_path) self.run_command('egg_info') self.reinitialize_command('build_ext', inplace=0) self.run_command('build_ext') else: # Without 2to3 inplace works fine: self.run_command('egg_info') # Build extensions in-place self.reinitialize_command('build_ext', inplace=1) self.run_command('build_ext') ei_cmd = self.get_finalized_command("egg_info") old_path = sys.path[:] old_modules = sys.modules.copy() try: project_path = normalize_path(ei_cmd.egg_base) sys.path.insert(0, project_path) working_set.__init__() add_activation_listener(lambda dist: dist.activate()) require('%s==%s' % (ei_cmd.egg_name, ei_cmd.egg_version)) with self.paths_on_pythonpath([project_path]): yield finally: sys.path[:] = old_path sys.modules.clear() sys.modules.update(old_modules) working_set.__init__() @staticmethod @contextlib.contextmanager def paths_on_pythonpath(paths): """ Add the indicated paths to the head of the PYTHONPATH environment variable so that subprocesses will also see the packages at these paths. Do this in a context that restores the value on exit. """ nothing = object() orig_pythonpath = os.environ.get('PYTHONPATH', nothing) current_pythonpath = os.environ.get('PYTHONPATH', '') try: prefix = os.pathsep.join(paths) to_join = filter(None, [prefix, current_pythonpath]) new_path = os.pathsep.join(to_join) if new_path: os.environ['PYTHONPATH'] = new_path yield finally: if orig_pythonpath is nothing: os.environ.pop('PYTHONPATH', None) else: os.environ['PYTHONPATH'] = orig_pythonpath @staticmethod def install_dists(dist): """ Install the requirements indicated by self.distribution and return an iterable of the dists that were built. """ ir_d = dist.fetch_build_eggs(dist.install_requires) tr_d = dist.fetch_build_eggs(dist.tests_require or []) er_d = dist.fetch_build_eggs( v for k, v in dist.extras_require.items() if k.startswith(':') and evaluate_marker(k[1:]) ) return itertools.chain(ir_d, tr_d, er_d) def run(self): installed_dists = self.install_dists(self.distribution) cmd = ' '.join(self._argv) if self.dry_run: self.announce('skipping "%s" (dry run)' % cmd) return self.announce('running "%s"' % cmd) paths = map(operator.attrgetter('location'), installed_dists) with self.paths_on_pythonpath(paths): with self.project_on_sys_path(): self.run_tests() def run_tests(self): # Purge modules under test from sys.modules. The test loader will # re-import them from the build location. Required when 2to3 is used # with namespace packages. if six.PY3 and getattr(self.distribution, 'use_2to3', False): module = self.test_suite.split('.')[0] if module in _namespace_packages: del_modules = [] if module in sys.modules: del_modules.append(module) module += '.' for name in sys.modules: if name.startswith(module): del_modules.append(name) list(map(sys.modules.__delitem__, del_modules)) test = unittest.main( None, None, self._argv, testLoader=self._resolve_as_ep(self.test_loader), testRunner=self._resolve_as_ep(self.test_runner), exit=False, ) if not test.result.wasSuccessful(): msg = 'Test failed: %s' % test.result self.announce(msg, log.ERROR) raise DistutilsError(msg) @property def _argv(self): return ['unittest'] + self.test_args @staticmethod def _resolve_as_ep(val): """ Load the indicated attribute value, called, as a as if it were specified as an entry point. """ if val is None: return parsed = EntryPoint.parse("x=" + val) return parsed.resolve()() install_egg_info.py000064400000005053147210141470010425 0ustar00"""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"), ] def initialize_options(self): self.install_dir = None def finalize_options(self): self.set_undefined_options('install_lib',('install_dir','install_dir')) 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('-','_') upload.py000064400000016767147210141470006424 0ustar00""" distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to a package index). """ import os import io import platform import hashlib from base64 import standard_b64encode from urllib.request import urlopen, Request, HTTPError 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 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, 'sha256_digest': hashlib.sha256(content).hexdigest(), # 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(), } try: digest = hashlib.md5(content).hexdigest() except ValueError as e: msg = 'calculating md5 checksum failed: %s' % e self.announce(msg, log.INFO) from _hashlib import get_fips_mode if not get_fips_mode(): # this really shouldn't fail raise else: data['md5_digest'] = digest comment = '' if command == 'bdist_rpm': dist, version, id = platform.dist() if dist: comment = 'built for %s %s' % (dist, version) elif command == 'bdist_dumb': comment = 'built for %s' % platform.platform(terse=1) data['comment'] = comment if self.sign: data['gpg_signature'] = (os.path.basename(filename) + ".asc", open(filename+".asc", "rb").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) build_ext.py000064400000075376147210141470007120 0ustar00"""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.append(py_include) if plat_py_include != py_include: self.include_dirs.append(plat_py_include) 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 or win-ia64 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 and AtheOS Python's library directory must be # appended to library_dirs if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos': 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 (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) sources = list(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. """ initfunc_name = "PyInit_" + ext.name.split('.')[-1] 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: return ext.libraries elif sys.platform[:6] == "cygwin": template = "python%d.%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] elif sys.platform[:6] == "atheos": from distutils import sysconfig template = "python%d.%d" pythonlib = (template % (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) # Get SHLIBS from Makefile extra = [] for lib in sysconfig.get_config_var('SHLIBS').split(): if lib.startswith('-l'): extra.append(lib[2:]) else: extra.append(lib) # don't extend ext.libraries, it may be shared with other # extensions, it is a reference to the original list return ext.libraries + [pythonlib, "m"] + extra elif sys.platform == 'darwin': # Don't use the default code below return ext.libraries elif sys.platform[:3] == 'aix': # Don't use the default code below return ext.libraries else: from distutils import sysconfig if sysconfig.get_config_var('Py_ENABLE_SHARED'): pythonlib = 'python{}.{}{}'.format( sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, sysconfig.get_config_var('ABIFLAGS')) return ext.libraries + [pythonlib] else: return ext.libraries egg_info.py000064400000060340147210141470006677 0ustar00"""setuptools.command.egg_info Create a distribution's .egg-info directory and contents""" from distutils.filelist import FileList as _FileList from distutils.errors import DistutilsInternalError from distutils.util import convert_path from distutils import log import distutils.errors import distutils.filelist import os import re import sys import io import warnings import time import collections from setuptools.extern import six from setuptools.extern.six.moves import map from setuptools import Command from setuptools.command.sdist import sdist from setuptools.command.sdist import walk_revctrl from setuptools.command.setopt import edit_config from setuptools.command import bdist_egg from pkg_resources import ( parse_requirements, safe_name, parse_version, safe_version, yield_lines, EntryPoint, iter_entry_points, to_filename) import setuptools.unicode_utils as unicode_utils from setuptools.glob import glob from setuptools.extern import packaging def translate_pattern(glob): """ Translate a file path glob like '*.txt' in to a regular expression. This differs from fnmatch.translate which allows wildcards to match directory separators. It also knows about '**/' which matches any number of directories. """ pat = '' # This will split on '/' within [character classes]. This is deliberate. chunks = glob.split(os.path.sep) sep = re.escape(os.sep) valid_char = '[^%s]' % (sep,) for c, chunk in enumerate(chunks): last_chunk = c == len(chunks) - 1 # Chunks that are a literal ** are globstars. They match anything. if chunk == '**': if last_chunk: # Match anything if this is the last component pat += '.*' else: # Match '(name/)*' pat += '(?:%s+%s)*' % (valid_char, sep) continue # Break here as the whole path component has been handled # Find any special characters in the remainder i = 0 chunk_len = len(chunk) while i < chunk_len: char = chunk[i] if char == '*': # Match any number of name characters pat += valid_char + '*' elif char == '?': # Match a name character pat += valid_char elif char == '[': # Character class inner_i = i + 1 # Skip initial !/] chars if inner_i < chunk_len and chunk[inner_i] == '!': inner_i = inner_i + 1 if inner_i < chunk_len and chunk[inner_i] == ']': inner_i = inner_i + 1 # Loop till the closing ] is found while inner_i < chunk_len and chunk[inner_i] != ']': inner_i = inner_i + 1 if inner_i >= chunk_len: # Got to the end of the string without finding a closing ] # Do not treat this as a matching group, but as a literal [ pat += re.escape(char) else: # Grab the insides of the [brackets] inner = chunk[i + 1:inner_i] char_class = '' # Class negation if inner[0] == '!': char_class = '^' inner = inner[1:] char_class += re.escape(inner) pat += '[%s]' % (char_class,) # Skip to the end ] i = inner_i else: pat += re.escape(char) i += 1 # Join each chunk with the dir separator if not last_chunk: pat += sep pat += r'\Z' return re.compile(pat, flags=re.MULTILINE|re.DOTALL) class egg_info(Command): description = "create a distribution's .egg-info directory" user_options = [ ('egg-base=', 'e', "directory containing .egg-info directories" " (default: top of the source tree)"), ('tag-date', 'd', "Add date stamp (e.g. 20050528) to version number"), ('tag-build=', 'b', "Specify explicit tag to add to version number"), ('no-date', 'D', "Don't include date stamp [default]"), ] boolean_options = ['tag-date'] negative_opt = { 'no-date': 'tag-date', } def initialize_options(self): self.egg_name = None self.egg_version = None self.egg_base = None self.egg_info = None self.tag_build = None self.tag_date = 0 self.broken_egg_info = False self.vtags = None #################################### # allow the 'tag_svn_revision' to be detected and # set, supporting sdists built on older Setuptools. @property def tag_svn_revision(self): pass @tag_svn_revision.setter def tag_svn_revision(self, value): pass #################################### def save_version_info(self, filename): """ Materialize the value of date into the build tag. Install build keys in a deterministic order to avoid arbitrary reordering on subsequent builds. """ egg_info = collections.OrderedDict() # follow the order these keys would have been added # when PYTHONHASHSEED=0 egg_info['tag_build'] = self.tags() egg_info['tag_date'] = 0 edit_config(filename, dict(egg_info=egg_info)) def finalize_options(self): self.egg_name = safe_name(self.distribution.get_name()) self.vtags = self.tags() self.egg_version = self.tagged_version() parsed_version = parse_version(self.egg_version) try: is_version = isinstance(parsed_version, packaging.version.Version) spec = ( "%s==%s" if is_version else "%s===%s" ) list( parse_requirements(spec % (self.egg_name, self.egg_version)) ) except ValueError: raise distutils.errors.DistutilsOptionError( "Invalid distribution name or version syntax: %s-%s" % (self.egg_name, self.egg_version) ) if self.egg_base is None: dirs = self.distribution.package_dir self.egg_base = (dirs or {}).get('', os.curdir) self.ensure_dirname('egg_base') self.egg_info = to_filename(self.egg_name) + '.egg-info' if self.egg_base != os.curdir: self.egg_info = os.path.join(self.egg_base, self.egg_info) if '-' in self.egg_name: self.check_broken_egg_info() # Set package version for the benefit of dumber commands # (e.g. sdist, bdist_wininst, etc.) # self.distribution.metadata.version = self.egg_version # If we bootstrapped around the lack of a PKG-INFO, as might be the # case in a fresh checkout, make sure that any special tags get added # to the version info # pd = self.distribution._patched_dist if pd is not None and pd.key == self.egg_name.lower(): pd._version = self.egg_version pd._parsed_version = parse_version(self.egg_version) self.distribution._patched_dist = None def write_or_delete_file(self, what, filename, data, force=False): """Write `data` to `filename` or delete if empty If `data` is non-empty, this routine is the same as ``write_file()``. If `data` is empty but not ``None``, this is the same as calling ``delete_file(filename)`. If `data` is ``None``, then this is a no-op unless `filename` exists, in which case a warning is issued about the orphaned file (if `force` is false), or deleted (if `force` is true). """ if data: self.write_file(what, filename, data) elif os.path.exists(filename): if data is None and not force: log.warn( "%s not set in setup(), but %s exists", what, filename ) return else: self.delete_file(filename) def write_file(self, what, filename, data): """Write `data` to `filename` (if not a dry run) after announcing it `what` is used in a log message to identify what is being written to the file. """ log.info("writing %s to %s", what, filename) if six.PY3: data = data.encode("utf-8") if not self.dry_run: f = open(filename, 'wb') f.write(data) f.close() def delete_file(self, filename): """Delete `filename` (if not a dry run) after announcing it""" log.info("deleting %s", filename) if not self.dry_run: os.unlink(filename) def tagged_version(self): version = self.distribution.get_version() # egg_info may be called more than once for a distribution, # in which case the version string already contains all tags. if self.vtags and version.endswith(self.vtags): return safe_version(version) return safe_version(version + self.vtags) def run(self): self.mkpath(self.egg_info) installer = self.distribution.fetch_build_egg for ep in iter_entry_points('egg_info.writers'): ep.require(installer=installer) writer = ep.resolve() writer(self, ep.name, os.path.join(self.egg_info, ep.name)) # Get rid of native_libs.txt if it was put there by older bdist_egg nl = os.path.join(self.egg_info, "native_libs.txt") if os.path.exists(nl): self.delete_file(nl) self.find_sources() def tags(self): version = '' if self.tag_build: version += self.tag_build if self.tag_date: version += time.strftime("-%Y%m%d") return version def find_sources(self): """Generate SOURCES.txt manifest file""" manifest_filename = os.path.join(self.egg_info, "SOURCES.txt") mm = manifest_maker(self.distribution) mm.manifest = manifest_filename mm.run() self.filelist = mm.filelist def check_broken_egg_info(self): bei = self.egg_name + '.egg-info' if self.egg_base != os.curdir: bei = os.path.join(self.egg_base, bei) if os.path.exists(bei): log.warn( "-" * 78 + '\n' "Note: Your current .egg-info directory has a '-' in its name;" '\nthis will not work correctly with "setup.py develop".\n\n' 'Please rename %s to %s to correct this problem.\n' + '-' * 78, bei, self.egg_info ) self.broken_egg_info = self.egg_info self.egg_info = bei # make it work for now class FileList(_FileList): # Implementations of the various MANIFEST.in commands def process_template_line(self, line): # Parse the line: split it up, make sure the right number of words # is there, and return the relevant words. 'action' is always # defined: it's the first word of the line. Which of the other # three are defined depends on the action; it'll be either # patterns, (dir and patterns), or (dir_pattern). (action, patterns, dir, dir_pattern) = self._parse_template_line(line) # OK, now we know that the action is valid and we have the # right number of words on the line for that action -- so we # can proceed with minimal error-checking. if action == 'include': self.debug_print("include " + ' '.join(patterns)) for pattern in patterns: if not self.include(pattern): log.warn("warning: no files found matching '%s'", pattern) elif action == 'exclude': self.debug_print("exclude " + ' '.join(patterns)) for pattern in patterns: if not self.exclude(pattern): log.warn(("warning: no previously-included files " "found matching '%s'"), pattern) elif action == 'global-include': self.debug_print("global-include " + ' '.join(patterns)) for pattern in patterns: if not self.global_include(pattern): log.warn(("warning: no files found matching '%s' " "anywhere in distribution"), pattern) elif action == 'global-exclude': self.debug_print("global-exclude " + ' '.join(patterns)) for pattern in patterns: if not self.global_exclude(pattern): log.warn(("warning: no previously-included files matching " "'%s' found anywhere in distribution"), pattern) elif action == 'recursive-include': self.debug_print("recursive-include %s %s" % (dir, ' '.join(patterns))) for pattern in patterns: if not self.recursive_include(dir, pattern): log.warn(("warning: no files found matching '%s' " "under directory '%s'"), pattern, dir) elif action == 'recursive-exclude': self.debug_print("recursive-exclude %s %s" % (dir, ' '.join(patterns))) for pattern in patterns: if not self.recursive_exclude(dir, pattern): log.warn(("warning: no previously-included files matching " "'%s' found under directory '%s'"), pattern, dir) elif action == 'graft': self.debug_print("graft " + dir_pattern) if not self.graft(dir_pattern): log.warn("warning: no directories found matching '%s'", dir_pattern) elif action == 'prune': self.debug_print("prune " + dir_pattern) if not self.prune(dir_pattern): log.warn(("no previously-included directories found " "matching '%s'"), dir_pattern) else: raise DistutilsInternalError( "this cannot happen: invalid action '%s'" % action) def _remove_files(self, predicate): """ Remove all files from the file list that match the predicate. Return True if any matching files were removed """ found = False for i in range(len(self.files) - 1, -1, -1): if predicate(self.files[i]): self.debug_print(" removing " + self.files[i]) del self.files[i] found = True return found def include(self, pattern): """Include files that match 'pattern'.""" found = [f for f in glob(pattern) if not os.path.isdir(f)] self.extend(found) return bool(found) def exclude(self, pattern): """Exclude files that match 'pattern'.""" match = translate_pattern(pattern) return self._remove_files(match.match) def recursive_include(self, dir, pattern): """ Include all files anywhere in 'dir/' that match the pattern. """ full_pattern = os.path.join(dir, '**', pattern) found = [f for f in glob(full_pattern, recursive=True) if not os.path.isdir(f)] self.extend(found) return bool(found) def recursive_exclude(self, dir, pattern): """ Exclude any file anywhere in 'dir/' that match the pattern. """ match = translate_pattern(os.path.join(dir, '**', pattern)) return self._remove_files(match.match) def graft(self, dir): """Include all files from 'dir/'.""" found = [ item for match_dir in glob(dir) for item in distutils.filelist.findall(match_dir) ] self.extend(found) return bool(found) def prune(self, dir): """Filter out files from 'dir/'.""" match = translate_pattern(os.path.join(dir, '**')) return self._remove_files(match.match) def global_include(self, pattern): """ Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees. """ if self.allfiles is None: self.findall() match = translate_pattern(os.path.join('**', pattern)) found = [f for f in self.allfiles if match.match(f)] self.extend(found) return bool(found) def global_exclude(self, pattern): """ Exclude all files anywhere that match the pattern. """ match = translate_pattern(os.path.join('**', pattern)) return self._remove_files(match.match) def append(self, item): if item.endswith('\r'): # Fix older sdists built on Windows item = item[:-1] path = convert_path(item) if self._safe_path(path): self.files.append(path) def extend(self, paths): self.files.extend(filter(self._safe_path, paths)) def _repair(self): """ Replace self.files with only safe paths Because some owners of FileList manipulate the underlying ``files`` attribute directly, this method must be called to repair those paths. """ self.files = list(filter(self._safe_path, self.files)) def _safe_path(self, path): enc_warn = "'%s' not %s encodable -- skipping" # To avoid accidental trans-codings errors, first to unicode u_path = unicode_utils.filesys_decode(path) if u_path is None: log.warn("'%s' in unexpected encoding -- skipping" % path) return False # Must ensure utf-8 encodability utf8_path = unicode_utils.try_encode(u_path, "utf-8") if utf8_path is None: log.warn(enc_warn, path, 'utf-8') return False try: # accept is either way checks out if os.path.exists(u_path) or os.path.exists(utf8_path): return True # this will catch any encode errors decoding u_path except UnicodeEncodeError: log.warn(enc_warn, path, sys.getfilesystemencoding()) class manifest_maker(sdist): template = "MANIFEST.in" def initialize_options(self): self.use_defaults = 1 self.prune = 1 self.manifest_only = 1 self.force_manifest = 1 def finalize_options(self): pass def run(self): self.filelist = FileList() if not os.path.exists(self.manifest): self.write_manifest() # it must exist so it'll get in the list self.add_defaults() if os.path.exists(self.template): self.read_template() self.prune_file_list() self.filelist.sort() self.filelist.remove_duplicates() self.write_manifest() def _manifest_normalize(self, path): path = unicode_utils.filesys_decode(path) return path.replace(os.sep, '/') def write_manifest(self): """ Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. """ self.filelist._repair() # Now _repairs should encodability, but not unicode files = [self._manifest_normalize(f) for f in self.filelist.files] msg = "writing manifest file '%s'" % self.manifest self.execute(write_file, (self.manifest, files), msg) def warn(self, msg): if not self._should_suppress_warning(msg): sdist.warn(self, msg) @staticmethod def _should_suppress_warning(msg): """ suppress missing-file warnings from sdist """ return re.match(r"standard file .*not found", msg) def add_defaults(self): sdist.add_defaults(self) self.filelist.append(self.template) self.filelist.append(self.manifest) rcfiles = list(walk_revctrl()) if rcfiles: self.filelist.extend(rcfiles) elif os.path.exists(self.manifest): self.read_manifest() ei_cmd = self.get_finalized_command('egg_info') self.filelist.graft(ei_cmd.egg_info) def prune_file_list(self): build = self.get_finalized_command('build') base_dir = self.distribution.get_fullname() self.filelist.prune(build.build_base) self.filelist.prune(base_dir) sep = re.escape(os.sep) self.filelist.exclude_pattern(r'(^|' + sep + r')(RCS|CVS|\.svn)' + sep, is_regex=1) def write_file(filename, contents): """Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it. """ contents = "\n".join(contents) # assuming the contents has been vetted for utf-8 encoding contents = contents.encode("utf-8") with open(filename, "wb") as f: # always write POSIX-style manifest f.write(contents) def write_pkg_info(cmd, basename, filename): log.info("writing %s", filename) if not cmd.dry_run: metadata = cmd.distribution.metadata metadata.version, oldver = cmd.egg_version, metadata.version metadata.name, oldname = cmd.egg_name, metadata.name try: # write unescaped data to PKG-INFO, so older pkg_resources # can still parse it metadata.write_pkg_info(cmd.egg_info) finally: metadata.name, metadata.version = oldname, oldver safe = getattr(cmd.distribution, 'zip_safe', None) bdist_egg.write_safety_flag(cmd.egg_info, safe) def warn_depends_obsolete(cmd, basename, filename): if os.path.exists(filename): log.warn( "WARNING: 'depends.txt' is not used by setuptools 0.6!\n" "Use the install_requires/extras_require setup() args instead." ) def _write_requirements(stream, reqs): lines = yield_lines(reqs or ()) append_cr = lambda line: line + '\n' lines = map(append_cr, lines) stream.writelines(lines) def write_requirements(cmd, basename, filename): dist = cmd.distribution data = six.StringIO() _write_requirements(data, dist.install_requires) extras_require = dist.extras_require or {} for extra in sorted(extras_require): data.write('\n[{extra}]\n'.format(**vars())) _write_requirements(data, extras_require[extra]) cmd.write_or_delete_file("requirements", filename, data.getvalue()) def write_setup_requirements(cmd, basename, filename): data = io.StringIO() _write_requirements(data, cmd.distribution.setup_requires) cmd.write_or_delete_file("setup-requirements", filename, data.getvalue()) def write_toplevel_names(cmd, basename, filename): pkgs = dict.fromkeys( [ k.split('.', 1)[0] for k in cmd.distribution.iter_distribution_names() ] ) cmd.write_file("top-level names", filename, '\n'.join(sorted(pkgs)) + '\n') def overwrite_arg(cmd, basename, filename): write_arg(cmd, basename, filename, True) def write_arg(cmd, basename, filename, force=False): argname = os.path.splitext(basename)[0] value = getattr(cmd.distribution, argname, None) if value is not None: value = '\n'.join(value) + '\n' cmd.write_or_delete_file(argname, filename, value, force) def write_entries(cmd, basename, filename): ep = cmd.distribution.entry_points if isinstance(ep, six.string_types) or ep is None: data = ep elif ep is not None: data = [] for section, contents in sorted(ep.items()): if not isinstance(contents, six.string_types): contents = EntryPoint.parse_group(section, contents) contents = '\n'.join(sorted(map(str, contents.values()))) data.append('[%s]\n%s\n\n' % (section, contents)) data = ''.join(data) cmd.write_or_delete_file('entry points', filename, data, True) def get_pkg_info_revision(): """ Get a -r### off of PKG-INFO Version in case this is an sdist of a subversion revision. """ warnings.warn("get_pkg_info_revision is deprecated.", DeprecationWarning) if os.path.exists('PKG-INFO'): with io.open('PKG-INFO') as f: for line in f: match = re.match(r"Version:.*-r(\d+)\s*$", line) if match: return int(match.group(1)) return 0 __pycache__/bdist_wininst.cpython-36.opt-1.pyc000064400000020111147210141470015215 0ustar003 /f<@spdZddlZddlZddlmZddlmZddlmZm Z ddl Tddl m Z ddl mZGd d d eZdS) zzdistutils.command.bdist_wininst Implements the Distutils 'bdist_wininst' command: create a windows installer exe-program.N)Command) get_platform) create_tree remove_tree)*)get_python_version)logc@seZdZdZdZd5dddefd7d9d:d;dd?d@dAdBg Zd dddgZd'd(Zd)d*Z d+d,Z d-d.Z dCd/d0Z d1d2Z d3d4ZdS)D bdist_wininstTz-create an executable installer for MS Windows bdist-dir=N1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s) keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archivetarget-version=z!require a specific python versionz on the target systemno-target-compilec/do not compile .py to .pyc on the target systemno-target-optimizeo;do not compile .py to .pyo (optimized) on the target system dist-dir=d-directory to put final built distributions inbitmap=b>bitmap to use for the installer instead of python-powered logotitle=t?title to display on the installer background instead of default skip-build2skip rebuilding everything (for testing/debugging)install-script=Ubasename of installation script to be run after installation or before deinstallationpre-install-script={Fully qualified filename of a script to be run before any files are installed. This script need not be in the distributionuser-access-control=specify Vista's UAC handling - 'none'/default=no handling, 'auto'=use UAC if target Python installed for all users, 'force'=always use UACcCsRd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ dS)Nr) bdist_dir plat_name keep_tempno_target_compileno_target_optimizetarget_versiondist_dirbitmaptitle skip_buildinstall_scriptpre_install_scriptuser_access_control)selfr5%/usr/lib64/python3.6/bdist_wininst.pyinitialize_options<sz bdist_wininst.initialize_optionscCs|jdd |jdkrR|jr6|jr6|jjd}|j|_|jdj}tj j |d|_|j s^d|_ |j r|jj rt }|j r|j |krtd|f||_ |jdd d |jrx2|jjD]}|jtj j|krPqWtd|jdS) Nbdistr0ZwininstzMtarget version can only be %s, or the '--skip-build' option must be specifiedr-r(z(install_script '%s' not found in scripts)r0r0)r-r-)r(r()Zset_undefined_optionsr'r0r( distributionZget_command_objget_finalized_command bdist_baseospathjoinr,has_ext_modulesrZDistutilsOptionErrorr1scriptsbasename)r4r8r<Z short_versionscriptr5r5r6finalize_optionsLs4      zbdist_wininst.finalize_optionsc Cstjdkr&|jjs|jjr&td|js6|jd|jddd}|j |_ |j|_d|_ |j |_ |jd}d|_ d|_|jjr|j}|sd tjdd }d |j |f}|jd}tjj|jd ||_x4dD],}|j}|dkr|d}t|d||qWtjd|j |jtjjdtjj|j d|jtjd=ddlm}|} |jj } |j!| d|j d} |j"| | |j#|jjrt$} nd} |jj%j&d| |j'| ftj(d| tj)| |j*st+|j |j,ddS)Nwin32z^distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platformbuildinstall)Zreinit_subcommandsr install_libz%d.%dz.%s-%slibpurelibplatlibheadersrAdataz/Include/$dist_nameZinstall_zinstalling to %sZPURELIB)mktempzip)Zroot_diranyr zremoving temporary file '%s')dry_run)rLrMrNrArO)-sysplatformr:r@Zhas_c_librariesZDistutilsPlatformErrorr0Z run_commandZreinitialize_commandr'rootZwarn_dirr(compileoptimizer, version_infor;r=r>r?Z build_baseZ build_libuppersetattrrinfoZensure_finalizedinsertrunZtempfilerP get_fullnameZ make_archive create_exer.rZ dist_filesappendget_installer_filenamedebugremover)rrS) r4rGrIr,Zplat_specifierrFkeyvaluerPZarchive_basenamefullnamearcnameZ pyversionr5r5r6r^rsd                  zbdist_wininst.runc Cs`g}|jj}|jd|jpdd}dd}xJdD]B}t||d}|r2|d|j||f}|jd|||fq2W|jd|jr|jd|j|jd|||jd|j |jd|j |j r|jd|j |j r|jd|j |j p |jj }|jd||ddl }ddl} d|j|j | jf} |jd| dj|S)Nz [metadata]r9 cSs |jddS)Nriz\n)replace)sr5r5r6escapesz)bdist_wininst.get_inidata..escapeauthor author_email description maintainermaintainer_emailnameurlversionz %s: %sz%s=%sz [Setup]zinstall_script=%szinfo=%sztarget_compile=%dztarget_optimize=%dztarget_version=%szuser_access_control=%sztitle=%srzBuilt %s with distutils-%sz build_info=%s)rmrnrorprqrrrsrt)r:metadataraZlong_descriptiongetattr capitalizer1r*r+r,r3r/r_time distutilsZctime __version__r?) r4linesrur\rlrrrOr/rxryZ build_infor5r5r6 get_inidatas<   zbdist_wininst.get_inidatac Csddl}|j|j|j}|j|}|jd||rPt|dj}t|}nd}t|d} | j |j |rz| j |t |t r|j d}|d}|jrt|jddd } | jj d} WdQRX|| d }n|d}| j ||jd d t||} | j | | j t|djdS) Nrz creating %srbwbmbcsrzlatin-1)encodings zr?r-r()r4rgrr5r5r6rb&s  z$bdist_wininst.get_installer_filenamec Cs t}|jrl|j|krl|jdkr&d}q|jdkr6d}q|jdkrFd}q|jdkrVd}q|jdkrfd }qd }n@yd d lm}Wntk rd }YnX|jd d }|d}tjjt }|j dkr|j dddkr|j dd}nd}tjj |d||f}t |d}z|j S|jXdS)Nz2.4z6.0z7.1z2.5z8.0z3.2z9.0z3.4z10.0z14.0r)CRT_ASSEMBLY_VERSION.z.0rEwinr9zwininst-%s%s.exer})rr,Zmsvcrtr ImportError partitionr=r>dirname__file__r(r?rrclose) r4Z cur_versionZbvrmajorZ directoryZsfixfilenamefr5r5r6r3s8         zbdist_wininst.get_exe_bytes)r Nr Pkeep the pseudo-installation tree around after creating the distribution archive)r rr6require a specific python version on the target system)rNr)rrr)rrr)rrr)rrr)rrr)rNr )r!Nr")r#Nr$)r%Nr&)N)__name__ __module__ __qualname__Z _unsupportedrorZ user_optionsZboolean_optionsr7rDr^r|r`rbrr5r5r5r6r sP&Q. 5 r )__doc__rTr=Zdistutils.corerZdistutils.utilrZdistutils.dir_utilrrZdistutils.errorsZdistutils.sysconfigrryrr r5r5r5r6s    __pycache__/install_egg_info.cpython-36.opt-1.pyc000064400000005627147210141470015657 0ustar003 \+ @sddZddlmZddlmZmZddlZddlZddlZGdddeZ ddZ d d Z d d Z dS) zdistutils.command.install_egg_info Implements the Distutils 'install_egg_info' command, for installing a package's PKG-INFO metadata.)Command)logdir_utilNc@s:eZdZdZdZdgZddZdd Zd d Zd d Z dS)install_egg_infoz)Install an .egg-info file for the packagez8Install package's PKG-INFO metadata as an .egg-info file install-dir=ddirectory to install tocCs d|_dS)N) install_dir)selfr (/usr/lib64/python3.6/install_egg_info.pyinitialize_optionssz#install_egg_info.initialize_optionscCsb|jdddtt|jjtt|jjftjdd}t j j |j ||_ |j g|_dS)NZ install_libr z%s-%s-py%d.%d.egg-info)r r )Zset_undefined_options to_filename safe_name distributionZget_name safe_versionZ get_versionsys version_infoospathjoinr targetoutputs)r basenamer r r finalize_optionss z!install_egg_info.finalize_optionsc Cs|j}tjj|r2tjj| r2tj||jdnNtjj|rX|j tj |jfd|n(tjj|j s|j tj |j fd|j t jd||jst|ddd}|jjj|WdQRXdS)N)dry_runz Removing z Creating z Writing %swzUTF-8)encoding)rrrisdirislinkrZ remove_treerexistsZexecuteunlinkr makedirsrinfoopenrZmetadataZwrite_pkg_file)r rfr r r run s   zinstall_egg_info.runcCs|jS)N)r)r r r r get_outputs.szinstall_egg_info.get_outputsN)rrr) __name__ __module__ __qualname____doc__ descriptionZ user_optionsr rr'r(r r r r r s rcCstjdd|S)zConvert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. z[^A-Za-z0-9.]+-)resub)namer r r r6srcCs|jdd}tjdd|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.  .z[^A-Za-z0-9.]+r.)replacer/r0)versionr r r r>s rcCs |jddS)z|Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'. r._)r4)r1r r r rHsr) r,Z distutils.cmdrZ distutilsrrrrr/rrrrr r r r s + __pycache__/alias.cpython-36.opt-1.pyc000064400000004465147210141470013444 0ustar003 K]z @sPddlmZddlmZddlmZmZmZddZGdddeZ dd Z d S) )DistutilsOptionError)map) edit_config option_base config_filecCs8xdD]}||krt|SqW|j|gkr4t|S|S)z4Quote an argument for later parsing by shlex.split()"'\#)rrr r )reprsplit)argcr/usr/lib/python3.6/alias.pyshquotes   rc@sHeZdZdZdZdZdgejZejdgZddZ d d Z d d Z d S)aliasz3Define a shortcut that invokes one or more commandsz0define a shortcut to invoke one or more commandsTremoverremove (unset) the aliascCstj|d|_d|_dS)N)rinitialize_optionsargsr)selfrrrrs zalias.initialize_optionscCs*tj||jr&t|jdkr&tddS)NzFMust specify exactly one argument (the alias name) when using --remove)rfinalize_optionsrlenrr)rrrrr#s zalias.finalize_optionscCs|jjd}|jsDtdtdx|D]}tdt||q(WdSt|jdkr|j\}|jrfd}q||krtdt||dStd|dSn$|jd}djtt |jdd}t |j d||ii|j dS) NaliaseszCommand Aliasesz---------------zsetup.py aliasrz No alias definition found for %rr ) Z distributionZget_option_dictrprint format_aliasrrjoinrrrfilenameZdry_run)rrrcommandrrrrun+s&    z alias.runN)rrr) __name__ __module__ __qualname____doc__ descriptionZcommand_consumes_argumentsrZ user_optionsZboolean_optionsrrr#rrrrrs rcCsZ||\}}|tdkrd}n,|tdkr0d}n|tdkrBd}nd|}||d|S) Nglobalz--global-config userz--user-config Zlocalz --filename=%rr)r)namersourcer"rrrrFs    rN) Zdistutils.errorsrZsetuptools.extern.six.movesrZsetuptools.command.setoptrrrrrrrrrrs   4__pycache__/alias.cpython-36.pyc000064400000004465147210141470012505 0ustar003 K]z @sPddlmZddlmZddlmZmZmZddZGdddeZ dd Z d S) )DistutilsOptionError)map) edit_config option_base config_filecCs8xdD]}||krt|SqW|j|gkr4t|S|S)z4Quote an argument for later parsing by shlex.split()"'\#)rrr r )reprsplit)argcr/usr/lib/python3.6/alias.pyshquotes   rc@sHeZdZdZdZdZdgejZejdgZddZ d d Z d d Z d S)aliasz3Define a shortcut that invokes one or more commandsz0define a shortcut to invoke one or more commandsTremoverremove (unset) the aliascCstj|d|_d|_dS)N)rinitialize_optionsargsr)selfrrrrs zalias.initialize_optionscCs*tj||jr&t|jdkr&tddS)NzFMust specify exactly one argument (the alias name) when using --remove)rfinalize_optionsrlenrr)rrrrr#s zalias.finalize_optionscCs|jjd}|jsDtdtdx|D]}tdt||q(WdSt|jdkr|j\}|jrfd}q||krtdt||dStd|dSn$|jd}djtt |jdd}t |j d||ii|j dS) NaliaseszCommand Aliasesz---------------zsetup.py aliasrz No alias definition found for %rr ) Z distributionZget_option_dictrprint format_aliasrrjoinrrrfilenameZdry_run)rrrcommandrrrrun+s&    z alias.runN)rrr) __name__ __module__ __qualname____doc__ descriptionZcommand_consumes_argumentsrZ user_optionsZboolean_optionsrrr#rrrrrs rcCsZ||\}}|tdkrd}n,|tdkr0d}n|tdkrBd}nd|}||d|S) Nglobalz--global-config userz--user-config Zlocalz --filename=%rr)r)namersourcer"rrrrFs    rN) Zdistutils.errorsrZsetuptools.extern.six.movesrZsetuptools.command.setoptrrrrrrrrrrs   4__pycache__/py36compat.cpython-36.pyc000064400000010703147210141470013411 0ustar003 K]z@sdddlZddlmZddlmZddlmZddlmZGdddZe ejdr`Gd ddZdS) N)glob) convert_path)sdist)filterc@s\eZdZdZddZeddZddZdd Zd d Z d d Z ddZ ddZ ddZ dS)sdist_add_defaultsz Mix-in providing forward-compatibility for functionality as found in distutils on Python 3.7. Do not edit the code in this class except to update functionality as implemented in distutils. Instead, override in the subclass. cCs<|j|j|j|j|j|j|jdS)a9Add 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_scripts)selfr /usr/lib/python3.6/py36compat.py add_defaultsszsdist_add_defaults.add_defaultscCs:tjj|sdStjj|}tjj|\}}|tj|kS)z Case-sensitive path existence check >>> sdist_add_defaults._cs_path_exists(__file__) True >>> sdist_add_defaults._cs_path_exists(__file__.upper()) False F)ospathexistsabspathsplitlistdir)fspathrZ directoryfilenamerrr_cs_path_exists(s  z"sdist_add_defaults._cs_path_existscCs|j|jjg}x|D]}t|trn|}d}x(|D] }|j|r0d}|jj|Pq0W|s|jddj |q|j|r|jj|q|jd|qWdS)NFTz,standard file not found: should have one of z, zstandard file '%s' not found) ZREADMES distributionZ script_name isinstancetuplerfilelistappendwarnjoin)rZ standardsfnZaltsZgot_itrrrr9s       z*sdist_add_defaults._add_defaults_standardscCs8ddg}x*|D]"}ttjjt|}|jj|qWdS)Nz test/test*.pyz setup.cfg)rrrisfilerrextend)rZoptionalpatternfilesrrrrNs z)sdist_add_defaults._add_defaults_optionalcCsd|jd}|jjr$|jj|jx:|jD]0\}}}}x"|D]}|jjtj j ||q>Wq,WdS)Nbuild_py) get_finalized_commandrZhas_pure_modulesrr$get_source_files data_filesrrrr!)rr'ZpkgZsrc_dirZ build_dir filenamesrrrrr Ts    z'sdist_add_defaults._add_defaults_pythoncCs|jjr~xr|jjD]f}t|trDt|}tjj|rz|j j |q|\}}x,|D]$}t|}tjj|rR|j j |qRWqWdS)N) rZhas_data_filesr*rstrrrrr#rr)ritemdirnamer+frrrr ds     z+sdist_add_defaults._add_defaults_data_filescCs(|jjr$|jd}|jj|jdS)N build_ext)rZhas_ext_modulesr(rr$r))rr0rrrr us  z$sdist_add_defaults._add_defaults_extcCs(|jjr$|jd}|jj|jdS)N build_clib)rZhas_c_librariesr(rr$r))rr1rrrr zs  z'sdist_add_defaults._add_defaults_c_libscCs(|jjr$|jd}|jj|jdS)N build_scripts)rZ has_scriptsr(rr$r))rr2rrrr s  z(sdist_add_defaults._add_defaults_scriptsN)__name__ __module__ __qualname____doc__r staticmethodrrrr r r r r rrrrr s rrc@s eZdZdS)rN)r3r4r5rrrrrs) rrZdistutils.utilrZdistutils.commandrZsetuptools.extern.six.movesrrhasattrrrrrs    | __pycache__/upload_docs.cpython-36.opt-1.pyc000064400000013560147210141470014643 0ustar003 K]@sdZddlmZddlmZddlmZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZmZddlmZd d lmZd d ZGd ddeZdS)zpupload_docs Implements a Distutils 'upload_docs' subcommand (upload documentation to PyPI's pythonhosted.org). )standard_b64encode)log)DistutilsOptionErrorN)six) http_clienturllib)iter_entry_points)uploadcCstjr dnd}|jd|S)Nsurrogateescapestrictzutf-8)rPY3encode)serrorsr!/usr/lib/python3.6/upload_docs.py_encodesrc@seZdZdZdZdddejfddgZejZd d Zd efgZ ddZ ddZ ddZ ddZ eddZeddZddZdS) upload_docszhttps://pypi.python.org/pypi/zUpload documentation to PyPIz repository=rzurl of repository [default: %s] show-responseN&display full response text from server upload-dir=directory to uploadcCs$|jdkr xtddD]}dSWdS)Nzdistutils.commands build_sphinxT) upload_dirr)selfZeprrr has_sphinx/s zupload_docs.has_sphinxrcCstj|d|_d|_dS)N)r initialize_optionsr target_dir)rrrrr6s zupload_docs.initialize_optionscCstj||jdkrN|jr0|jd}|j|_q`|jd}tjj |j d|_n|j d|j|_d|j krtt jd|jd|jdS)NrbuildZdocsrzpypi.python.orgz3Upload_docs command is deprecated. Use RTD instead.zUsing upload directory %s)r finalize_optionsrrZget_finalized_commandZbuilder_target_dirrospathjoinZ build_baseZensure_dirname repositoryrwarnannounce)rrr rrrr!;s        zupload_docs.finalize_optionsc Cstj|d}z|j|jxtj|jD]~\}}}||jkrT| rTd}t||jxP|D]H}tjj||}|t |jdj tjj } tjj| |} |j || qZWq(WWd|j XdS)Nwz'no files found in upload directory '%s')zipfileZZipFileZmkpathrr"walkrr#r$lenlstripsepwriteclose) rfilenamezip_filerootdirsfilesZtmplnameZfullZrelativedestrrrcreate_zipfileKs   zupload_docs.create_zipfilec Cslx|jD]}|j|q Wtj}|jjj}tjj |d|}z|j ||j |Wdt j |XdS)Nz%s.zip)Zget_sub_commandsZ run_commandtempfileZmkdtemp distributionmetadataget_namer"r#r$r7 upload_fileshutilZrmtree)rZcmd_nameZtmp_dirr5r1rrrrun[s  zupload_docs.runccs|\}}d|}t|ts |g}xn|D]f}t|trN|d|d7}|d}nt|}|Vt|VdV|V|r&|dddkr&dVq&WdS) Nz* Content-Disposition: form-data; name="%s"z; filename="%s"rr s   ) isinstancelisttupler)item sep_boundarykeyvaluestitlevaluerrr _build_partis     zupload_docs._build_partc Csnd}d|}|d}|df}tj|j|d}t||j}tjj|}tj||} d|jd} dj | | fS) z= Build up the MIME payload for the POST data s3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s --s--r@)rFz multipart/form-data; boundary=%sascii) functoolspartialrKmapitems itertoolschain from_iterabledecoder$) clsdataboundaryrFZ end_boundaryZ end_itemsZbuilderZ part_groupspartsZ body_items content_typerrr_build_multipart}s  zupload_docs._build_multipartcCs:t|d}|j}WdQRX|jj}d|jtjj||fd}t|j d|j }t |}t j rn|jd}d|}|j|\}} d|j} |j| tjtjj|j\} } } }}}| dkrtj| }n | d krtj| }n td | d }yZ|j|jd | | }|jd ||jdtt||jd||j |j!|Wn6t"j#k r~}z|jt|tj$dSd}~XnX|j%}|j&dkrd|j&|j'f} |j| tjnb|j&dkr|j(d}|dkrd|j}d|} |j| tjnd|j&|j'f} |j| tj$|j)r6t*dd|jdddS)NrbZ doc_upload)z:actionr5content:rLzBasic zSubmitting documentation to %sZhttpZhttpszunsupported schema ZPOSTz Content-typezContent-lengthZ AuthorizationzServer response (%s): %si-ZLocationzhttps://pythonhosted.org/%s/zUpload successful. Visit %szUpload failed (%s): %s-K)+openreadr9r:r;r"r#basenamerZusernameZpasswordrrr rUr[r%r'rINFOrparseZurlparserZHTTPConnectionZHTTPSConnectionAssertionErrorZconnectZ putrequestZ putheaderstrr+Z endheaderssendsocketerrorZERRORZ getresponseZstatusreasonZ getheaderZ show_responseprint)rr0fr]metarWZ credentialsZauthZbodyZctmsgZschemaZnetlocZurlZparamsZqueryZ fragmentsZconnrZerlocationrrrr<s^              zupload_docs.upload_file)rNr)rNr)__name__ __module__ __qualname__ZDEFAULT_REPOSITORY descriptionr Z user_optionsZboolean_optionsrZ sub_commandsrr!r7r> staticmethodrK classmethodr[r<rrrrrs"    r)__doc__base64rZ distutilsrZdistutils.errorsrr"rkr)r8r=rRrNZsetuptools.externrZsetuptools.extern.six.movesrrZ pkg_resourcesrr rrrrrrs       __pycache__/build_clib.cpython-36.pyc000064400000011531147210141470013474 0ustar003 \V@sTdZddlZddlmZddlTddlmZddlmZddZ Gd d d eZ dS) 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)logcCsddlm}|dS)Nr)show_compilers)distutils.ccompilerr)rr"/usr/lib64/python3.6/build_clib.pyrs rc@sleZdZdZd"d#d$d%d&gZdd gZdddefgZddZddZ ddZ ddZ ddZ ddZ d d!ZdS)' build_clibz/build C/C++ libraries used by Python extensions build-clib=b%directory to build C/C++ libraries to build-temp=t,directory to put temporary build by-productsdebugg"compile with debugging informationforcef2forcibly build everything (ignore file timestamps) compiler=cspecify the compiler typez help-compilerNzlist available compilerscCs:d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) r build_temp libraries include_dirsdefineundefrrcompiler)selfrrr initialize_options4szbuild_clib.initialize_optionscCsh|jdddd d d |jj|_|jr0|j|j|jdkrH|jjpDg|_t|jtrd|jjtj |_dS) NZbuildrr rrr)rr )rr)rr)rr)rr) Zset_undefined_optionsZ distributionrcheck_library_listr isinstancestrsplitospathsep)r rrr finalize_optionsDs    zbuild_clib.finalize_optionscCs|js dSddlm}||j|j|jd|_t|j|jdk rN|jj|j|j dk rzx |j D]\}}|jj ||q`W|j dk rx|j D]}|jj |qW|j |jdS)Nr) new_compiler)rdry_runr)rrr)rr*rrrZset_include_dirsrZ define_macrorZundefine_macrobuild_libraries)r r)namevalueZmacrorrr run^s        zbuild_clib.runcCst|tstdx|D]|}t|t rs    __pycache__/egg_info.cpython-36.pyc000064400000050633147210141470013167 0ustar003 K]`@sdZddlmZddlmZddlmZddlm Z ddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'j(Z(ddl)m*Z*ddlm+Z+ddZ,GdddeZ-GdddeZGdddeZ.ddZ/ddZ0ddZ1dd Z2d!d"Z3d#d$Z4d%d&Z5d'd(Z6d0d*d+Z7d,d-Z8d.d/Z9dS)1zUsetuptools.command.egg_info Create a distribution's .egg-info directory and contents)FileList)DistutilsInternalError) convert_path)logN)six)map)Command)sdist) walk_revctrl) edit_config) bdist_egg)parse_requirements safe_name parse_version safe_version yield_lines EntryPointiter_entry_points to_filename)glob) packagingcCsd}|jtjj}tjtj}d|f}xt|D]\}}|t|dk}|dkrv|rd|d7}q4|d||f7}q4d}t|} x:|| kr||} | dkr||d7}n| d kr||7}n| d kr|d} | | kr|| d kr| d} | | kr|| d kr| d} x&| | kr6|| d kr6| d} qW| | krR|tj| 7}nR||d| } d} | dd krd } | dd} | tj| 7} |d| f7}| }n|tj| 7}|d7}qW|s4||7}q4W|d7}tj|tj tj BdS)z Translate a file path glob like '*.txt' in to a regular expression. This differs from fnmatch.translate which allows wildcards to match directory separators. It also knows about '**/' which matches any number of directories. z[^%s]z**z.*z (?:%s+%s)*r*?[!]^Nz[%s]z\Z)flags) splitospathsepreescape enumeratelencompile MULTILINEDOTALL)rZpatZchunksr#Z valid_charcchunkZ last_chunkiZ chunk_lencharZinner_iinnerZ char_classr0/usr/lib/python3.6/egg_info.pytranslate_pattern$sV         r2c@seZdZdZd)d*d+d,gZdgZd diZddZeddZ e j ddZ ddZ ddZ d-ddZ ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(S).egg_infoz+create a distribution's .egg-info directory egg-base=eLdirectory containing .egg-info directories (default: top of the source tree)tag-dated0Add date stamp (e.g. 20050528) to version number tag-build=b-Specify explicit tag to add to version numberno-dateD"Don't include date stamp [default]cCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)NrF)egg_name egg_versionegg_baser3 tag_buildtag_datebroken_egg_infovtags)selfr0r0r1initialize_optionsszegg_info.initialize_optionscCsdS)Nr0)rGr0r0r1tag_svn_revisionszegg_info.tag_svn_revisioncCsdS)Nr0)rGvaluer0r0r1rIscCs0tj}|j|d<d|d<t|t|ddS)z Materialize the value of date into the build tag. Install build keys in a deterministic order to avoid arbitrary reordering on subsequent builds. rCrrD)r3N) collections OrderedDicttagsr dict)rGfilenamer3r0r0r1save_version_infos zegg_info.save_version_infoc CsVt|jj|_|j|_|j|_t|j}y6t |t j j }|rFdnd}t t||j|jfWn,tk rtjjd|j|jfYnX|jdkr|jj}|pijdtj|_|jdt|jd|_|jtjkrtjj|j|j|_d|jkr|j|j|jj_ |jj}|dk rR|j |jj!krR|j|_"t|j|_#d|j_dS)Nz%s==%sz%s===%sz2Invalid distribution name or version syntax: %s-%srrBz .egg-info-)$r distributionZget_namer@rMrFtagged_versionrAr isinstancerversionZVersionlistr ValueError distutilserrorsZDistutilsOptionErrorrBZ package_dirgetr!curdirZensure_dirnamerr3r"joincheck_broken_egg_infometadataZ _patched_distkeylowerZ_versionZ_parsed_version)rGZparsed_versionZ is_versionspecdirsZpdr0r0r1finalize_optionss8          zegg_info.finalize_optionsFcCsN|r|j|||n6tjj|rJ|dkr@| r@tjd||dS|j|dS)aWrite `data` to `filename` or delete if empty If `data` is non-empty, this routine is the same as ``write_file()``. If `data` is empty but not ``None``, this is the same as calling ``delete_file(filename)`. If `data` is ``None``, then this is a no-op unless `filename` exists, in which case a warning is issued about the orphaned file (if `force` is false), or deleted (if `force` is true). Nz$%s not set in setup(), but %s exists) write_filer!r"existsrwarn delete_file)rGwhatrOdataforcer0r0r1write_or_delete_files   zegg_info.write_or_delete_filecCsDtjd||tjr|jd}|js@t|d}|j||jdS)zWrite `data` to `filename` (if not a dry run) after announcing it `what` is used in a log message to identify what is being written to the file. zwriting %s to %szutf-8wbN) rinforZPY3encodedry_runopenwriteclose)rGrhrOrifr0r0r1rds   zegg_info.write_filecCs tjd||jstj|dS)z8Delete `filename` (if not a dry run) after announcing itz deleting %sN)rrmror!unlink)rGrOr0r0r1rgs zegg_info.delete_filecCs2|jj}|jr$|j|jr$t|St||jS)N)rRZ get_versionrFendswithr)rGrUr0r0r1rSs zegg_info.tagged_versioncCs|j|j|jj}x@tdD]4}|j|d|j}|||jtj j |j|jqWtj j |jd}tj j |r||j ||j dS)Nzegg_info.writers) installerznative_libs.txt)Zmkpathr3rRZfetch_build_eggrZrequireZresolvenamer!r"r\rerg find_sources)rGrvepwriternlr0r0r1run s     z egg_info.runcCs,d}|jr||j7}|jr(|tjd7}|S)Nrz-%Y%m%d)rCrDtimeZstrftime)rGrUr0r0r1rMs  z egg_info.tagscCs4tjj|jd}t|j}||_|j|j|_dS)z"Generate SOURCES.txt manifest filez SOURCES.txtN) r!r"r\r3manifest_makerrRmanifestr|filelist)rGZmanifest_filenameZmmr0r0r1rx s  zegg_info.find_sourcescCsd|jd}|jtjkr&tjj|j|}tjj|r`tjddddd||j |j |_ ||_ dS)Nz .egg-inforQNz Note: Your current .egg-info directory has a '-' in its name; this will not work correctly with "setup.py develop". Please rename %s to %s to correct this problem. ) r@rBr!r[r"r\rerrfr3rE)rGZbeir0r0r1r](s    zegg_info.check_broken_egg_infoN)r4r5r6)r7r8r9)r:r;r<)r=r>r?)F)__name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsZ negative_optrHpropertyrIsetterrPrcrkrdrgrSr|rMrxr]r0r0r0r1r3ws(  / r3c@s|eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)rcCs<|j|\}}}}|dkrV|jddj|x"|D]}|j|s4tjd|q4Wn|dkr|jddj|x"|D]}|j|sxtjd|qxWn|dkr|jd dj|x"|D]}|j|stjd |qWnZ|d kr(|jd dj|x&|D]}|j|stjd |qWn|dkrx|jd|dj|fx|D]"}|j ||sPtjd||qPWn|dkr|jd|dj|fx|D]"}|j ||stjd||qWnp|dkr|jd||j |s8tjd|n>|dkr,|jd||j |s8tjd|n t d|dS)Nincludezinclude  z%warning: no files found matching '%s'excludezexclude z9warning: no previously-included files found matching '%s'zglobal-includezglobal-include z>warning: no files found matching '%s' anywhere in distributionzglobal-excludezglobal-exclude zRwarning: no previously-included files matching '%s' found anywhere in distributionzrecursive-includezrecursive-include %s %sz:warning: no files found matching '%s' under directory '%s'zrecursive-excludezrecursive-exclude %s %szNwarning: no previously-included files matching '%s' found under directory '%s'graftzgraft z+warning: no directories found matching '%s'prunezprune z6no previously-included directories found matching '%s'z'this cannot happen: invalid action '%s')Z_parse_template_line debug_printr\rrrfrglobal_includeglobal_excluderecursive_includerecursive_excluderrr)rGlineactionZpatternsdirZ dir_patternpatternr0r0r1process_template_line;sd                 zFileList.process_template_linecCsVd}xLtt|jdddD]2}||j|r|jd|j||j|=d}qW|S)z Remove all files from the file list that match the predicate. Return True if any matching files were removed Frz removing Tr)ranger'filesr)rGZ predicatefoundr-r0r0r1 _remove_filesszFileList._remove_filescCs$ddt|D}|j|t|S)z#Include files that match 'pattern'.cSsg|]}tjj|s|qSr0)r!r"isdir).0rsr0r0r1 sz$FileList.include..)rextendbool)rGrrr0r0r1rs zFileList.includecCst|}|j|jS)z#Exclude files that match 'pattern'.)r2rmatch)rGrrr0r0r1rszFileList.excludecCs8tjj|d|}ddt|ddD}|j|t|S)zN Include all files anywhere in 'dir/' that match the pattern. z**cSsg|]}tjj|s|qSr0)r!r"r)rrsr0r0r1rsz.FileList.recursive_include..T) recursive)r!r"r\rrr)rGrrZ full_patternrr0r0r1rs zFileList.recursive_includecCs ttjj|d|}|j|jS)zM Exclude any file anywhere in 'dir/' that match the pattern. z**)r2r!r"r\rr)rGrrrr0r0r1rszFileList.recursive_excludecCs$ddt|D}|j|t|S)zInclude all files from 'dir/'.cSs"g|]}tjj|D]}|qqSr0)rXrfindall)rZ match_diritemr0r0r1rsz"FileList.graft..)rrr)rGrrr0r0r1rs  zFileList.graftcCsttjj|d}|j|jS)zFilter out files from 'dir/'.z**)r2r!r"r\rr)rGrrr0r0r1rszFileList.prunecsJ|jdkr|jttjjd|fdd|jD}|j|t|S)z Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees. Nz**csg|]}j|r|qSr0)r)rrs)rr0r1rsz+FileList.global_include..)Zallfilesrr2r!r"r\rr)rGrrr0)rr1rs   zFileList.global_includecCsttjjd|}|j|jS)zD Exclude all files anywhere that match the pattern. z**)r2r!r"r\rr)rGrrr0r0r1rszFileList.global_excludecCs8|jdr|dd}t|}|j|r4|jj|dS)N rr)rur _safe_pathrappend)rGrr"r0r0r1rs    zFileList.appendcCs|jjt|j|dS)N)rrfilterr)rGpathsr0r0r1rszFileList.extendcCstt|j|j|_dS)z Replace self.files with only safe paths Because some owners of FileList manipulate the underlying ``files`` attribute directly, this method must be called to repair those paths. N)rVrrr)rGr0r0r1_repairszFileList._repairc Csd}tj|}|dkr(tjd|dStj|d}|dkrNtj||ddSy tjj|shtjj|rldSWn&tk rtj||t j YnXdS)Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFzutf-8T) unicode_utilsfilesys_decoderrfZ try_encoder!r"reUnicodeEncodeErrorsysgetfilesystemencoding)rGr"Zenc_warnZu_pathZ utf8_pathr0r0r1rs  zFileList._safe_pathN)rrrrrrrrrrrrrrrrrr0r0r0r1r8sI     rc@s\eZdZdZddZddZddZdd Zd d Zd d Z e ddZ ddZ ddZ dS)r~z MANIFEST.incCsd|_d|_d|_d|_dS)Nr)Z use_defaultsrZ manifest_onlyZforce_manifest)rGr0r0r1rHsz!manifest_maker.initialize_optionscCsdS)Nr0)rGr0r0r1rcszmanifest_maker.finalize_optionscCsdt|_tjj|js|j|jtjj|jr<|j |j |jj |jj |jdS)N) rrr!r"rerwrite_manifest add_defaultstemplateZ read_templateprune_file_listsortZremove_duplicates)rGr0r0r1r|s  zmanifest_maker.runcCstj|}|jtjdS)N/)rrreplacer!r#)rGr"r0r0r1_manifest_normalizes z"manifest_maker._manifest_normalizecsBjjfddjjD}dj}jtj|f|dS)zo Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. csg|]}j|qSr0)r)rrs)rGr0r1r sz1manifest_maker.write_manifest..zwriting manifest file '%s'N)rrrrZexecuterd)rGrmsgr0)rGr1rs  zmanifest_maker.write_manifestcCs|j|stj||dS)N)_should_suppress_warningr rf)rGrr0r0r1rf$s zmanifest_maker.warncCs tjd|S)z; suppress missing-file warnings from sdist zstandard file .*not found)r$r)rr0r0r1r(sz'manifest_maker._should_suppress_warningcCsttj||jj|j|jj|jtt}|rB|jj|nt j j |jrX|j |j d}|jj|jdS)Nr3)r rrrrrrVr rr!r"reZ read_manifestget_finalized_commandrr3)rGZrcfilesZei_cmdr0r0r1r/s   zmanifest_maker.add_defaultscCsZ|jd}|jj}|jj|j|jj|tjtj }|jj d|d|dddS)Nbuildz(^|z)(RCS|CVS|\.svn)r)Zis_regex) rrRZ get_fullnamerrZ build_baser$r%r!r#Zexclude_pattern)rGrZbase_dirr#r0r0r1r;s    zmanifest_maker.prune_file_listN)rrrrrHrcr|rrrf staticmethodrrrr0r0r0r1r~s    r~c Cs8dj|}|jd}t|d}|j|WdQRXdS)z{Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it.  zutf-8rlN)r\rnrprq)rOcontentsrsr0r0r1rdEs   rdc Cs|tjd||jsx|jj}|j|j|_}|j|j|_}z|j |j Wd|||_|_Xt |jdd}t j |j |dS)Nz writing %sZzip_safe)rrmrorRr^rArUr@rwwrite_pkg_infor3getattrr Zwrite_safety_flag)cmdbasenamerOr^ZoldverZoldnameZsafer0r0r1rRs rcCstjj|rtjddS)NzsWARNING: 'depends.txt' is not used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.)r!r"rerrf)rrrOr0r0r1warn_depends_obsoletees rcCs,t|pf}dd}t||}|j|dS)NcSs|dS)Nrr0)rr0r0r1osz%_write_requirements..)rr writelines)streamZreqslinesZ append_crr0r0r1_write_requirementsms  rcCsn|j}tj}t||j|jp"i}x2t|D]&}|jdjft t|||q.W|j d||j dS)Nz [{extra}] Z requirements) rRrStringIOrZinstall_requiresextras_requiresortedrqformatvarsrkgetvalue)rrrOZdistrirZextrar0r0r1write_requirementsts  rcCs,tj}t||jj|jd||jdS)Nzsetup-requirements)iorrrRZsetup_requiresrkr)rrrOrir0r0r1write_setup_requirementssrcCs:tjdd|jjD}|jd|djt|ddS)NcSsg|]}|jdddqS).rr)r )rkr0r0r1rsz(write_toplevel_names..ztop-level namesr)rNfromkeysrRZiter_distribution_namesrdr\r)rrrOZpkgsr0r0r1write_toplevel_namessrcCst|||ddS)NT) write_arg)rrrOr0r0r1 overwrite_argsrFcCsHtjj|d}t|j|d}|dk r4dj|d}|j||||dS)Nrr)r!r"splitextrrRr\rk)rrrOrjZargnamerJr0r0r1rs rcCs|jj}t|tjs|dkr"|}nr|dk rg}xZt|jD]J\}}t|tjsttj||}dj tt t |j }|j d||fqsR           (   SBEI    __pycache__/develop.cpython-36.pyc000064400000014316147210141470013046 0ustar003 K]n@sddlmZddlmZddlmZmZddlZddlZddl Z ddl m Z ddl m Z mZmZddlmZddlmZddlZGd d d ejeZGd d d eZdS) ) convert_path)log)DistutilsErrorDistutilsOptionErrorN)six) Distribution PathMetadatanormalize_path) easy_install) namespacesc@sveZdZdZdZejddgZejdgZd Zd d Z d d Z ddZ e ddZ ddZddZddZddZdS)developzSet up package for developmentz%install package in 'development mode' uninstalluUninstall this source package egg-path=N-Set the path to be used in the .egg-link fileFcCs2|jrd|_|j|jn|j|jdS)NT)r Z multi_versionuninstall_linkZuninstall_namespacesinstall_for_developmentZwarn_deprecated_options)selfr/usr/lib/python3.6/develop.pyruns  z develop.runcCs&d|_d|_tj|d|_d|_dS)N.)r egg_pathr initialize_options setup_pathZalways_copy_from)rrrrr's  zdevelop.initialize_optionscCs|jd}|jr,d}|j|jf}t|||jg|_tj||j|j |j j t j d|jd}t jj|j||_|j|_|jdkrt jj|j|_t|j}tt jj|j|j}||krtd|t|t|t jj|j|jd|_|j|j|j|j|_dS)Negg_infoz-Please rename %r to %r before using 'develop'z*.eggz .egg-linkzA--egg-path must be a relative path from the install directory to ) project_name)get_finalized_commandZbroken_egg_inforrZegg_nameargsr finalize_optionsZexpand_basedirsZ expand_dirsZ package_indexscanglobospathjoin install_diregg_linkegg_baserabspathr rrrdist_resolve_setup_pathr)rZeitemplaterZ egg_link_fntargetrrrrr .s<           zdevelop.finalize_optionscCsh|jtjdjd}|tjkr0d|jdd}ttjj|||}|ttjkrdt d|ttj|S)z Generate a path from egg_base back to '.' where the setup script resides and ensure that path points to the setup path from $install_dir/$egg_path. /z../zGCan't get a consistent path to setup script from installation directory) replacer#seprstripcurdircountr r$r%r)r(r&rZ path_to_setupZresolvedrrrr+Xs zdevelop._resolve_setup_pathc CsDtjrt|jddr|jddd|jd|jd}t|j}|jd|d|jd|jddd|jd|jd}||_ ||j _ t ||j |j _n"|jd|jdd d|jd|jtjr|jtjdt_|jtjd |j|j|js,t|jd }|j|j d |jWdQRX|jd|j |j dS) NZuse_2to3FZbuild_pyr)Zinplacer)r(Z build_extr/zCreating %s (link to %s)w )rZPY3getattr distributionZreinitialize_commandZ run_commandrr Z build_librr*locationrrZ _providerZinstall_site_py setuptoolsZbootstrap_install_fromr Zinstall_namespacesrinfor'r(dry_runopenwriterZprocess_distributionZno_deps)rZbpy_cmdZ build_pathZei_cmdfrrrrks4          zdevelop.install_for_developmentcCstjj|jrztjd|j|jt|j}dd|D}|j||j g|j |j gfkrhtj d|dS|j sztj |j|j s|j|j|jjrtj ddS)NzRemoving %s (link to %s)cSsg|] }|jqSr)r2).0linerrr sz*develop.uninstall_link..z$Link points to %s: uninstall abortedz5Note: you must uninstall or replace scripts manually!)r#r$existsr'rr;r(r=closerrwarnr<unlinkZ update_pthr*r8scripts)rZ egg_link_filecontentsrrrrs    zdevelop.uninstall_linkc Cs||jk rtj||S|j|x^|jjp,gD]N}tjjt |}tjj |}t j |}|j }WdQRX|j||||q.WdS)N)r*r install_egg_scriptsinstall_wrapper_scriptsr8rGr#r$r)rbasenameior=readZinstall_script)rr*Z script_nameZ script_pathZstrmZ script_textrrrrIs     zdevelop.install_egg_scriptscCst|}tj||S)N)VersionlessRequirementr rJ)rr*rrrrJszdevelop.install_wrapper_scripts)r rr)rNr)__name__ __module__ __qualname____doc__ descriptionr Z user_optionsZboolean_optionsZcommand_consumes_argumentsrrr staticmethodr+rrrIrJrrrrr s  * /r c@s(eZdZdZddZddZddZdS) rNaz Adapt a pkg_resources.Distribution to simply return the project name as the 'requirement' so that scripts will work across multiple versions. >>> dist = Distribution(project_name='foo', version='1.0') >>> str(dist.as_requirement()) 'foo==1.0' >>> adapted_dist = VersionlessRequirement(dist) >>> str(adapted_dist.as_requirement()) 'foo' cCs ||_dS)N)_VersionlessRequirement__dist)rr*rrr__init__szVersionlessRequirement.__init__cCs t|j|S)N)r7rU)rnamerrr __getattr__sz"VersionlessRequirement.__getattr__cCs|jS)N)r)rrrras_requirementsz%VersionlessRequirement.as_requirementN)rOrPrQrRrVrXrYrrrrrNs rN)Zdistutils.utilrZ distutilsrZdistutils.errorsrrr#r"rLZsetuptools.externrZ pkg_resourcesrrr Zsetuptools.command.easy_installr r:r ZDevelopInstallerr objectrNrrrrs     4__pycache__/build_py.cpython-36.pyc000064400000024404147210141470013216 0ustar003 \ C@s~dZddlZddlZddlZddlmZddlmZddlTddl m Z m Z ddl m Z Gdd d eZGd d d ee ZdS) zHdistutils.command.build_py Implements the Distutils 'build_py' command.N)glob)Command)*) convert_path Mixin2to3)logc@seZdZdZd8d9d:d;dbuild_pyz5"build" pure Python modules (copy to build directory) build-lib=ddirectory to "build" (copy) tocompileccompile .py to .pyc no-compileN!don't compile .py files [default] optimize=Olalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]forcef2forcibly build everything (ignore file timestamps)cCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) build_lib py_modulespackage package_data package_dirr optimizer)selfr /usr/lib64/python3.6/build_py.pyinitialize_options szbuild_py.initialize_optionsc Cs|jddd|jj|_|jj|_|jj|_i|_|jjrbx&|jjjD]\}}t||j|<qHW|j|_ t |j t sy.t |j |_ d|j kodknst Wn tt fk rtdYnXdS) NZbuildrrrzoptimize must be 0, 1, or 2)rr)rr)Zset_undefined_options distributionpackagesrrritemsrget_data_files data_files isinstancerintAssertionError ValueErrorZDistutilsOptionError)rnamepathrrrfinalize_options*s"      "zbuild_py.finalize_optionscCs:|jr|j|jr$|j|j|j|jdddS)Nr)include_bytecode)r build_modulesr#build_packagesbuild_package_data byte_compile get_outputs)rrrrrunCs z build_py.runcsg}|js|Sxr|jD]h}|j|}tjj|jg|jd}d|rRt|dfdd|j||D}|j ||||fqW|S)z?Generate list of '(package,src_dir,build_dir,filenames)' tuples.rcsg|]}|dqS)Nr).0file)plenrr tsz+build_py.get_data_files..) r#get_package_dirosr,joinrsplitlenfind_data_filesappend)rdatarsrc_dir build_dir filenamesr)r9rr%as   zbuild_py.get_data_filescs`|jjdg|jj|g}gx:|D]2}ttjj|t|}jfdd|Dq&WS)z6Return filenames for package's data files in 'src_dir'cs$g|]}|krtjj|r|qSr)r<r,isfile)r7fn)filesrrr:s z,build_py.find_data_files..)rgetrr<r,r=rextend)rrrCZglobspatternZfilelistr)rIrr@ys  zbuild_py.find_data_filescCshd}x^|jD]T\}}}}xF|D]>}tjj||}|jtjj||jtjj|||ddqWq WdS)z$Copy data files into build directoryNF) preserve_mode)r&r<r,r=mkpathdirname copy_file)rZlastdirrrCrDrEfilenametargetrrrr1s zbuild_py.build_package_datac Cs|jd}|js&|r tjj|SdSng}x|ry|jdj|}Wn*tk rn|jd|d|d=Yq,X|jd|tjj|Sq,W|jjd}|dk r|jd||rtjj|SdSdS)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).r5rFrr6NrS)r>rr<r,r=KeyErrorinsertrJ)rrr,tailZpdirrrrr;s(       zbuild_py.get_package_dircCsj|dkr8tjj|s td|tjj|s8td||rftjj|d}tjj|rZ|Stjd|dS)NrFz%package directory '%s' does not existz>supposed package directory '%s' exists, but is not a directoryz __init__.pyz!package init file '%s' not found z(or not a regular file)z8package init file '%s' not found (or not a regular file)) r<r,existsZDistutilsFileErrorisdirr=rGrwarn)rrrinit_pyrrr check_packages    zbuild_py.check_packagecCs&tjj|stjd||dSdSdS)Nz!file %s (for module %s) not foundFT)r<r,rGrrY)rmodule module_filerrr check_modules zbuild_py.check_modulec Cs|j||ttjj|d}g}tjj|jj}xX|D]P}tjj|}||krztjjtjj |d}|j |||fq8|j d|q8W|S)Nz*.pyrz excluding %s) r[rr<r,r=abspathr"Z script_namesplitextbasenamerAZ debug_print) rrrZ module_filesmodulesZ setup_scriptrZabs_fr\rrrfind_package_moduless   zbuild_py.find_package_modulesc Csi}g}x|jD]}|jd}dj|dd}|d}y||\}}Wn"tk rj|j|}d}YnX|s|j||} |df||<| r|j|d| ftjj||d} |j || sq|j||| fqW|S)aFinds 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. r5rr6__init__z.pyrSrS) rr>r=rTr;r[rAr<r,r^) rr#rbr\r,rZ module_baserZcheckedrZr]rrr find_moduless*       zbuild_py.find_modulescCsRg}|jr|j|j|jrNx.|jD]$}|j|}|j||}|j|q&W|S)a4Compute 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.)rrKrer#r;rc)rrbrrmrrrfind_all_moduless   zbuild_py.find_all_modulescCsdd|jDS)NcSsg|] }|dqS)r6rSr)r7r\rrrr:-sz-build_py.get_source_files..)rg)rrrrget_source_files,szbuild_py.get_source_filescCs$|gt||dg}tjj|S)Nz.py)listr<r,r=)rrDrr\Z outfile_pathrrrget_module_outfile/szbuild_py.get_module_outfiler6cCs|j}g}xx|D]p\}}}|jd}|j|j||}|j||r|jr`|jtjj|dd|j dkr|jtjj||j dqW|dd|j D7}|S)Nr5rF) optimizationrcSs,g|]$\}}}}|D]}tjj||qqSr)r<r,r=)r7rrCrDrErQrrrr:Cs z(build_py.get_outputs..) rgr>rjrrAr importlibutilcache_from_sourcerr&)rr.rbZoutputsrr\r]rQrrrr33s"       zbuild_py.get_outputscCsbt|tr|jd}nt|ttfs,td|j|j||}tj j |}|j ||j ||ddS)Nr5z:'package' must be a string (dot-separated), list, or tupler)rM) r'strr>rituple TypeErrorrjrr<r,rOrNrP)rr\r]rZoutfiledirrrr build_moduleJs    zbuild_py.build_modulecCs.|j}x |D]\}}}|j|||qWdS)N)rers)rrbrr\r]rrrr/Yszbuild_py.build_modulescCsXxR|jD]H}|j|}|j||}x,|D]$\}}}||ks>t|j|||q(WqWdS)N)r#r;rcr)rs)rrrrbZpackage_r\r]rrrr0bs    zbuild_py.build_packagescCstjr|jddSddlm}|j}|dtjkr>|tj}|jrZ||d|j ||j d|j dkr||||j |j ||j ddS)Nz%byte-compiling is disabled, skipping.r)r2r6)rrprefixdry_runrS) sysdont_write_bytecoderYdistutils.utilr2rr<sepr rrur)rrIr2rtrrrr2vs    zbuild_py.byte_compile)r r r )r r r)rNr)rrr)rrr)r6)__name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsZ negative_optr r-r4r%r@r1r;r[r^rcrergrhrjr3rsr/r0r2rrrrrs8   '4  rc@seZdZddZddZdS) build_py_2to3cCsLg|_|jr|j|jr*|j|j|j|j|j|jdddS)Nr)r.) updated_filesrr/r#r0r1Zrun_2to3r2r3)rrrrr4s zbuild_py_2to3.runcCs,tj||||}|dr(|jj|d|S)Nr6r)rrsrrA)rr\r]rresrrrrsszbuild_py_2to3.build_moduleN)rzr{r|r4rsrrrrr~sr~)__doc__r<importlib.utilrlrvrZdistutils.corerZdistutils.errorsrxrrZ distutilsrrr~rrrrs   }__pycache__/install_lib.cpython-36.pyc000064400000012046147210141470013702 0ustar003 \ @sLdZddlZddlZddlZddlmZddlmZdZ GdddeZ dS)zkdistutils.command.install_lib Implements the Distutils 'install_lib' command (install all Python modules).N)Command)DistutilsOptionErrorz.pyc @seZdZdZd*d+d,d-d.d/d0gZdd dgZdd iZddZddZddZ ddZ ddZ d d!Z d"d#Z d$d%Zd&d'Zd(d)ZdS)1 install_libz7install all Python modules (extensions and pure Python) install-dir=ddirectory to install to build-dir=b'build directory (where to install from)forcef-force installation (overwrite existing files)compileccompile .py to .pyc [default] no-compileNdon't compile .py files optimize=Olalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0] skip-buildskip the build stepscCs(d|_d|_d|_d|_d|_d|_dS)Nr) install_dir build_dirr roptimize skip_build)selfr#/usr/lib64/python3.6/install_lib.pyinitialize_options3s zinstall_lib.initialize_optionsc Cs|jddddddd|jdkr&d |_|jdkr6d |_t|jtsyt|j|_|jdkr^tWn ttfk rtdYnXdS)Ninstall build_librrrr rrrTFrzoptimize must be 0, 1, or 2)r!r)rr)r r )rr)rr)rr)rr"r#)Zset_undefined_optionsrr isinstanceintAssertionError ValueErrorr)rrrrfinalize_options<s$     zinstall_lib.finalize_optionscCs0|j|j}|dk r,|jjr,|j|dS)N)buildr distributionhas_pure_modules byte_compile)routfilesrrrrunVszinstall_lib.runcCs2|js.|jjr|jd|jjr.|jddS)Nbuild_py build_ext)rr*r+Z run_commandhas_ext_modules)rrrrr)fs    zinstall_lib.buildcCs8tjj|jr |j|j|j}n|jd|jdS|S)Nz3'%s' does not exist -- no Python modules to install)ospathisdirrZ copy_treerwarn)rr-rrrr ms  zinstall_lib.installcCsrtjr|jddSddlm}|jdj}|jrH||d|j||j d|j dkrn|||j |j||j |j ddS)Nz%byte-compiling is disabled, skipping.r)r,r )rr prefixdry_run)rr r6verboser7) sysdont_write_bytecoder5Zdistutils.utilr,get_finalized_commandrootrr r7rr8)rfilesr,Z install_rootrrrr,vs     zinstall_lib.byte_compilec Csh|sgS|j|}|j}t||}t|ttj}g}x(|D] } |jtjj|| |dq@W|S)N) r; get_outputsgetattrlenr2sepappendr3join) rZhas_anyZ build_cmdZ cmd_optionZ output_dirZ build_filesrZ prefix_lenZoutputsfilerrr_mutate_outputss    zinstall_lib._mutate_outputscCsvg}xl|D]d}tjjtjj|d}|tkr0q |jrL|jtjj |dd|j dkr |jtjj ||j dq W|S)Nr") optimizationr) r2r3splitextnormcasePYTHON_SOURCE_EXTENSIONrrB importlibutilcache_from_sourcer)rZ py_filenamesZbytecode_filesZpy_fileZextrrr_bytecode_filenamess     zinstall_lib._bytecode_filenamescCsR|j|jjdd|j}|jr*|j|}ng}|j|jjdd|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!r0)rEr*r+rrrNr1)rZ pure_outputsZbytecode_outputsZ ext_outputsrrrr>s   zinstall_lib.get_outputscCsLg}|jjr&|jd}|j|j|jjrH|jd}|j|j|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/r0)r*r+r;extendr>r1)rZinputsr/r0rrr get_inputss    zinstall_lib.get_inputs)rrr)rr r )r r r )rrr)rNr)rrr)rNr)__name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsZ negative_optrr(r.r)r r,rErNr>rPrrrrrs*   r) __doc__r2importlib.utilrKr9Zdistutils.corerZdistutils.errorsrrJrrrrrs  __pycache__/upload_docs.cpython-36.pyc000064400000013610147210141470013700 0ustar003 K]@sdZddlmZddlmZddlmZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZmZddlmZd d lmZd d ZGd ddeZdS)zpupload_docs Implements a Distutils 'upload_docs' subcommand (upload documentation to PyPI's pythonhosted.org). )standard_b64encode)log)DistutilsOptionErrorN)six) http_clienturllib)iter_entry_points)uploadcCstjr dnd}|jd|S)Nsurrogateescapestrictzutf-8)rPY3encode)serrorsr!/usr/lib/python3.6/upload_docs.py_encodesrc@seZdZdZdZdddejfddgZejZd d Zd efgZ ddZ ddZ ddZ ddZ eddZeddZddZdS) upload_docszhttps://pypi.python.org/pypi/zUpload documentation to PyPIz repository=rzurl of repository [default: %s] show-responseN&display full response text from server upload-dir=directory to uploadcCs$|jdkr xtddD]}dSWdS)Nzdistutils.commands build_sphinxT) upload_dirr)selfZeprrr has_sphinx/s zupload_docs.has_sphinxrcCstj|d|_d|_dS)N)r initialize_optionsr target_dir)rrrrr6s zupload_docs.initialize_optionscCstj||jdkrN|jr0|jd}|j|_q`|jd}tjj |j d|_n|j d|j|_d|j krtt jd|jd|jdS)NrbuildZdocsrzpypi.python.orgz3Upload_docs command is deprecated. Use RTD instead.zUsing upload directory %s)r finalize_optionsrrZget_finalized_commandZbuilder_target_dirrospathjoinZ build_baseZensure_dirname repositoryrwarnannounce)rrr rrrr!;s        zupload_docs.finalize_optionsc Cstj|d}z|j|jxtj|jD]~\}}}||jkrT| rTd}t||jxP|D]H}tjj||}|t |jdj tjj } tjj| |} |j || qZWq(WWd|j XdS)Nwz'no files found in upload directory '%s')zipfileZZipFileZmkpathrr"walkrr#r$lenlstripsepwriteclose) rfilenamezip_filerootdirsfilesZtmplnameZfullZrelativedestrrrcreate_zipfileKs   zupload_docs.create_zipfilec Cslx|jD]}|j|q Wtj}|jjj}tjj |d|}z|j ||j |Wdt j |XdS)Nz%s.zip)Zget_sub_commandsZ run_commandtempfileZmkdtemp distributionmetadataget_namer"r#r$r7 upload_fileshutilZrmtree)rZcmd_nameZtmp_dirr5r1rrrrun[s  zupload_docs.runccs|\}}d|}t|ts |g}xn|D]f}t|trN|d|d7}|d}nt|}|Vt|VdV|V|r&|dddkr&dVq&WdS) Nz* Content-Disposition: form-data; name="%s"z; filename="%s"rr s   ) isinstancelisttupler)item sep_boundarykeyvaluestitlevaluerrr _build_partis     zupload_docs._build_partc Csnd}d|}|d}|df}tj|j|d}t||j}tjj|}tj||} d|jd} dj | | fS) z= Build up the MIME payload for the POST data s3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s --s--r@)rFz multipart/form-data; boundary=%sascii) functoolspartialrKmapitems itertoolschain from_iterabledecoder$) clsdataboundaryrFZ end_boundaryZ end_itemsZbuilderZ part_groupspartsZ body_items content_typerrr_build_multipart}s  zupload_docs._build_multipartcCsPt|d}|j}WdQRX|jj}d|jtjj||fd}t|j d|j }t |}t j rn|jd}d|}|j|\}} d|j} |j| tjtjj|j\} } } }}}| r| r| st| dkrtj| }n | d krtj| }n td | d }yZ|j|jd | | }|jd ||jdtt||jd||j |j!|Wn6t"j#k r}z|jt|tj$dSd}~XnX|j%}|j&dkrd|j&|j'f} |j| tjnb|j&dkr|j(d}|dkrd|j}d|} |j| tjnd|j&|j'f} |j| tj$|j)rLt*dd|jdddS)NrbZ doc_upload)z:actionr5content:rLzBasic zSubmitting documentation to %sZhttpZhttpszunsupported schema ZPOSTz Content-typezContent-lengthZ AuthorizationzServer response (%s): %si-ZLocationzhttps://pythonhosted.org/%s/zUpload successful. Visit %szUpload failed (%s): %s-K)+openreadr9r:r;r"r#basenamerZusernameZpasswordrrr rUr[r%r'rINFOrparseZurlparseAssertionErrorrZHTTPConnectionZHTTPSConnectionZconnectZ putrequestZ putheaderstrr+Z endheaderssendsocketerrorZERRORZ getresponseZstatusreasonZ getheaderZ show_responseprint)rr0fr]metarWZ credentialsZauthZbodyZctmsgZschemaZnetlocZurlZparamsZqueryZ fragmentsZconnrZerlocationrrrr<s`              zupload_docs.upload_file)rNr)rNr)__name__ __module__ __qualname__ZDEFAULT_REPOSITORY descriptionr Z user_optionsZboolean_optionsrZ sub_commandsrr!r7r> staticmethodrK classmethodr[r<rrrrrs"    r)__doc__base64rZ distutilsrZdistutils.errorsrr"rkr)r8r=rRrNZsetuptools.externrZsetuptools.extern.six.movesrrZ pkg_resourcesrr rrrrrrs       __pycache__/install.cpython-36.pyc000064400000033613147210141470013057 0ustar003 /fj@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZmZmZdd lmZdd l mZdd lmZdd lmZdZddddddZddddddddddddedZerdddddded <ddd!d"dded#<d+ZGd)d*d*eZdS),zFdistutils.command.install Implements the Distutils 'install' command.N)log)Command)DEBUG)get_config_vars)DistutilsPlatformError) write_file) convert_path subst_vars change_root) get_platform)DistutilsOptionError) USER_BASE) USER_SITETz$base/Lib/site-packagesz$base/Include/$dist_namez $base/Scriptsz$base)purelibplatlibheadersscriptsdataz/$base/lib/python$py_version_short/site-packagesz5$platbase/lib64/python$py_version_short/site-packagesz9$base/include/python$py_version_short$abiflags/$dist_namez $base/binz$base/lib/pythonz$base/lib64/pythonz$base/include/python/$dist_name) unix_prefix unix_homentz $usersitez4$userbase/Python$py_version_nodot/Include/$dist_namez)$userbase/Python$py_version_nodot/Scriptsz $userbasent_userz=$userbase/include/python$py_version_short$abiflags/$dist_namez $userbase/bin unix_userrrrrrc@s:eZdZdZd_d`dadbdddedfdgdidjdkdldmdndodpdqdrgZdd%d(gZer`ejd,dd-efejd,d diZ d.d/Z d0d1Z d2d3Z d4d5Z d6d7Zd8d9Zd:d;Zdd?Zd@dAZdBdCZdDdEZdFdGZdHdIZdJdKZdLdMZdNdOZdPdQZdRdSZdTdUZdVdWZdXefdYefdZefd[efd\d]d^fgZdS)sinstallz'install everything from build directoryprefix=Ninstallation prefix exec-prefix=.(Unix only) prefix for platform-specific fileshome=+(Unix only) home directory to install under install-base=;base installation directory (instead of --prefix or --home)install-platbase=z8base installation directory for platform-specific files z$(instead of --exec-prefix or --home)root=|jD]2}|j|}x"|jD]}||kr&|j|q&WqW|jrl|jrl|jtjj|j |jd|S)z.Assembles the outputs of all the sub-commands.z.pth) rget_finalized_commandrappendrrQrhr}r~r|)rWrrcmdrrXrXrYrbs  zinstall.get_outputscCs2g}x(|jD]}|j|}|j|jqW|S)z*Returns the inputs of all the sub-commands)rrextend get_inputs)rWZinputsrrrXrXrYrss  zinstall.get_inputscCs|jjp|jjS)zSReturns true if the current distribution has any Python modules to install.)rrZhas_pure_modulesZhas_ext_modules)rWrXrXrYhas_libs zinstall.has_libcCs |jjS)zLReturns true if the current distribution has any headers to install.)rr has_headers)rWrXrXrYrszinstall.has_headerscCs |jjS)zMReturns true if the current distribution has any scripts to. install.)rr has_scripts)rWrXrXrYrszinstall.has_scriptscCs |jjS)zJReturns true if the current distribution has any data to. install.)rrZhas_data_files)rWrXrXrYhas_dataszinstall.has_datarJrIrKrLZinstall_egg_infocCsdS)NTrX)rWrXrXrYszinstall.)rNr)rNr)rNr)r Nr!\base installation directory for platform-specific files (instead of --exec-prefix or --home))r"Nr)r#Nr$)r%Nr&)r'Nr(ginstallation directory for all module distributions (overrides --install-purelib and --install-platlib))r)Nr)r*Nr+)r,Nr-)r.Nr/)r0r1r2)r3Nr4)r5r6r7)r8r9r:)r;Nr<)r=Nr>) __name__ __module__ __qualname__ descriptionrZboolean_optionsrurrrrZrrkrlrmrrrvrxrzr{rryrrrrrrrrZ sub_commandsrXrXrXrYrIs   N3  " , r)rrrrr)__doc__rnrhZ distutilsrZdistutils.corerZdistutils.debugrZdistutils.sysconfigrZdistutils.errorsrZdistutils.file_utilrZdistutils.utilrr r r r Zsiter rruZWINDOWS_SCHEMErrrrXrXrXrYsV            __pycache__/saveopts.cpython-36.opt-1.pyc000064400000001520147210141470014204 0ustar003 K]@s$ddlmZmZGdddeZdS)) edit_config option_basec@seZdZdZdZddZdS)saveoptsz#Save command-line options to a filez7save supplied options to setup.cfg or other config filecCsp|j}i}xP|jD]F}|dkr qx6|j|jD]$\}\}}|dkr0||j|i|<q0WqWt|j||jdS)Nrz command line)Z distributionZcommand_optionsZget_option_dictitems setdefaultrfilenameZdry_run)selfZdistZsettingscmdoptsrcvalr /usr/lib/python3.6/saveopts.pyrun s z saveopts.runN)__name__ __module__ __qualname____doc__ descriptionrr r r rrsrN)Zsetuptools.command.setoptrrrr r r rs__pycache__/upload.cpython-36.pyc000064400000012233147210141470012670 0ustar003 /f@sdZddlZddlZddlZddlZddlmZddlmZm Z m Z ddl m Z ddl mZmZddlmZddlmZdd lmZGd d d eZdS) zm distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to a package index). N)standard_b64encode)urlopenRequest HTTPError)urlparse)DistutilsErrorDistutilsOptionError) PyPIRCCommand)spawn)logc@sJeZdZdZejddgZejdgZdd Zd d Zd d Z ddZ dS)uploadzupload binary package to PyPIsignssign files to upload using gpg identity=iGPG identity used to sign filescCs,tj|d|_d|_d|_d|_d|_dS)NrF)r initialize_optionsusernamepassword show_responser identity)selfr/usr/lib64/python3.6/upload.pyr s  zupload.initialize_optionscCsvtj||jr |j r td|j}|ikrX|d|_|d|_|d|_|d|_ |j rr|j jrr|j j|_dS)Nz.Must use --sign for --identity to have meaningrr repositoryrealm) r finalize_optionsrr rZ _read_pypircrrrr distribution)rconfigrrrr(s     zupload.finalize_optionscCs>|jjsd}t|x$|jjD]\}}}|j|||qWdS)NzHMust create and upload files in one command (e.g. setup.py sdist upload))rZ dist_filesr upload_file)rmsgcommand pyversionfilenamerrrrun:s z upload.runc&)Cs^t|j\}}}}}} |s"|s"| r0td|j|d2krDtd||jr|ddd|g} |jrnd|jg| d d <t| |jd t|d } z | j} Wd| j X|j j } d d | j | j tjj|| f||tj| jd| j| j| j| j| j| j| j| j| j| j| j| j| j d}ytj!| j}WnPt"k r}z2d|}|j#|t$j%ddl&m'}|s|WYdd}~Xn X||d<d}|dkrt(j)\}}}|rd||f}n|dkrdt(j(dd}||d<|jrtjj|dt|dd jf|d<|j*d|j+j,d}d t-|j.d}d!}d"|j,d}|d#}t/j0}x|j1D]\}}d$|}t2|t3s|g}xr|D]j}t4|t5kr|d%|d7}|d}nt6|j,d&}|j7||j7|j,d&|j7d'|j7|qWqjW|j7||j8}d(||jf}|j#|t$j%d)|t6t9||d*} t:|j|| d+}!yt;|!}"|"j<}#|"j=}$Wnft>k r}z|j?}#|j=}$WYdd}~Xn8t@k r}z|j#t6|t$jAWYdd}~XnX|#d,kr8|j#d-|#|$ft$j%|jBrZ|jC|"}%d.jDd/d0|%d/d0f}|j#|t$j%n"d1|#|$f}|j#|t$jAtE|dS)3NzIncompatible url %shttphttpszunsupported schema Zgpgz --detach-signz-az --local-user)dry_runrbZ file_upload1z1.0)z:actionZprotocol_versionnameversioncontentZfiletyper$Z sha256_digestZmetadata_versionZsummaryZ home_pageZauthorZ author_emaillicense descriptionkeywordsplatformZ classifiersZ download_urlZprovidesZrequiresZ obsoletesz#calculating md5 checksum failed: %sr) get_fips_modeZ md5_digestrZ bdist_rpmzbuilt for %s %sZ bdist_dumbz built for %s)Ztersecommentz.ascZ gpg_signature:asciizBasic z3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s --s-- z+ Content-Disposition: form-data; name="%s"z; filename="%s"zutf-8s zSubmitting %s to %sz multipart/form-data; boundary=%s)z Content-typezContent-lengthZ Authorization)dataheaderszServer response (%s): %s -KzUpload failed (%s): %s)r'r()FrrAssertionErrorr rr r*openreadcloserZmetadataZget_nameZ get_versionospathbasenamehashlibZsha256Z hexdigestZget_descriptionZget_urlZ get_contactZget_contact_emailZ get_licenceZget_long_descriptionZ get_keywordsZ get_platformsZget_classifiersZget_download_urlZ get_providesZ get_requiresZ get_obsoletesZmd5 ValueErrorZannouncer INFOZ_hashlibr4r3distrrencoderdecodeioBytesIOitems isinstancelisttypetuplestrwritegetvaluelenrrZgetcoder"rcodeOSErrorZERRORrZ_read_pypi_responsejoinr)&rr#r$r%ZschemaZnetlocZurlZparamsZqueryZ fragmentsZgpg_argsfr/metar9Zdigester"r4r6rIr.idZ user_passZauthboundaryZ sep_boundaryZ end_boundaryZbodykeyvaluetitler:ZrequestresultZstatusreasontextrrrr!Bs                       zupload.upload_fileN)r rr)rrr) __name__ __module__ __qualname__r1r Z user_optionsZboolean_optionsrrr&r!rrrrr s r )__doc__rCrLr3rFbase64rZurllib.requestrrrZ urllib.parserZdistutils.errorsrrZdistutils.corer Zdistutils.spawnr Z distutilsr r rrrrs     __pycache__/bdist_wininst.cpython-36.pyc000064400000020215147210141470014263 0ustar003 /f<@spdZddlZddlZddlmZddlmZddlmZm Z ddl Tddl m Z ddl mZGd d d eZdS) zzdistutils.command.bdist_wininst Implements the Distutils 'bdist_wininst' command: create a windows installer exe-program.N)Command) get_platform) create_tree remove_tree)*)get_python_version)logc@seZdZdZdZd5dddefd7d9d:d;dd?d@dAdBg Zd dddgZd'd(Zd)d*Z d+d,Z d-d.Z dCd/d0Z d1d2Z d3d4ZdS)D bdist_wininstTz-create an executable installer for MS Windows bdist-dir=N1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s) keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archivetarget-version=z!require a specific python versionz on the target systemno-target-compilec/do not compile .py to .pyc on the target systemno-target-optimizeo;do not compile .py to .pyo (optimized) on the target system dist-dir=d-directory to put final built distributions inbitmap=b>bitmap to use for the installer instead of python-powered logotitle=t?title to display on the installer background instead of default skip-build2skip rebuilding everything (for testing/debugging)install-script=Ubasename of installation script to be run after installation or before deinstallationpre-install-script={Fully qualified filename of a script to be run before any files are installed. This script need not be in the distributionuser-access-control=specify Vista's UAC handling - 'none'/default=no handling, 'auto'=use UAC if target Python installed for all users, 'force'=always use UACcCsRd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ dS)Nr) bdist_dir plat_name keep_tempno_target_compileno_target_optimizetarget_versiondist_dirbitmaptitle skip_buildinstall_scriptpre_install_scriptuser_access_control)selfr5%/usr/lib64/python3.6/bdist_wininst.pyinitialize_options<sz bdist_wininst.initialize_optionscCs|jdd |jdkrR|jr6|jr6|jjd}|j|_|jdj}tj j |d|_|j s^d|_ |j r|jj rt }|j r|j |krtd|f||_ |jdd d |jrx2|jjD]}|jtj j|krPqWtd|jdS) Nbdistr0ZwininstzMtarget version can only be %s, or the '--skip-build' option must be specifiedr-r(z(install_script '%s' not found in scripts)r0r0)r-r-)r(r()Zset_undefined_optionsr'r0r( distributionZget_command_objget_finalized_command bdist_baseospathjoinr,has_ext_modulesrZDistutilsOptionErrorr1scriptsbasename)r4r8r<Z short_versionscriptr5r5r6finalize_optionsLs4      zbdist_wininst.finalize_optionsc Cstjdkr&|jjs|jjr&td|js6|jd|jddd}|j |_ |j|_d|_ |j |_ |jd}d|_ d|_|jjr|j}|s|jstd d tjdd }d |j |f}|jd}tjj|jd ||_x6dD].}|j}|dkr|d}t|d||qWtjd|j |jtjjdtjj|j d|jtjd=ddlm }|} |jj!} |j"| d|j d} |j#| | |j$|jjrt%} nd} |jj&j'd| |j(| ftj)d| tj*| |j+st,|j |j-ddS)Nwin32z^distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platformbuildinstall)Zreinit_subcommandsr install_libz Should have already checked thisz%d.%dz.%s-%slibpurelibplatlibheadersrAdataz/Include/$dist_nameZinstall_zinstalling to %sZPURELIB)mktempzip)Zroot_diranyr zremoving temporary file '%s')dry_run)rLrMrNrArO).sysplatformr:r@Zhas_c_librariesZDistutilsPlatformErrorr0Z run_commandZreinitialize_commandr'rootZwarn_dirr(compileoptimizer,AssertionError version_infor;r=r>r?Z build_baseZ build_libuppersetattrrinfoZensure_finalizedinsertrunZtempfilerP get_fullnameZ make_archive create_exer.rZ dist_filesappendget_installer_filenamedebugremover)rrS) r4rGrIr,Zplat_specifierrFkeyvaluerPZarchive_basenamefullnamearcnameZ pyversionr5r5r6r_rsf                   zbdist_wininst.runc Cs`g}|jj}|jd|jpdd}dd}xJdD]B}t||d}|r2|d|j||f}|jd|||fq2W|jd|jr|jd|j|jd|||jd|j |jd|j |j r|jd|j |j r|jd|j |j p |jj }|jd||ddl }ddl} d|j|j | jf} |jd| dj|S)Nz [metadata]r9 cSs |jddS)Nrjz\n)replace)sr5r5r6escapesz)bdist_wininst.get_inidata..escapeauthor author_email description maintainermaintainer_emailnameurlversionz %s: %sz%s=%sz [Setup]zinstall_script=%szinfo=%sztarget_compile=%dztarget_optimize=%dztarget_version=%szuser_access_control=%sztitle=%srzBuilt %s with distutils-%sz build_info=%s)rnrorprqrrrsrtru)r:metadatarbZlong_descriptiongetattr capitalizer1r*r+r,r3r/r`time distutilsZctime __version__r?) r4linesrvr]rmrsrOr/ryrzZ build_infor5r5r6 get_inidatas<   zbdist_wininst.get_inidatac Csddl}|j|j|j}|j|}|jd||rPt|dj}t|}nd}t|d} | j |j |rz| j |t |t r|j d}|d}|jrt|jddd } | jj d} WdQRX|| d }n|d}| j ||jd d t||} | j | | j t|djdS) Nrz creating %srbwbmbcsrzlatin-1)encodings zr?r-r()r4rhrr5r5r6rc&s  z$bdist_wininst.get_installer_filenamec Cs t}|jrl|j|krl|jdkr&d}q|jdkr6d}q|jdkrFd}q|jdkrVd}q|jdkrfd }qd }n@yd d lm}Wntk rd }YnX|jd d }|d}tjjt }|j dkr|j dddkr|j dd}nd}tjj |d||f}t |d}z|j S|jXdS)Nz2.4z6.0z7.1z2.5z8.0z3.2z9.0z3.4z10.0z14.0r)CRT_ASSEMBLY_VERSION.z.0rEwinr9zwininst-%s%s.exer~)rr,Zmsvcrtr ImportError partitionr=r>dirname__file__r(r?rrclose) r4Z cur_versionZbvrmajorZ directoryZsfixfilenamefr5r5r6r3s8         zbdist_wininst.get_exe_bytes)r Nr Pkeep the pseudo-installation tree around after creating the distribution archive)r rr6require a specific python version on the target system)rNr)rrr)rrr)rrr)rrr)rrr)rNr )r!Nr")r#Nr$)r%Nr&)N)__name__ __module__ __qualname__Z _unsupportedrprZ user_optionsZboolean_optionsr7rDr_r}rarcrr5r5r5r6r sP&Q. 5 r )__doc__rTr=Zdistutils.corerZdistutils.utilrZdistutils.dir_utilrrZdistutils.errorsZdistutils.sysconfigrrzrr r5r5r5r6s    __pycache__/rotate.cpython-36.opt-1.pyc000064400000004707147210141470013650 0ustar003 K]t@s`ddlmZddlmZddlmZddlZddlZddlm Z ddl m Z Gddde Z dS) ) convert_path)log)DistutilsOptionErrorN)six)Commandc@s:eZdZdZdZdddgZgZd d ZddZddZ dS)rotatezDelete older distributionsz2delete older distributions, keeping N newest filesmatch=mpatterns to match (required) dist-dir=d%directory where the distributions arekeep=k(number of matching distributions to keepcCsd|_d|_d|_dS)N)matchdist_dirkeep)selfr/usr/lib/python3.6/rotate.pyinitialize_optionsszrotate.initialize_optionsc Cs|jdkrtd|jdkr$tdyt|j|_Wntk rPtdYnXt|jtjrxdd|jjdD|_|j dd dS) NzQMust specify one or more (comma-separated) match patterns (e.g. '.zip' or '.egg')z$Must specify number of files to keepz--keep must be an integercSsg|]}t|jqSr)rstrip).0prrr +sz+rotate.finalize_options..,Zbdistr)rr) rrrint ValueError isinstancerZ string_typessplitZset_undefined_options)rrrrfinalize_optionss  zrotate.finalize_optionscCs|jdddlm}x|jD]}|jjd|}|tjj|j|}dd|D}|j |j t j dt ||||jd}xD|D]<\}}t j d||jstjj|rtj|qtj|qWqWdS) NZegg_infor)glob*cSsg|]}tjj||fqSr)ospathgetmtime)rfrrrr6szrotate.run..z%d file(s) matching %sz Deleting %s)Z run_commandr"rZ distributionZget_namer$r%joinrsortreverserinfolenrZdry_runisdirshutilZrmtreeunlink)rr"patternfilestr'rrrrun/s       z rotate.runN)rr r )r r r )rrr) __name__ __module__ __qualname____doc__ descriptionZ user_optionsZboolean_optionsrr!r3rrrrr sr) Zdistutils.utilrZ distutilsrZdistutils.errorsrr$r.Zsetuptools.externrZ setuptoolsrrrrrrs     __pycache__/test.cpython-36.opt-1.pyc000064400000017625147210141470013334 0ustar003 K]#@sddlZddlZddlZddlZddlZddlZddlmZmZddl m Z ddlm Z ddl m Z ddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZGd d d e ZGd d d eZGd ddeZ dS)N)DistutilsErrorDistutilsOptionError)log) TestLoader)six)mapfilter) resource_listdirresource_existsnormalize_path working_set_namespace_packagesevaluate_markeradd_activation_listenerrequire EntryPoint)Commandc@seZdZddZdddZdS)ScanningLoadercCstj|t|_dS)N)r__init__set_visited)selfr/usr/lib/python3.6/test.pyrs zScanningLoader.__init__NcCs||jkrdS|jj|g}|jtj||t|drH|j|jt|drxpt|jdD]`}|j dr|dkr|jd|dd }n"t |j|d r`|jd|}nq`|j|j |q`Wt |d kr|j |S|d SdS) aReturn a suite of all tests cases contained in the given module If the module is a package, load tests from all the modules in it. If the module has an ``additional_tests`` function, call it and add the return value to the tests. Nadditional_tests__path__z.pyz __init__.py.z /__init__.pyr)raddappendrloadTestsFromModulehasattrrr __name__endswithr ZloadTestsFromNamelenZ suiteClass)rmodulepatternZtestsfileZ submodulerrrr#s$      z"ScanningLoader.loadTestsFromModule)N)r% __module__ __qualname__rr#rrrrrsrc@seZdZddZdddZdS)NonDataPropertycCs ||_dS)N)fget)rr.rrrr>szNonDataProperty.__init__NcCs|dkr |S|j|S)N)r.)robjZobjtyperrr__get__AszNonDataProperty.__get__)N)r%r+r,rr0rrrrr-=sr-c@seZdZdZdZd%d&d'gZd d ZddZeddZ ddZ ddZ e j gfddZee j ddZeddZddZddZed d!Zed"d#Zd$S)(testz.Command to run unit tests after in-place buildz#run unit tests after in-place build test-module=m$Run 'test_suite' in specified module test-suite=s9Run single test, case or suite (e.g. 'module.test_suite') test-runner=rTest runner to usecCsd|_d|_d|_d|_dS)N) test_suite test_module test_loader test_runner)rrrrinitialize_optionsSsztest.initialize_optionscCs|jr|jrd}t||jdkrD|jdkr8|jj|_n |jd|_|jdkr^t|jdd|_|jdkrnd|_|jdkrt|jdd|_dS)Nz1You may specify a module or a suite, but not bothz .test_suiter=z&setuptools.command.test:ScanningLoaderr>)r;r<r distributionr=getattrr>)rmsgrrrfinalize_optionsYs        ztest.finalize_optionscCs t|jS)N)list _test_args)rrrr test_argslsztest.test_argsccs6|j rtjdkrdV|jr$dV|jr2|jVdS)NZdiscoverz --verbose)rGrH)r;sys version_infoverbose)rrrrrEps ztest._test_argsc Cs|j |WdQRXdS)zI Backward compatibility for project_on_sys_path context. N)project_on_sys_path)rfuncrrrwith_project_on_sys_pathxs ztest.with_project_on_sys_pathc csPtjot|jdd}|rv|jddd|jd|jd}t|j}|jd|d|jd|jddd|jdn"|jd|jdd d|jd|jd}t j dd}t j j }zbt|j }t j jd|tjtd d td |j|jf|j|g dVWdQRXWd|t j dd<t j jt j j|tjXdS) Nuse_2to3FZbuild_pyr)ZinplaceZegg_info)egg_baseZ build_extrcSs|jS)N)Zactivate)distrrrsz*test.project_on_sys_path..z%s==%s)rPY3rAr@Zreinitialize_commandZ run_commandZget_finalized_commandr Z build_librIpathmodulescopyrPinsertr rrrZegg_nameZ egg_versionpaths_on_pythonpathclearupdate) rZ include_distsZ with_2to3Zbpy_cmdZ build_pathZei_cmdZold_pathZ old_modulesZ project_pathrrrrLs8             ztest.project_on_sys_pathc cst}tjjd|}tjjdd}z>tjj|}td||g}tjj|}|rX|tjd<dVWd||krztjjddn |tjd<XdS)z Add the indicated paths to the head of the PYTHONPATH environment variable so that subprocesses will also see the packages at these paths. Do this in a context that restores the value on exit. PYTHONPATHrN)objectosenvirongetpathsepjoinrpop)pathsZnothingZorig_pythonpathZcurrent_pythonpathprefixZto_joinnew_pathrrrrXs     ztest.paths_on_pythonpathcCsD|j|j}|j|jpg}|jdd|jjD}tj|||S)z Install the requirements indicated by self.distribution and return an iterable of the dists that were built. css0|](\}}|jdrt|ddr|VqdS):rN) startswithr).0kvrrr sz%test.install_dists..)Zfetch_build_eggsZinstall_requiresZ tests_requireZextras_requireitems itertoolschain)rQZir_dZtr_dZer_drrr install_distss  ztest.install_distscCs|j|j}dj|j}|jr0|jd|dS|jd|ttjd|}|j |"|j |j WdQRXWdQRXdS)N zskipping "%s" (dry run)z running "%s"location) ror@ra_argvZdry_runannounceroperator attrgetterrXrL run_tests)rZinstalled_distscmdrcrrrruns    ztest.runcCstjrt|jddr|jjdd}|tkrg}|tjkrD|j ||d7}x"tjD]}|j |rT|j |qTWt t tjj |tjdd|j|j|j|j|jdd}|jjsd|j}|j|tjt|dS)NrOFrr)Z testLoaderZ testRunnerexitzTest failed: %s)rrSrAr@r;splitr rIrUr"rgrDr __delitem__unittestmainrr_resolve_as_epr=r>resultZ wasSuccessfulrsrZERRORr)rr(Z del_modulesnamer1rBrrrrvs(        ztest.run_testscCs dg|jS)Nr|)rF)rrrrrrsz test._argvcCs$|dkr dStjd|}|jS)zu Load the indicated attribute value, called, as a as if it were specified as an entry point. Nzx=)rparseZresolve)valZparsedrrrr~sztest._resolve_as_epN)r2r3r4)r5r6r7)r8r9r:)r%r+r,__doc__ descriptionZ user_optionsr?rCr-rFrErN contextlibcontextmanagerrL staticmethodrXrorxrvpropertyrrr~rrrrr1Gs( -  r1)!r]rtrIrrmr|Zdistutils.errorsrrZ distutilsrrZsetuptools.externrZsetuptools.extern.six.movesrrZ pkg_resourcesr r r r r rrrrZ setuptoolsrrr\r-r1rrrrs   , ) __pycache__/register.cpython-36.opt-1.pyc000064400000020312147210141470014164 0ustar003 \-@sddZddlZddlZddlZddlZddlmZddlm Z ddl Tddl m Z Gddde Z dS) zhdistutils.command.register Implements the Distutils 'register' command (register with the repository). N)warn) PyPIRCCommand)*)logc@seZdZdZejdd gZejdddgZdd d fgZd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZd!ddZdS)"registerz7register the distribution with the Python package indexlist-classifiersN list the valid Trove classifiersstrictBWill stop the registering if the meta-data are not fully compliantverifycheckcCsdS)NT)selfr r /usr/lib64/python3.6/register.pyszregister.cCstj|d|_d|_dS)Nr)rinitialize_optionslist_classifiersr )rr r rrs zregister.initialize_optionscCs*tj|d|jfdd}||jjd<dS)Nr)r restructuredtextr )rr)rfinalize_optionsr distributionZcommand_options)rZ check_optionsr r rr$s zregister.finalize_optionscCsX|j|jx|jD]}|j|qW|jr<|jn|jrL|jn|jdS)N) r _set_configZget_sub_commandsZ run_commandZdry_runverify_metadatar classifiers send_metadata)rZcmd_namer r rrun+s  z register.runcCs8tdt|jjd}|j|j|_d|_|jdS)zDeprecated API.zddistutils.command.register.check_metadata is deprecated, use the check command insteadr rN)rPendingDeprecationWarningrZget_command_objZensure_finalizedr rr)rr r r rcheck_metadata:s zregister.check_metadatacCsz|j}|ikr@|d|_|d|_|d|_|d|_d|_n6|jd|jfkr^td|j|jdkrp|j|_d|_d S) z: Reads the configuration file and set attributes. usernamepassword repositoryrealmTZpypiz%s not found in .pypircFN)Z _read_pypircrrr r! has_configZDEFAULT_REPOSITORY ValueError)rconfigr r rrDs     zregister._set_configcCs*|jd}tjj|}tj|j|dS)z8 Fetch the list of classifiers from the server. z?:action=list_classifiersN)r urllibrequestZurlopenrinfo_read_pypi_response)rZurlZresponser r rrUs  zregister.classifierscCs&|j|jd\}}tjd||dS)zF Send the metadata to the package index server to be checked. r zServer response (%s): %sN)post_to_serverbuild_post_datarr')rcoderesultr r rr\szregister.verify_metadatac Cs|jrd}|j}|j}n d}d}}dj}x:||krf|jdtjt}|sTd}q.||kr.tdq.W|dkr|x|std}qtWx|st j d}qWt j j }t j j|jd }|j|j||||j|jd |\}}|jd ||ftj|d kr|jr||j_nj|jd tj|jd|jtjd}x&|jdkr\td}|s8d}q8W|jdkr|j||n|dkrddi} d| d<| d<| d<d| d<x| dstd| d<qWx| d| dkrNx| dst j d| d<qWx| dst j d| d<qW| d| dkrd| d<d| d<tdqWx| dsltd| d<qRW|j| \}}|d krtjd ||ntjdtjd nT|d!krdd"i} d| d<x| dstd#| d<qW|j| \}}tjd ||dS)$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. 1xz1 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: rZsubmitzServer response (%s): %szAI can store your PyPI login so future submissions will be faster.z (the login will be stored in %s)XZynzSave your login (y/N)?ny2z:actionusernamerZemailNZconfirmz 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.3Zpassword_resetzYour email address: )r"rrsplitannouncerINFOinputprintgetpassr%r&ZHTTPPasswordMgrparseZurlparser Z add_passwordr!r)r*rZ _get_rc_filelowerZ _store_pypircr') rZchoicerrchoicesauthhostr+r,datar r rrcs                     zregister.send_metadatacCs|jj}|d|j|j|j|j|j|j|j|j |j |j |j |j |j|j|jd}|ds|ds|drd|d<|S)Nz1.0)z:actionmetadata_versionr6versionZsummaryZ home_pageZauthorZ author_emaillicense descriptionkeywordsplatformrZ download_urlprovidesrequires obsoletesrJrKrLz1.1rD)rZmetadataZget_nameZ get_versionZget_descriptionZget_urlZ get_contactZget_contact_emailZ get_licenceZget_long_descriptionZ get_keywordsZ get_platformsZget_classifiersZget_download_urlZ get_providesZ get_requiresZ get_obsoletes)ractionmetarCr r rr*s* zregister.build_post_datacCsd|kr$|jd|d|jftjd}d|}|d}tj}x|jD]\}}t|tgtffkrp|g}xZ|D]R}t|}|j ||j d||j d|j ||rv|dd krv|j d qvWqJW|j ||j d |j j d }d |tt |d } t jj|j|| } t jjt jj|d} d}y| j| } Wnxt jjk r} z$|jrl| jj}| j| jf} WYdd} ~ XnJt jjk r} zdt| f} WYdd} ~ XnX|jr|j| }d} |jrd jdd|ddf}|j|tj| S)zC Post a query to the server, and return a string response. r6zRegistering %s to %sz3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254z --z--z* Content-Disposition: form-data; name="%s"z r  zutf-8z/multipart/form-data; boundary=%s; charset=utf-8)z Content-typezContent-length)Z password_mgrr/Nir0OK-K)r0rQ)r9r rr:ioStringIOitemstypestrwritegetvalueencodelenr%r&ZRequestZ build_openerZHTTPBasicAuthHandleropenerrorZ HTTPErrorZ show_responsefpreadr+msgZURLErrorr(join)rrCrAboundaryZ sep_boundaryZ end_boundaryZbodykeyvalueZheadersZreqopenerr,erbr r rr)sV         zregister.post_to_server)rNr)r Nr )N)__name__ __module__ __qualname__rGrZ user_optionsZboolean_optionsZ sub_commandsrrrrrrrrr*r)r r r rrs&  zr)__doc__r=rUZ urllib.parser%Zurllib.requestwarningsrZdistutils.corerZdistutils.errorsZ distutilsrrr r r rs   __pycache__/bdist_rpm.cpython-36.opt-1.pyc000064400000031272147210141470014332 0ustar003 \T@sdZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl Tddl mZdd lmZGd d d eZdS) zwdistutils.command.bdist_rpm Implements the Distutils 'bdist_rpm' command (create RPM source and binary distributions).N)Command)DEBUG) get_platform) write_file)*)get_python_version)logc+@seZdZdZdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddg)Zd4d9d=d2dUgZd4d9d=dXZdYdZZd[d\Zd]d^Z d_d`Z dadbZ dcddZ dedfZ dS) bdist_rpmzcreate an RPM distribution bdist-base=N/base directory for creating built distributions rpm-base=dbase directory for creating RPMs (defaults to "rpm" under --bdist-base; must be specified for RPM 2) dist-dir=dDdirectory to put final RPM files in (and .spec files if --spec-only)python=Mpath to Python interpreter to hard-code in the .spec file (default: "python") fix-pythonLhard-code the exact path to the current Python interpreter in the .spec file spec-onlyonly regenerate spec file source-onlyonly generate source RPM binary-onlyonly generate binary RPM use-bzip27use bzip2 instead of gzip to create source distributiondistribution-name=gname of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!)group=9package classification [default: "Development/Libraries"]release=RPM release numberserial=RPM serial numbervendor=aRPM "vendor" (eg. "Joe Blow ") [default: maintainer or author from setup script] packager=BRPM packager (eg. "Jane Doe ") [default: vendor] doc-files=6list of documentation files (space or comma-separated) changelog= RPM changelogicon=name of icon file provides=%capabilities provided by this package requires=%capabilities required by this package conflicts=-capabilities which conflict with this packagebuild-requires=+capabilities required to build this package obsoletes=*capabilities made obsolete by this package no-autoreq+do not automatically calculate dependencies keep-tempk"don't clean up RPM build directory no-keep-temp&clean up RPM build directory [default]use-rpm-opt-flags8compile with RPM_OPT_FLAGS when building from source RPMno-rpm-opt-flags&do not pass any RPM CFLAGS to compiler rpm3-mode"RPM 3 compatibility mode (default) rpm2-modeRPM 2 compatibility mode prep-script=3Specify a script for the PREP phase of RPM building build-script=4Specify a script for the BUILD phase of RPM building pre-install=:Specify a script for the pre-INSTALL phase of RPM buildinginstall-script=6Specify a script for the INSTALL phase of RPM building post-install=;Specify a script for the post-INSTALL phase of RPM buildingpre-uninstall=rnroREADME README.txtrk1rlrirprqrrrsrtrurvrwrxryrzr|r}r~rrr)rr)Z ensure_stringrZ get_contactZget_contact_emailZensure_string_list isinstancerolistrrexistsappend_format_changelogrpZensure_filename)rZreadmerrrrs>                         zbdist_rpm.finalize_package_datac Cstrsz-bdist_rpm._make_spec_file..zbrp-python-bytecompile \ z%brp-python-bytecompile %{__python} \ z2# Workaround for http://bugs.python.org/issue14443z%define __os_install_post z Name: %{name}zVersion: %{version}zRelease: %{release}z-Source0: %{name}-%{unmangled_version}.tar.bz2z,Source0: %{name}-%{unmangled_version}.tar.gzz License: zGroup: z>BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootzPrefix: %{_prefix}zBuildArch: noarchz BuildArch: %sVendorPackagerProvidesRequires Conflicts Obsoletesz%s: %s NZUNKNOWNzUrl: zDistribution: zBuildRequires: zIcon: z AutoReq: 0z %descriptionz%s %srz%s buildzenv CFLAGS="$RPM_OPT_FLAGS" z>%s install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILESr{rr&%setup -n %{name}-%{unmangled_version}ZbuildrsZinstallrtcleanrurm -rf $RPM_BUILD_ROOT verifyscriptrvprerwpostrxpreunrypostunrz%rz%files -f INSTALLED_FILESz%defattr(-,root,root)z%doc z %changelog)rrrrrr)r{rrr)rrur)rrvN)rrwN)rrxN)rryN)rrzN)'rrZ get_versionreplacerkZget_description subprocessZ getoutputr splitlinesrrrhZ get_licenserjrrgetattrlowerrrZget_urlrirrqrrrrZget_long_descriptionrcrargvropenreadrrorp)rZ spec_fileZ vendor_hookZproblemZfixedZ fixed_hookZfieldvalZdef_setup_callZ def_buildZ install_cmdZscript_optionsZrpm_optattrdefaultrrrrs                   zbdist_rpm._make_spec_filecCs|s|Sg}x`|jjdD]N}|j}|ddkrD|jd|gq|ddkr\|j|q|jd|qW|ds||d=|S)zKFormat the changelog correctly and convert it to a list of strings rrrrrz )rrrr)rrpZ new_changelogrrrrr3s   zbdist_rpm._format_changelog)r Nr )r Nr )rrr)rNr)rNr)rNr)rNr)rNr)rNr)rNr)rNr )r!Nr")r#Nr$)r%Nr&)r'Nr()r)Nr*)r+Nr,)r-Nr.)r/Nr0)r1Nr2)r3Nr4)r5Nr6)r7Nr8)r9Nr:)r;r<r=)r>Nr?)r@NrA)rBNrC)rDNrE)rFNrG)rHNrI)rJNrK)rLNrM)rNNrO)rPNrQ)rRNrS)rTNrU)rVNrW)rXNrY)rZNr[)r\r]r^)__name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsZ negative_optrrrrrrrrrrrr s--)r )__doc__rrrZdistutils.corerZdistutils.debugrZdistutils.utilrZdistutils.file_utilrZdistutils.errorsZdistutils.sysconfigrZ distutilsrr rrrrs      __pycache__/build_ext.cpython-36.pyc000064400000040234147210141470013365 0ustar003 \z@sdZddlZddlZddlZddlZddlmZddlTddlm Z m Z ddlm Z ddl m Z ddlmZdd lmZdd lmZdd lmZejd Zd dZGdddeZdS)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_compilerget_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]*)*$cCsddlm}|dS)Nr)show_compilers)distutils.ccompilerr )r r!/usr/lib64/python3.6/build_ext.pyr s r c@seZdZdZdejZd`dad d d efdcdddefdddedfdddefdgdhdidjdkdldmdndodpgZd d%d(d1d8gZ d:d2d;e fgZ dd?Z d@dAZdBdCZdDdEZdFdGZdHdIZdJdKZdLdMZejdNdOZdPdQZdRdSZdTdUZdVdWZdXdYZdZd[Zd\d]Zd^d_Zd2S)q build_extz8build C/C++ extensions (compile/link to build directory)z (separated by '%s') build-lib=b(directory for compiled extension modules build-temp=t1directory for temporary files (build by-products)z plat-name=pz>platform name to cross-compile for, if supported (default: %s)inplaceiz=ignore build-lib and put compiled extensions into the source z,directory alongside your pure Python modulesz include-dirs=Iz.list of directories to search for header filesdefine=DC preprocessor macros to defineundef=U!C preprocessor macros to undefine libraries=l!external C libraries to link withz library-dirs=Lz.directories to search for external C librariesrpath=R7directories to search for shared C libraries at runtime link-objects=O2extra explicit link objects to include in the linkdebugg'compile/link with debugging informationforcef2forcibly build everything (ignore file timestamps) compiler=cspecify the compiler type parallel=jnumber of parallel build jobsswig-cppN)make SWIG create C++ files (default is C) swig-opts=!list of SWIG command line optionsswig=path to the SWIG executableuser#add user include, library and rpathz help-compilerzlist available compilerscCsd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_d|_dS)Nr) extensions build_lib plat_name build_temprpackage include_dirsdefineundef libraries library_dirsrpath link_objectsr+r.compilerswigswig_cpp swig_optsr=parallel)selfrrrinitialize_optionsjs*zbuild_ext.initialize_optionsc Csddlm}|jdd'd(d)d*d+d,d-|jdkr8|jj|_|jj|_|j}|jd d }|j dkrn|jj pjg|_ t |j t r|j j t j|_ tjtjkr|j jt jjtjd |j j|||kr|j j||jd|jd|jdkrg|_|jdkrg|_nt |jt r&|jj t j|_|jdkr:g|_nt |jt rX|jj t j|_t jdkrT|jjt jjtjdtjtjkr|jjt jjtjd|jrt jj|jd|_nt jj|jd|_|j jt jjtttdd}|r|jj||j dkrd}n|j dd}t jjtjd}|rHt jj||}|jj|tj!dddks|tj!dddkrtj"j#t jjtjdr|jjt jjtjddt$dn |jjd|j%d r|j&s|jj|j%d!n |jjd|j'r|j'j d"}d#d$|D|_'|j(r4|j(j d"|_(|j)dkrHg|_)n|j)j d%|_)|j*rt jjt+d }t jjt+d} t jj,|r|j j|t jj,| r|jj| |jj| t |j-t ryt.|j-|_-Wnt/k rt0d&YnXdS).Nr) sysconfigZbuildr@rBrKr+r.rOrA)Z plat_specificincluderGrJntZlibsZDebugZRelease_homewin32ZPCbuildcygwinatheosbinlibpythonconfig.Py_ENABLE_SHAREDLIBDIR,cSsg|] }|dfqS)1r).0Zsymbolrrr sz.build_ext.finalize_options.. zparallel should be an integer)r@r@)rBrB)rKrK)r+r+)r.r.)rOrO)rArA)1 distutilsrRZset_undefined_optionsrC distributionZ ext_packageZ ext_modulesr?Zget_python_incrD isinstancestrsplitospathsepsys exec_prefixbase_exec_prefixappendpathjoinZensure_string_listrGrHrInameprefixr+rBdirnamergetattrrAplatform executable startswithrget_config_varZ python_buildrErFrNr=r isdirrOint ValueErrorZDistutilsOptionError) rPrRZ py_includeZplat_py_include _sys_homesuffixZnew_libZdefinesZ user_includeZuser_librrrfinalize_optionss                    (         zbuild_ext.finalize_optionscCstddlm}|jsdS|jjrL|jd}|jj|jp:g|j j |j ||j |j |j|jd|_ t|j tjdkr|jtkr|j j|j|jdk r|j j|j|jdk rx |jD]\}}|j j||qW|jdk rx|jD]}|j j|qW|jdk r|j j|j|j dk r4|j j|j |jdk rN|j j|j|j dk rh|j j!|j |j"dS)Nr) new_compiler build_clib)rKverbosedry_runr.rU)#r rr?riZhas_c_librariesget_finalized_commandrGextendZget_library_namesrHrrrrKrrr.rrmrurAr Z initializerDZset_include_dirsrEZ define_macrorFZundefine_macroZ set_librariesZset_library_dirsrIZset_runtime_library_dirsrJZset_link_objectsbuild_extensions)rPrrruvaluemacrorrrruns>             z build_ext.runc Cst|tstdxnt|D]`\}}t|tr4qt|t sLt|dkrTtd|\}}tjd|t|t ozt j |stdt|t stdt||d}x*dD]"}|j |}|dk rt|||qW|j d|_d|krtjd|j d}|rxg|_g|_xj|D]b} t| to,t| dks8tdt| dkrX|jj| dnt| dkr|jj| qW|||<qWdS)aEnsure 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 instanceszMeach 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)sourcesrDrHrG extra_objectsextra_compile_argsextra_link_argsNrIZdef_filez9'def_file' element of build info dict no longer supportedmacrosrSz9'macros' element of build info dict must be 1- or 2-tupler)rDrHrGrrr)rSr)rjlistDistutilsSetupError enumeratertuplelenr warnrkextension_name_rematchdictgetsetattrruntime_library_dirs define_macros undef_macrosrr) rPr?rextext_nameZ build_infokeyvalrrrrrcheck_extensions_listUsT           zbuild_ext.check_extensions_listcCs0|j|jg}x|jD]}|j|jqW|S)N)rr?rr)rP filenamesrrrrget_source_filess   zbuild_ext.get_source_filescCs6|j|jg}x |jD]}|j|j|jqW|S)N)rr?rrget_ext_fullpathru)rPZoutputsrrrr get_outputss   zbuild_ext.get_outputscCs(|j|j|jr|jn|jdS)N)rr?rO_build_extensions_parallel_build_extensions_serial)rPrrrrs  zbuild_ext.build_extensionscsj}jdkrtj}yddlm}Wntk r@d}YnX|dkrVjdS||dTfddjD}x6tj|D]&\}}j ||j WdQRXqWWdQRXdS)NTr)ThreadPoolExecutor) max_workerscsg|]}jj|qSr)Zsubmitbuild_extension)rer)executorrPrrrfsz8build_ext._build_extensions_parallel..) rOrm cpu_countconcurrent.futuresr ImportErrorrr?zip_filter_build_errorsresult)rPworkersrZfuturesrZfutr)rrPrrs       z$build_ext._build_extensions_parallelc Cs4x.|jD]$}|j||j|WdQRXqWdS)N)r?rr)rPrrrrrs  z"build_ext._build_extensions_serialccsTy dVWnDtttfk rN}z"|js*|jd|j|fWYdd}~XnXdS)Nz"building extension "%s" failed: %s)ZCCompilerErrorZDistutilsErrorZ CompileErrorZoptionalrru)rPrerrrrs zbuild_ext._filter_build_errorsc CsX|j}|dkst|ttf r,td|jt|}|j|j}||j}|jpZt ||dsnt j d|jdSt j d|j|j ||}|jpg}|jdd}x|jD]}|j|fqW|jj||j||j|j ||jd}|dd|_|jr|j|j|jp g}|jp|jj|} |jj|||j||j|j||j ||j |j| d dS)Nzjin 'ext_modules' option (extension '%s'), 'sources' must be present and must be a list of source filenamesZnewerz$skipping '%s' extension (up-to-date)zbuilding '%s' extension)Z output_dirrrDr+extra_postargsdepends)rGrHrrexport_symbolsr+rBZ target_lang)!rrjrrrrurrr.rr r+info swig_sourcesrrrrrrKcompilerBrDZ_built_objectsrrrlanguageZdetect_languageZlink_shared_object get_librariesrHrget_export_symbols) rPrrext_pathrZ extra_argsrrFZobjectsrrrrrsN         zbuild_ext.build_extensioncCs2g}g}i}|jrtjd|js6d|jks6d|jkr        zbuild_ext.swig_sourcescCs`tjdkrdStjdkrNxBd D]&}tjjd|d}tjj|r|SqWdSntd tjd S) 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. posixrLrU1.31.21.1z c:\swig%szswig.exez>I don't know how to find (much less run) SWIG on platform '%s'N)rrr)rmrursrtisfileZDistutilsPlatformError)rPZversfnrrrrfs    zbuild_ext.find_swigcCs|j|}|jd}|j|d}|jsRtjj|dd|g}tjj|j|Sdj|dd}|jd}tjj |j |}tjj||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). r`rSNrbuild_pyrrr) get_ext_fullnamerlget_ext_filenamerrmrsrtr@rabspathZget_package_dir)rPrfullnameZmodpathfilenamerCrZ package_dirrrrr~s   zbuild_ext.get_ext_fullpathcCs |jdkr|S|jd|SdS)zSReturns the fullname of a given extension name. Adds the `package.` prefixNr`)rC)rPrrrrrs zbuild_ext.get_ext_fullnamecCs.ddlm}|jd}|d}tjj||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)r|r` EXT_SUFFIX)distutils.sysconfigr|rlrmrsrt)rPrr|rZ ext_suffixrrrrs  zbuild_ext.get_ext_filenamecCs0d|jjdd}||jkr*|jj||jS)aReturn 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. ZPyInit_r`rSr)rurlrrr)rPrZ initfunc_namerrrrs  zbuild_ext.get_export_symbolscCstjdkrfddlm}t|j|s\d}|jr4|d}|tjd?tjd?d@f}|j|gS|jSnRtjd d d krd }|tjd?tjd?d@f}|j|gStjd d d kr>ddl m }d }|tjd?tjd?d@f}g}xB|j dj D]0}|j dr|j|dd n |j|qW|j|dg|StjdkrP|jStjd ddkrj|jSddl m }|j drdjtjd?tjd?d@|j d}|j|gS|jSd 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). rWr) MSVCCompilerz python%d%dZ_dNrYrZz python%d.%dr[)rRSHLIBSz-lrmdarwinaixraz python{}.{}{}ABIFLAGS)roryZdistutils._msvccompilerrrjrKr+ hexversionrGrhrRr|rlr{rrformat)rPrrtemplateZ pythonlibrRZextrar]rrrrsJ             zbuild_ext.get_libraries)rrr)rrriignore build-lib and put compiled extensions into the source directory alongside your pure Python modules)rrr)rrr)rrr )r!r"r#)r%r&r')r(r)r*)r+r,r-)r.r/r0)r1r2r3)r4r5r6)r7Nr8)r9Nr:)r;Nr<)r=Nr>) __name__ __module__ __qualname__ descriptionrmrnZsep_byr Z user_optionsZboolean_optionsr Z help_optionsrQrrrrrrrr contextlibcontextmanagerrrrrrrrrrrrrrr!s  @N  K6   r)__doc__rrmreroZdistutils.corerZdistutils.errorsrrrrZdistutils.dep_utilrZdistutils.extensionrZdistutils.utilr rhr Zsiter rrr rrrrrs"       __pycache__/sdist.cpython-36.pyc000064400000031443147210141470012536 0ustar003 \E@sdZddlZddlZddlTddlmZddlmZddlmZddl m Z m Z m Z m Z ddlmZddlTdd lmZdd l mZdd lmZd d ZGdddeZdS)zadistutils.command.sdist Implements the Distutils 'sdist' command (create a source distribution).N)*)glob)warn)Command)dir_utildep_util file_util archive_util)TextFile)FileList)log) convert_pathcCsdddlm}ddlm}g}x,|jD] }|jd|d||dfq&W|j||jddS)zoPrint all possible values for the 'formats' option (used by the "--help-formats" command-line option). r) FancyGetopt)ARCHIVE_FORMATSzformats=Nz.List of available source distribution formats:)Zdistutils.fancy_getoptrZdistutils.archive_utilrkeysappendsortZ print_help)rrformatsformatr/usr/lib64/python3.6/sdist.py show_formatss   rc@seZdZdZddZdJdKdLdMdNdOdPdQdRdTdUdVdWdXgZd ddddd"gZd*d d+efgZd dd,Z d-efgZ d.d/Z d0d1Z d2d3Z d4d5Zd6d7Zd8d9Zd:d;Zdd?Zd@dAZdBdCZdDdEZdFdGZdHdIZd S)Ysdistz6create a source distribution (tarball, zip file, etc.)cCs|jS)zYCallable used for the check sub-command. Placed here so user_options can view it)metadata_check)selfrrrchecking_metadata%szsdist.checking_metadata template=t5name of manifest template file [default: MANIFEST.in] manifest=m)name of manifest file [default: MANIFEST] use-defaultsNRinclude the default file set in the manifest [default; disable with --no-defaults] no-defaults"don't include the default file setprunespecifically exclude files/directories that should not be distributed (build tree, RCS/CVS dirs, etc.) [default; disable with --no-prune]no-prune$don't automatically exclude anything manifest-onlyoEjust regenerate the manifest and then stop (implies --force-manifest)force-manifestfkforcibly regenerate the manifest and carry on as usual. Deprecated: now the manifest is always regenerated.formats=6formats for source distribution (comma-separated list) keep-tempkz1keep the distribution tree around after creating zarchive file(s) dist-dir=dFdirectory to put the source distribution archive(s) in [default: dist]metadata-check[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=gAGroup name used when creating a tar file [default: current group]z help-formatsz#list available distribution formats)z no-defaultszno-prunecheckcCsTd|_d|_d|_d|_d|_d|_dg|_d|_d|_d|_ d|_ d|_ d|_ dS)NrZgztar) templatemanifest use_defaultsr' manifest_onlyZforce_manifestr keep_tempdist_dir archive_filesrownergroup)rrrrinitialize_options`szsdist.initialize_optionscCsZ|jdkrd|_|jdkr d|_|jdtj|j}|rFtd||jdkrVd|_dS)NZMANIFESTz MANIFEST.inrzunknown archive format '%s'Zdist)rCrBZensure_string_listr Zcheck_archive_formatsrZDistutilsOptionErrorrG)rZ bad_formatrrrfinalize_optionsws      zsdist.finalize_optionscCsBt|_x|jD]}|j|qW|j|jr6dS|jdS)N)r filelistZget_sub_commandsZ run_command get_file_listrEmake_distribution)rZcmd_namerrrrunsz sdist.runcCs*tdt|jjd}|j|jdS)zDeprecated API.zadistutils.command.sdist.check_metadata is deprecated, use the check command insteadr@N)rPendingDeprecationWarning distributionZget_command_objZensure_finalizedrP)rr@rrrcheck_metadatas  zsdist.check_metadatacCstjj|j}| r<|jr<|j|jj|jjdS|sP|j d|j|jj |j rh|j |rt|j |jr|j|jj|jj|jdS)aCFigure 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 z(using default file list)z?manifest template '%s' does not exist (using default file list))ospathisfilerB_manifest_is_not_generated read_manifestrMrZremove_duplicatesrfindallrD add_defaults read_templater'prune_file_listwrite_manifest)rZtemplate_existsrrrrNs(      zsdist.get_file_listcCs2d|jjg}x|D]}t|trn|}d}x*|D]"}tjj|r.d}|jj|Pq.W|s|j ddj |qtjj|r|jj|q|j d|qWdd g}x*|D]"}t tjj t |}|jj|qW|jd }|jjr|jj|jx>|jD]4\} } } } x$| D]} |jjtjj | | q WqW|jjrx||jjD]p}t|tr|t|}tjj |r|jj|n:|\}} x0| D](}t|}tjj |r|jj|qWqHW|jjr|jd }|jj|j|jjr|jd }|jj|j|jjr.|jd }|jj|jdS)a9Add 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. README README.txtFTz,standard file not found: should have one of z, zstandard file '%s' not foundz test/test*.pyz setup.cfgbuild_py build_ext build_clib build_scriptsN)r^r_)rRZ script_name isinstancetuplerTrUexistsrMrrjoinfilterrVrextendget_finalized_commandZhas_pure_modulesZget_source_filesZ data_filesZhas_data_filesstrr Zhas_ext_modulesZhas_c_librariesZ has_scripts)rZ standardsfnZaltsZgot_itZoptionalpatternfilesr`ZpkgZsrc_dirZ build_dir filenamesfilenameitemdirnamer/rarbrcrrrrZs\           "         zsdist.add_defaultscCstjd|jt|jddddddd}zlxf|j}|dkrr?)__name__ __module__ __qualname__ descriptionrZ user_optionsZboolean_optionsrZ help_optionsZ negative_optZ sub_commandsrKrLrPrSrNrZr[r\r]rWrXrrOrrrrrr!sj  (P *r)__doc__rTr~typesrwarningsrZdistutils.corerZ distutilsrrrr Zdistutils.text_filer Zdistutils.errorsZdistutils.filelistr r Zdistutils.utilr rrrrrrs       __pycache__/sdist.cpython-36.opt-1.pyc000064400000031443147210141470013475 0ustar003 \E@sdZddlZddlZddlTddlmZddlmZddlmZddl m Z m Z m Z m Z ddlmZddlTdd lmZdd l mZdd lmZd d ZGdddeZdS)zadistutils.command.sdist Implements the Distutils 'sdist' command (create a source distribution).N)*)glob)warn)Command)dir_utildep_util file_util archive_util)TextFile)FileList)log) convert_pathcCsdddlm}ddlm}g}x,|jD] }|jd|d||dfq&W|j||jddS)zoPrint all possible values for the 'formats' option (used by the "--help-formats" command-line option). r) FancyGetopt)ARCHIVE_FORMATSzformats=Nz.List of available source distribution formats:)Zdistutils.fancy_getoptrZdistutils.archive_utilrkeysappendsortZ print_help)rrformatsformatr/usr/lib64/python3.6/sdist.py show_formatss   rc@seZdZdZddZdJdKdLdMdNdOdPdQdRdTdUdVdWdXgZd ddddd"gZd*d d+efgZd dd,Z d-efgZ d.d/Z d0d1Z d2d3Z d4d5Zd6d7Zd8d9Zd:d;Zdd?Zd@dAZdBdCZdDdEZdFdGZdHdIZd S)Ysdistz6create a source distribution (tarball, zip file, etc.)cCs|jS)zYCallable used for the check sub-command. Placed here so user_options can view it)metadata_check)selfrrrchecking_metadata%szsdist.checking_metadata template=t5name of manifest template file [default: MANIFEST.in] manifest=m)name of manifest file [default: MANIFEST] use-defaultsNRinclude the default file set in the manifest [default; disable with --no-defaults] no-defaults"don't include the default file setprunespecifically exclude files/directories that should not be distributed (build tree, RCS/CVS dirs, etc.) [default; disable with --no-prune]no-prune$don't automatically exclude anything manifest-onlyoEjust regenerate the manifest and then stop (implies --force-manifest)force-manifestfkforcibly regenerate the manifest and carry on as usual. Deprecated: now the manifest is always regenerated.formats=6formats for source distribution (comma-separated list) keep-tempkz1keep the distribution tree around after creating zarchive file(s) dist-dir=dFdirectory to put the source distribution archive(s) in [default: dist]metadata-check[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=gAGroup name used when creating a tar file [default: current group]z help-formatsz#list available distribution formats)z no-defaultszno-prunecheckcCsTd|_d|_d|_d|_d|_d|_dg|_d|_d|_d|_ d|_ d|_ d|_ dS)NrZgztar) templatemanifest use_defaultsr' manifest_onlyZforce_manifestr keep_tempdist_dir archive_filesrownergroup)rrrrinitialize_options`szsdist.initialize_optionscCsZ|jdkrd|_|jdkr d|_|jdtj|j}|rFtd||jdkrVd|_dS)NZMANIFESTz MANIFEST.inrzunknown archive format '%s'Zdist)rCrBZensure_string_listr Zcheck_archive_formatsrZDistutilsOptionErrorrG)rZ bad_formatrrrfinalize_optionsws      zsdist.finalize_optionscCsBt|_x|jD]}|j|qW|j|jr6dS|jdS)N)r filelistZget_sub_commandsZ run_command get_file_listrEmake_distribution)rZcmd_namerrrrunsz sdist.runcCs*tdt|jjd}|j|jdS)zDeprecated API.zadistutils.command.sdist.check_metadata is deprecated, use the check command insteadr@N)rPendingDeprecationWarning distributionZget_command_objZensure_finalizedrP)rr@rrrcheck_metadatas  zsdist.check_metadatacCstjj|j}| r<|jr<|j|jj|jjdS|sP|j d|j|jj |j rh|j |rt|j |jr|j|jj|jj|jdS)aCFigure 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 z(using default file list)z?manifest template '%s' does not exist (using default file list))ospathisfilerB_manifest_is_not_generated read_manifestrMrZremove_duplicatesrfindallrD add_defaults read_templater'prune_file_listwrite_manifest)rZtemplate_existsrrrrNs(      zsdist.get_file_listcCs2d|jjg}x|D]}t|trn|}d}x*|D]"}tjj|r.d}|jj|Pq.W|s|j ddj |qtjj|r|jj|q|j d|qWdd g}x*|D]"}t tjj t |}|jj|qW|jd }|jjr|jj|jx>|jD]4\} } } } x$| D]} |jjtjj | | q WqW|jjrx||jjD]p}t|tr|t|}tjj |r|jj|n:|\}} x0| D](}t|}tjj |r|jj|qWqHW|jjr|jd }|jj|j|jjr|jd }|jj|j|jjr.|jd }|jj|jdS)a9Add 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. README README.txtFTz,standard file not found: should have one of z, zstandard file '%s' not foundz test/test*.pyz setup.cfgbuild_py build_ext build_clib build_scriptsN)r^r_)rRZ script_name isinstancetuplerTrUexistsrMrrjoinfilterrVrextendget_finalized_commandZhas_pure_modulesZget_source_filesZ data_filesZhas_data_filesstrr Zhas_ext_modulesZhas_c_librariesZ has_scripts)rZ standardsfnZaltsZgot_itZoptionalpatternfilesr`ZpkgZsrc_dirZ build_dir filenamesfilenameitemdirnamer/rarbrcrrrrZs\           "         zsdist.add_defaultscCstjd|jt|jddddddd}zlxf|j}|dkrr?)__name__ __module__ __qualname__ descriptionrZ user_optionsZboolean_optionsrZ help_optionsZ negative_optZ sub_commandsrKrLrPrSrNrZr[r\r]rWrXrrOrrrrrr!sj  (P *r)__doc__rTr~typesrwarningsrZdistutils.corerZ distutilsrrrr Zdistutils.text_filer Zdistutils.errorsZdistutils.filelistr r Zdistutils.utilr rrrrrrs       __pycache__/test.cpython-36.pyc000064400000017625147210141470012375 0ustar003 K]#@sddlZddlZddlZddlZddlZddlZddlmZmZddl m Z ddlm Z ddl m Z ddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZGd d d e ZGd d d eZGd ddeZ dS)N)DistutilsErrorDistutilsOptionError)log) TestLoader)six)mapfilter) resource_listdirresource_existsnormalize_path working_set_namespace_packagesevaluate_markeradd_activation_listenerrequire EntryPoint)Commandc@seZdZddZdddZdS)ScanningLoadercCstj|t|_dS)N)r__init__set_visited)selfr/usr/lib/python3.6/test.pyrs zScanningLoader.__init__NcCs||jkrdS|jj|g}|jtj||t|drH|j|jt|drxpt|jdD]`}|j dr|dkr|jd|dd }n"t |j|d r`|jd|}nq`|j|j |q`Wt |d kr|j |S|d SdS) aReturn a suite of all tests cases contained in the given module If the module is a package, load tests from all the modules in it. If the module has an ``additional_tests`` function, call it and add the return value to the tests. Nadditional_tests__path__z.pyz __init__.py.z /__init__.pyr)raddappendrloadTestsFromModulehasattrrr __name__endswithr ZloadTestsFromNamelenZ suiteClass)rmodulepatternZtestsfileZ submodulerrrr#s$      z"ScanningLoader.loadTestsFromModule)N)r% __module__ __qualname__rr#rrrrrsrc@seZdZddZdddZdS)NonDataPropertycCs ||_dS)N)fget)rr.rrrr>szNonDataProperty.__init__NcCs|dkr |S|j|S)N)r.)robjZobjtyperrr__get__AszNonDataProperty.__get__)N)r%r+r,rr0rrrrr-=sr-c@seZdZdZdZd%d&d'gZd d ZddZeddZ ddZ ddZ e j gfddZee j ddZeddZddZddZed d!Zed"d#Zd$S)(testz.Command to run unit tests after in-place buildz#run unit tests after in-place build test-module=m$Run 'test_suite' in specified module test-suite=s9Run single test, case or suite (e.g. 'module.test_suite') test-runner=rTest runner to usecCsd|_d|_d|_d|_dS)N) test_suite test_module test_loader test_runner)rrrrinitialize_optionsSsztest.initialize_optionscCs|jr|jrd}t||jdkrD|jdkr8|jj|_n |jd|_|jdkr^t|jdd|_|jdkrnd|_|jdkrt|jdd|_dS)Nz1You may specify a module or a suite, but not bothz .test_suiter=z&setuptools.command.test:ScanningLoaderr>)r;r<r distributionr=getattrr>)rmsgrrrfinalize_optionsYs        ztest.finalize_optionscCs t|jS)N)list _test_args)rrrr test_argslsztest.test_argsccs6|j rtjdkrdV|jr$dV|jr2|jVdS)NZdiscoverz --verbose)rGrH)r;sys version_infoverbose)rrrrrEps ztest._test_argsc Cs|j |WdQRXdS)zI Backward compatibility for project_on_sys_path context. N)project_on_sys_path)rfuncrrrwith_project_on_sys_pathxs ztest.with_project_on_sys_pathc csPtjot|jdd}|rv|jddd|jd|jd}t|j}|jd|d|jd|jddd|jdn"|jd|jdd d|jd|jd}t j dd}t j j }zbt|j }t j jd|tjtd d td |j|jf|j|g dVWdQRXWd|t j dd<t j jt j j|tjXdS) Nuse_2to3FZbuild_pyr)ZinplaceZegg_info)egg_baseZ build_extrcSs|jS)N)Zactivate)distrrrsz*test.project_on_sys_path..z%s==%s)rPY3rAr@Zreinitialize_commandZ run_commandZget_finalized_commandr Z build_librIpathmodulescopyrPinsertr rrrZegg_nameZ egg_versionpaths_on_pythonpathclearupdate) rZ include_distsZ with_2to3Zbpy_cmdZ build_pathZei_cmdZold_pathZ old_modulesZ project_pathrrrrLs8             ztest.project_on_sys_pathc cst}tjjd|}tjjdd}z>tjj|}td||g}tjj|}|rX|tjd<dVWd||krztjjddn |tjd<XdS)z Add the indicated paths to the head of the PYTHONPATH environment variable so that subprocesses will also see the packages at these paths. Do this in a context that restores the value on exit. PYTHONPATHrN)objectosenvirongetpathsepjoinrpop)pathsZnothingZorig_pythonpathZcurrent_pythonpathprefixZto_joinnew_pathrrrrXs     ztest.paths_on_pythonpathcCsD|j|j}|j|jpg}|jdd|jjD}tj|||S)z Install the requirements indicated by self.distribution and return an iterable of the dists that were built. css0|](\}}|jdrt|ddr|VqdS):rN) startswithr).0kvrrr sz%test.install_dists..)Zfetch_build_eggsZinstall_requiresZ tests_requireZextras_requireitems itertoolschain)rQZir_dZtr_dZer_drrr install_distss  ztest.install_distscCs|j|j}dj|j}|jr0|jd|dS|jd|ttjd|}|j |"|j |j WdQRXWdQRXdS)N zskipping "%s" (dry run)z running "%s"location) ror@ra_argvZdry_runannounceroperator attrgetterrXrL run_tests)rZinstalled_distscmdrcrrrruns    ztest.runcCstjrt|jddr|jjdd}|tkrg}|tjkrD|j ||d7}x"tjD]}|j |rT|j |qTWt t tjj |tjdd|j|j|j|j|jdd}|jjsd|j}|j|tjt|dS)NrOFrr)Z testLoaderZ testRunnerexitzTest failed: %s)rrSrAr@r;splitr rIrUr"rgrDr __delitem__unittestmainrr_resolve_as_epr=r>resultZ wasSuccessfulrsrZERRORr)rr(Z del_modulesnamer1rBrrrrvs(        ztest.run_testscCs dg|jS)Nr|)rF)rrrrrrsz test._argvcCs$|dkr dStjd|}|jS)zu Load the indicated attribute value, called, as a as if it were specified as an entry point. Nzx=)rparseZresolve)valZparsedrrrr~sztest._resolve_as_epN)r2r3r4)r5r6r7)r8r9r:)r%r+r,__doc__ descriptionZ user_optionsr?rCr-rFrErN contextlibcontextmanagerrL staticmethodrXrorxrvpropertyrrr~rrrrr1Gs( -  r1)!r]rtrIrrmr|Zdistutils.errorsrrZ distutilsrrZsetuptools.externrZsetuptools.extern.six.movesrrZ pkg_resourcesr r r r r rrrrZ setuptoolsrrr\r-r1rrrrs   , ) __pycache__/install_egg_info.cpython-36.pyc000064400000005627147210141470014720 0ustar003 \+ @sddZddlmZddlmZmZddlZddlZddlZGdddeZ ddZ d d Z d d Z dS) zdistutils.command.install_egg_info Implements the Distutils 'install_egg_info' command, for installing a package's PKG-INFO metadata.)Command)logdir_utilNc@s:eZdZdZdZdgZddZdd Zd d Zd d Z dS)install_egg_infoz)Install an .egg-info file for the packagez8Install package's PKG-INFO metadata as an .egg-info file install-dir=ddirectory to install tocCs d|_dS)N) install_dir)selfr (/usr/lib64/python3.6/install_egg_info.pyinitialize_optionssz#install_egg_info.initialize_optionscCsb|jdddtt|jjtt|jjftjdd}t j j |j ||_ |j g|_dS)NZ install_libr z%s-%s-py%d.%d.egg-info)r r )Zset_undefined_options to_filename safe_name distributionZget_name safe_versionZ get_versionsys version_infoospathjoinr targetoutputs)r basenamer r r finalize_optionss z!install_egg_info.finalize_optionsc Cs|j}tjj|r2tjj| r2tj||jdnNtjj|rX|j tj |jfd|n(tjj|j s|j tj |j fd|j t jd||jst|ddd}|jjj|WdQRXdS)N)dry_runz Removing z Creating z Writing %swzUTF-8)encoding)rrrisdirislinkrZ remove_treerexistsZexecuteunlinkr makedirsrinfoopenrZmetadataZwrite_pkg_file)r rfr r r run s   zinstall_egg_info.runcCs|jS)N)r)r r r r get_outputs.szinstall_egg_info.get_outputsN)rrr) __name__ __module__ __qualname____doc__ descriptionZ user_optionsr rr'r(r r r r r s rcCstjdd|S)zConvert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. z[^A-Za-z0-9.]+-)resub)namer r r r6srcCs|jdd}tjdd|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.  .z[^A-Za-z0-9.]+r.)replacer/r0)versionr r r r>s rcCs |jddS)z|Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'. r._)r4)r1r r r rHsr) r,Z distutils.cmdrZ distutilsrrrrr/rrrrr r r r s + __pycache__/easy_install.cpython-36.opt-1.pyc000064400000176606147210141470015051 0ustar003 K]T @sdZddlmZddlmZddlmZmZddlmZmZm Z m Z ddl m Z m Z ddlmZmZddlmZdd lmZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd l Z dd l!Z!dd l"Z"dd l#Z#dd l$Z$dd l%Z%dd l&m'Z'dd l(m)Z)m*Z*dd l+m,Z,ddl-m.Z.ddl/m0Z0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9m:Z:m;Z;ddl4mm?Z?ddl@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOdd lPZ@ejQde@jRdddddddgZSdd ZTd!dZUe'jVr2d"d#ZWd$d%ZXnd&d#ZWd'd%ZXd(d)ZYGd*dde,ZZd+d,Z[d-d.Z\d/d0Z]d1dZ^d2dZ_Gd3ddeGZ`Gd4d5d5e`Zaejbjcd6d7d8kreaZ`d9d:Zdd;d<Zed=d>Zfd?d@ZgdpdAdBZhdCdDZidEdFZjdGejkkrejZlndHdIZldqdKdLZmdMdNZndOdPZodQdRZpyddSlmqZrWnesk r^dTdUZrYnXdVdWZqGdXdYdYetZueujvZwGdZd[d[euZxGd\d]d]eyZzGd^d_d_ezZ{Gd`dadae{Z|ezj}Z}ezj~Z~dbdcZdddeZdfeefdgdhZdidjZdkdlZdrdmdZe"jdndoZd S)sa% Easy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ https://setuptools.readthedocs.io/en/latest/easy_install.html )glob) get_platform) convert_path subst_vars)DistutilsArgErrorDistutilsOptionErrorDistutilsErrorDistutilsPlatformError)INSTALL_SCHEMES SCHEME_KEYS)logdir_util) first_line_re)find_executableN)six) configparsermap)Command) run_setup)get_pathget_config_vars) rmtree_safe)setopt)unpack_archive) PackageIndexparse_requirement_arg URL_SCHEME) bdist_eggegg_info)Wheel) yield_linesnormalize_pathresource_stringensure_directoryget_distributionfind_distributions Environment Requirement Distribution PathMetadata EggMetadata WorkingSetDistributionNotFoundVersionConflict DEVELOP_DISTdefault)categorysamefile easy_installPthDistributionsextract_wininst_cfgmainget_exe_prefixescCstjddkS)NP)structcalcsizer;r;"/usr/lib/python3.6/easy_install.pyis_64bitIsr=cCsjtjj|otjj|}ttjdo&|}|r:tjj||Stjjtjj|}tjjtjj|}||kS)z Determine if two paths reference the same file. Augments os.path.samefile to work on Windows and suppresses errors if the path doesn't exist. r1)ospathexistshasattrr1normpathnormcase)Zp1Zp2Z both_existZ use_samefileZnorm_p1Znorm_p2r;r;r<r1MscCs|S)Nr;)sr;r;r< _to_ascii_srEc Cs*ytj|ddStk r$dSXdS)NasciiTF)rZ text_type UnicodeError)rDr;r;r<isasciibs  rHcCs |jdS)NrF)encode)rDr;r;r<rEjsc Cs(y|jddStk r"dSXdS)NrFTF)rIrG)rDr;r;r<rHms  cCstj|jjddS)N z; )textwrapdedentstripreplace)textr;r;r<usrPc@seZdZdZdZdZdddddddddddddddddddddgZdd dd dd0d3d9ddddZ?ejdj Z@ddZAddZBddZCddZDddZEddZFddZGddZHejdj ZIddZJddZKddZLeMeMddddZNeMdddZOddZPdS)r2z'Manage a download/build/install processz Find/get/install Python packagesTprefix=Ninstallation prefixzip-okzinstall package as a zipfile multi-versionm%make apps have to require() a versionupgradeU1force upgrade (searches PyPI for latest versions) install-dir=dinstall package to DIR script-dir=rDinstall scripts to DIRexclude-scriptsxDon't install scripts always-copya'Copy all needed packages to install dir index-url=i base URL of Python Package Index find-links=f(additional URL(s) to search for packagesbuild-directory=b/download/extract/build in DIR; keep the results optimize=Olalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]record=3filename in which to record list of installed files always-unzipZ*don't install as a zipfile, no matter what site-dirs=S)list of directories where .pth files workeditablee+Install specified packages in editable formno-depsNdon't install dependencies allow-hosts=H$pattern(s) that hostnames must matchlocal-snapshots-okl(allow building eggs from local checkoutsversion"print version information and exit no-find-links9Don't load find-links defined in packages being installedz!install in user site-package '%s'usercCs,d|_d|_|_d|_|_|_d|_d|_d|_d|_ d|_ |_ d|_ |_ |_d|_|_|_d|_|_|_d|_d|_d|_d|_d|_d|_d|_d|_d|_tjrtj |_!tj"|_#n d|_!d|_#d|_$d|_%d|_&|_'d|_(i|_)d|_*d|_+|j,j-|_-|j,j.||j,j/ddS)NrFr2)0rzip_oklocal_snapshots_ok install_dir script_direxclude_scripts index_url find_linksbuild_directoryargsoptimizerecordrY always_copy multi_versionr{no_deps allow_hostsrootprefix no_reportrinstall_purelibinstall_platlibinstall_headers install_libinstall_scripts install_data install_baseinstall_platbasesiteENABLE_USER_SITE USER_BASEinstall_userbase USER_SITEinstall_usersite no_find_links package_indexpth_filealways_copy_from site_dirsinstalled_projectssitepy_installedZ_dry_run distributionverboseZ_set_command_optionsget_option_dict)selfr;r;r<initialize_optionssF     zeasy_install.initialize_optionscCs"dd|D}tt|j|dS)Ncss*|]"}tjj|stjj|r|VqdS)N)r>r?r@islink).0filenamer;r;r< sz/easy_install.delete_blockers..)listr _delete_path)rblockersZextant_blockersr;r;r<delete_blockersszeasy_install.delete_blockerscCsJtjd||jrdStjj|o.tjj| }|r8tntj}||dS)Nz Deleting %s) r infodry_runr>r?isdirrrmtreeunlink)rr?Zis_treeZremoverr;r;r<rs  zeasy_install._delete_pathcCs6tjdd}td}d}t|jfttdS)zT Render the Setuptools version and installation details, then exit. N setuptoolsz=setuptools {dist.version} from {dist.location} (Python {ver}))sysrr$printformatlocals SystemExit)Zverdisttmplr;r;r<_render_versions zeasy_install._render_versionc Cst|jo |jtjjd}tdd\}}|jj|jj|jj||dd|d|d||||t tddd |_ t j r|j |j d <|j|j d <|j|j|j|jd d d d|jdkr|j|_|jdkrd|_|jdd!|jdd"|jr|jr|j|_|j|_|jdd#tttj}t|_|jdk rdd|jjdD}xV|D]N}t jj!|s~t"j#d|n,t||krt$|dn|jj%t|q^W|j&s|j'|j(pd|_(|jdd|_)x4|jt|jfD] }||j)kr|j)j*d|qW|j+dk r8dd|j+jdD}ndg}|j,dkr`|j-|j(|j)|d|_,t.|j)tj|_/|j0dk rt1|j0t2j3r|j0j|_0ng|_0|j4r|j,j5|j)tj|js|j,j6|j0|jdd$t1|j7t8s@y2t8|j7|_7d|j7kodknst9Wnt9k r>t$dYnX|j&rZ|j: rZt;d|j<sjt;d g|_=dS)%Nrr exec_prefixrabiflags) Z dist_nameZ dist_versionZ dist_fullname py_versionpy_version_shortpy_version_nodotZ sys_prefixrZsys_exec_prefixrruserbaseZusersiterrrrFrrinstallrcSsg|]}tjj|jqSr;)r>r? expanduserrM)rrDr;r;r< 3sz1easy_install.finalize_options..,z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.pathzhttps://pypi.org/simple/cSsg|] }|jqSr;)rM)rrDr;r;r<rHs*)Z search_pathhostsrz--optimize must be 0, 1, or 2z9Must specify a build directory (-b) when using --editablez:No urls, filenames, or requirements specified (see --help))rr)rr)rr)rr)>rrrsplitrrZget_nameZ get_versionZ get_fullnamegetattr config_varsrrrr_fix_install_dir_for_user_siteexpand_basedirs expand_dirs_expandrrrZset_undefined_optionsrrrrr!r? get_site_dirs all_site_dirsrr>rr warnrappendr{check_site_dirr shadow_pathinsertrr create_indexr& local_indexr isinstancerZ string_typesrZscan_egg_linksadd_find_linksrint ValueErrorrrroutputs) rrrrrBrr]Z path_itemrr;r;r<finalize_optionss                zeasy_install.finalize_optionscCs`|j stj rdS|j|jdkr2d}t||j|_|_tj j ddd}|j |dS)z; Fix the install_dir if "--user" was used. Nz$User base directory is not specifiedposixZunixZ_user) rrrcreate_home_pathrr rrr>namerN select_scheme)rmsgZ scheme_namer;r;r<rms z+easy_install._fix_install_dir_for_user_sitecCs\xV|D]N}t||}|dk rtjdks0tjdkrrr?rrrsetattr)rattrsattrvalr;r;r< _expand_attrs|s    zeasy_install._expand_attrscCs|jdddgdS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.rrrN)r)rr;r;r<rszeasy_install.expand_basedirscCsddddddg}|j|dS)z+Calls `os.path.expanduser` on install dirs.rrrrrrN)r)rdirsr;r;r<rszeasy_install.expand_dirsc Cs|j|jjkrtj|jzx|jD]}|j||j q$W|jr|j}|j rt |j }x(t t |D]}|||d||<qfWddl m }|j|j|j|fd|j|jWdtj|jjXdS)Nr) file_utilz'writing list of installed files to '%s')rrr set_verbosityrr2rrrrlenrange distutilsrexecuteZ write_filewarn_deprecated_options)rspecrZroot_lenZcounterrr;r;r<runs$       zeasy_install.runc CsDy tj}Wn"tk r.tjdtj}YnXtjj|j d|S)zReturn a pseudo-tempname base in the install directory. This code is intentionally naive; if a malicious party can write to the target directory you're already in deep doodoo. rztest-easy-install-%s) r>getpid ExceptionrandomZrandintrmaxsizer?joinr)rpidr;r;r<pseudo_tempnames  zeasy_install.pseudo_tempnamecCsdS)Nr;)rr;r;r<rsz$easy_install.warn_deprecated_optionscCsdt|j}tjj|d}tjj|sTytj|Wn ttfk rR|j YnX||j k}| rv|j rv|j }nd|j d}tjj|}y*|rtj|t|djtj|Wn ttfk r|j YnX| r|j rt|j|r|jdkrt||j |_nd|_|tttkr6d|_n$|j rZtjj| rZd|_d|_||_dS)z;Verify that self.install_dir is .pth-capable dir, if neededzeasy-install.pthz .write-testwNT)r!rr>r?r r@makedirsOSErrorIOErrorcant_write_to_targetrrcheck_pth_processingrropencloserno_default_version_msgrr3r _pythonpathr)rinstdirrZ is_site_dirZtestfileZ test_existsr;r;r<rs>         zeasy_install.check_site_diraS can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: %s The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s z This directory does not currently exist. Please create it and try again, or choose a different installation directory (using the -d or --install-dir option). a Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://setuptools.readthedocs.io/en/latest/easy_install.html Please make the appropriate changes for your system and try again. cCsP|jtjd|jf}tjj|js6|d|j7}n|d|j7}t |dS)NrJ) _easy_install__cant_write_msgrexc_inforr>r?r@_easy_install__not_exists_id_easy_install__access_msgr)rrr;r;r<rs z!easy_install.cant_write_to_targetc Cs|j}tjd||jd}|d}tjj|}tdd}y8|rNtj|tjj |}t j j |ddt |d}Wn ttfk r|jYnXz|j|jft|jd }tj}tjd krtjj|\}} tjj|d } | jd kotjj| } | r| }d dlm} | |dddgd tjj|rJtjd|dSWd |r\|jtjj|rttj|tjj|rtj|X|jstjd|dS)z@Empirically verify whether .pth files are supported in inst. dirz Checking .pth file support in %sz.pthz.okzz import os f = open({ok_file!r}, 'w') f.write('OK') f.close() rJT)exist_okrNrz pythonw.exez python.exer)spawnz-Ez-cpassz-TEST PASSED: %s appears to support .pth filesz+TEST FAILED: %s does NOT support .pth filesF)rr rrr>r?r@ _one_linerrdirname pkg_resourcesZ py31compatrrrrrwriterrrr executablerrr lowerdistutils.spawnr rr) rrrZok_fileZ ok_existsrr#rkr&basenameZaltZuse_altr r;r;r<rsV            z!easy_install.check_pth_processingcCs\|j rN|jdrNx:|jdD],}|jd|r2q|j|||jd|qW|j|dS)z=Write all the scripts for `dist`, unless scripts are excludedscriptszscripts/N)rZmetadata_isdirZmetadata_listdirinstall_scriptZ get_metadatainstall_wrapper_scripts)rr script_namer;r;r<install_egg_scriptsSsz easy_install.install_egg_scriptscCs\tjj|rLxJtj|D].\}}}x"|D]}|jjtjj||q(WqWn |jj|dS)N)r>r?rwalkrrr )rr?baserfilesrr;r;r< add_outputas    zeasy_install.add_outputcCs|jrtd|fdS)NzjInvalid argument %r: you can't use filenames or URLs with --editable (except via the --find-links option).)r{r)rrr;r;r< not_editableiszeasy_install.not_editablecCs<|js dStjjtjj|j|jr8td|j|jfdS)Nz2%r already exists in %s; can't do a checkout there)r{r>r?r@r rkeyr)rrr;r;r<check_editableqs zeasy_install.check_editablec cs@tjtjdd}zt|VWdtjj|o8tt |XdS)Nz easy_install-)r) tempfilemkdtemprustrr>r?r@rr)rtmpdirr;r;r<_tmpdir{szeasy_install._tmpdirFcCs|js|j|j}t|tst|rT|j||jj||}|j d|||dSt j j |r||j||j d|||dSt |}|j||jj|||j|j|j |j}|dkrd|}|jr|d7}t|n0|jtkr|j|||d|S|j ||j||SWdQRXdS)NTz+Could not find suitable distribution for %rz2 (--always-copy skips system and development eggs)Using)r{install_site_pyr;rr'rr3rdownload install_itemr>r?r@rr5Zfetch_distributionrYrrrZ precedencer.process_distributionlocation)rrdepsr:dlrrr;r;r<r2s2         zeasy_install.easy_installcCs|p|j}|ptjj||k}|p,|jd }|pT|jdk oTtjjt|t|jk}|r| rx$|j|jD]}|j |krnPqnWd}t j dtjj ||r|j |||}x<|D]}|j|||qWn |j|g}|j||d|d|dk rx|D]}||kr|SqWdS)Nz.eggTz Processing %srr<)rr>r?r#endswithrr!r project_namerAr rr) install_eggsr@egg_distribution)rrr>r:rBZinstall_neededrZdistsr;r;r<r?s.         zeasy_install.install_itemcCs@t|}x2tD]*}d|}t||dkrt||||qWdS)z=Sets the install directories by applying the install schemes.Zinstall_N)r r rr)rrschemer4Zattrnamer;r;r<rs  zeasy_install.select_schemecGs|j||jj|||j|jkr2|jj||jj||j|||j|j<tj |j ||f||j dr|j r|jj |jd| r|j rdS|dk r|j|jkrtjd|dS|dks||kr|j}tt|}tj d|ytgj|g|j|j}Wn^tk rB}ztt|WYdd}~Xn0tk rp}zt|jWYdd}~XnX|js|jrx*|D]"}|j|jkr|j|jqWtj d|dS)Nzdependency_links.txtzSkipping dependencies for %szProcessing dependencies for %sz'Finished processing dependencies for %s) update_pthraddrr4remover.rr rinstallation_report has_metadatarrZget_metadata_linesrras_requirementr'r9r+Zresolver2r,rr-Zreportr)rZ requirementrrBrZdistreqZdistrosr|r;r;r<r@sB            z!easy_install.process_distributioncCs2|jdk r|j S|jdr dS|jds.dSdS)Nz not-zip-safeTzzip-safeF)rrM)rrr;r;r< should_unzips   zeasy_install.should_unzipcCstjj|j|j}tjj|r:d}tj||j|j||Stjj|rL|}nRtjj ||krftj |tj |}t |dkrtjj||d}tjj|r|}t |tj|||S)Nz<%r already exists in %s; build directory %s will not be keptrr)r>r?r rr4r@r rrr#rlistdirrr#shutilmove)rr dist_filename setup_basedstrcontentsr;r;r< maybe_moves"       zeasy_install.maybe_movecCs0|jr dSx tjj|D]}|j|qWdS)N)r ScriptWriterbestget_args write_script)rrrr;r;r<r,sz$easy_install.install_wrapper_scriptscCsNt|j}t||}|r8|j|t}tj||}|j|t|ddS)z/Generate a legacy script wrapper and install itrnN) r9rNis_python_script_load_templaterrX get_headerr[rE)rrr- script_textdev_pathrZ is_scriptZbodyr;r;r<r+"s   zeasy_install.install_scriptcCs(d}|r|jdd}td|}|jdS)z There are a couple of template scripts in the package. This function loads one of them and prepares it for use. z script.tmplz.tmplz (dev).tmplrzutf-8)rNr"decode)r`rZ raw_bytesr;r;r<r],s   zeasy_install._load_templatetc sjfdd|Dtjd|jtjjj|}j|jrLdSt }t |tjj |rptj |t |d|}|j|WdQRXt|d|dS)z1Write an executable file to the scripts directorycsg|]}tjjj|qSr;)r>r?r r)rrb)rr;r<r>sz-easy_install.write_script..zInstalling %s script to %sNri)rr rrr>r?r r2r current_umaskr#r@rrr%chmod)rr-rVmodertargetmaskrkr;)rr<r[;s   zeasy_install.write_scriptcCs`|jjdr|j||gS|jjdr8|j||gS|jjdrT|j||gS|}tjj|r|jd rt|||j ntjj |rtjj |}|j |r|j r|dk r|j|||}tjj|d}tjj|s2ttjj|dd}|stdtjj |t|dkr*td tjj ||d }|jrPtj|j||gS|j||SdS) Nz.eggz.exez.whlz.pyzsetup.pyrz"Couldn't find a setup script in %srzMultiple setup scripts in %sr)r'rD install_egg install_exe install_wheelr>r?isfilerunpack_progressrabspath startswithrrWr r@rrrr{r rreport_editablebuild_and_install)rrrSr:rT setup_scriptZsetupsr;r;r<rFOs<   zeasy_install.install_eggscCs>tjj|r"t|tjj|d}nttj|}tj ||dS)NzEGG-INFO)metadata) r>r?rr)r r* zipimport zipimporterr(Z from_filename)regg_pathrrr;r;r<rG{s    zeasy_install.egg_distributionc Cstjj|jtjj|}tjj|}|js2t||j|}t ||s|tjj |rttjj | rtt j ||jdn"tjj|r|jtj|fd|yd}tjj |r|j|rtjd}}n tjd}}nL|j|r|j||jd}}n*d}|j|rtjd}}n tjd}}|j|||f|dtjj|tjj|ft||d Wn$tk rzt|dd YnX|j||j|S) N)rz Removing FZMovingZCopyingZ ExtractingTz %s to %s)fix_zipimporter_caches)r>r?r rr)rmrr#rGr1rrr remove_treer@rrrnrQrRZcopytreerOZmkpathunpack_and_compileZcopy2r#update_dist_cachesr r2)rrur: destinationrZnew_dist_is_zippedrkrWr;r;r<rhsT               zeasy_install.install_eggc sTt|}|dkrtd|td|jdd|jddtd}tjj||jd}||_ |d}tjj|d}tjj|d }t |t |||_ |j ||tjj|st|d } | jd x<|jdD].\} } | d kr| jd | jddj| fqW| jtjj|d|jfddtj|Dtj|||j|jd|j||S)Nz(%s is not a valid distutils Windows .exerrrr)rErplatformz.eggz.tmpzEGG-INFOzPKG-INFOrzMetadata-Version: 1.0 target_versionz%s: %s _-r*csg|]}tjj|dqS)r)r>r?r )rr)rr;r<rsz,easy_install.install_exe..)rr)r4rr(getrr>r?r egg_namerAr#r)Z _provider exe_to_eggr@rr%itemsrNtitlerrrXrZrZ make_zipfilerrrh) rrSr:cfgrruegg_tmpZ _egg_infoZpkg_infrkkvr;)rr<ris<      " zeasy_install.install_exec s>t|ggifdd}t||g}xtD]l}|jjdr>|jd}|d}tj|dd|d<tjj f|}j ||j |tj ||q>W|j tj tjj dtj|xbdD]Z} t| rtjj d| d } tjj| st| d } | jd j t| d | jqWd S)z;Extract a bdist_wininst to the directories an egg would usecs|j}xԈD]\}}|j|r||t|d}|jd}tjjf|}|j}|jdsl|jdrtj |d |d <dtjj |dd<j |n4|jdr|dkrdtjj |dd<j ||SqW|jdst j d |dS) N/z.pydz.dllrrz.pyzSCRIPTS/z.pthzWARNING: can't process %sr)r'rnrrr>r?r rDr strip_modulesplitextrr r)srcrUrDoldnewpartsrC)r native_libsprefixes to_compile top_levelr;r<processs$      z(easy_install.exe_to_egg..processz.pydrrz.pyzEGG-INFOrrz.txtrrJNrrr)rr)r6rr'rDrrrr>r?r rZ write_stub byte_compileZwrite_safety_flagZ analyze_eggrr@rr%r) rrSrrZstubsresrZresourceZpyfilerZtxtrkr;)rrrrrr<rs6           zeasy_install.exe_to_eggc Cst|}tjj|j|j}tjj|}|js6t|tjj |rbtjj | rbt j ||jdn"tjj |r|jtj|fd|z.|j|j|fdtjj|tjj|fWdt|ddX|j||j|S)N)rz Removing zInstalling %s to %sF)rv)rr>r?r rrrmrr#rrr rwr@rrZinstall_as_eggr)r#ryr2rG)rZ wheel_pathr:Zwheelrzr;r;r<rjs,     zeasy_install.install_wheela( Because this distribution was installed --multi-version, before you can import modules from this package in an application, you will need to 'import pkg_resources' and then use a 'require()' call similar to one of these examples, in order to select the desired version: pkg_resources.require("%(name)s") # latest installed version pkg_resources.require("%(name)s==%(version)s") # this exact version pkg_resources.require("%(name)s>=%(version)s") # this version or higher z Note also that the installation directory must be on sys.path at runtime for this to work. (e.g. by being the application's script directory, by being on PYTHONPATH, or by being added to sys.path by your code.) Installedc Cs`d}|jr@|j r@|d|j7}|jtttjkr@|d|j7}|j }|j }|j }d}|t S)z9Helpful installation message for display to package usersz %(what)s %(eggloc)s%(extras)srJr) rr_easy_install__mv_warningrrr!rr?_easy_install__id_warningrArErr) rZreqrZwhatrZegglocrrZextrasr;r;r<rLIsz easy_install.installation_reportaR Extracted editable version of %(spec)s to %(dirname)s If it uses setuptools in its setup script, you can activate it in "development" mode by going to that directory and running:: %(python)s setup.py develop See the setuptools documentation for the "develop" command for more info. cCs"tjj|}tj}d|jtS)NrJ)r>r?r#rr&_easy_install__editable_msgr)rrrqr#pythonr;r;r<robs zeasy_install.report_editablecCstjjdttjjdtt|}|jdkrNd|jd}|jdd|n|jdkrd|jdd|jrv|jdd t j d |t |ddd j |yt ||Wn6tk r}ztd |jdfWYdd}~XnXdS) Nzdistutils.command.bdist_eggzdistutils.command.egg_inforrrrr~z-qz-nz Running %s %s zSetup script exited with %s)rmodules setdefaultrrrrrrr rrr rrrr)rrqrTrrr;r;r<rgs      zeasy_install.run_setupc Csddg}tjdtjj|d}z|jtjj||j||j|||t|g}g}x2|D]*}x$||D]}|j|j |j |qlWq^W| r|j rt j d||St|t j|jXdS)Nrz --dist-dirz egg-dist-tmp-)rdirz+No eggs found in %s (setup script problem?))r6r7r>r?r#_set_fetcher_optionsrrr&rhrArr rrrr) rrqrTrZdist_dirZall_eggsZeggsr4rr;r;r<rp{s$   zeasy_install.build_and_installc Cst|jjdj}d }i}x2|jD]&\}}||kr4q"|d||jdd <q"Wt|d }tjj|d }t j ||d S)a When easy_install is about to run bdist_egg on a source dist, that source dist might have 'setup_requires' directives, requiring additional fetching. Ensure the fetcher options given to easy_install are available to that command as well. r2rrrrrrr}r~)r2z setup.cfgN)rrrrrr) rrcopyrrNdictr>r?r rZ edit_config) rr0Zei_optsZfetch_directivesZ fetch_optionsr4rZsettingsZ cfg_filenamer;r;r<rs  z!easy_install._set_fetcher_optionscCs0|jdkrdSxX|j|jD]H}|js2|j|jkrtjd||jj||j|jkr|jj|jqW|js|j|jjkrtjd|n2tjd||jj ||j|jkr|jj |j|j s,|jj |jdkr,t jj|jd}t jj|rt j|t|d}|j|jj|jd|jdS)Nz&Removing %s from easy-install.pth filez4%s is already the active version in easy-install.pthz"Adding %s to easy-install.pth filerzsetuptools.pthwtrJ)rr4rrAr rrKrpathsrJrrsaver>r?r rrrrr% make_relativer)rrr]rrkr;r;r<rIs4           zeasy_install.update_pthcCstjd|||S)NzUnpacking %s to %s)r debug)rrrUr;r;r<rlszeasy_install.unpack_progresscshggfdd}t|||jjsdx.D]&}tj|tjdBd@}t||q:WdS)Ncs\|jdr"|jd r"j|n|jds6|jdr@j|j||j rX|pZdS)Nz.pyz EGG-INFO/z.dllz.so)rDrnrrlr)rrU)rto_chmodrr;r<pfs    z+easy_install.unpack_and_compile..pfimi)rrrr>statST_MODErd)rrurzrrkrer;)rrrr<rxs   zeasy_install.unpack_and_compilec Csjtjr dSddlm}z@tj|jd||dd|jd|jrT|||jd|jdWdtj|jXdS)Nr)rr)rforcer) rdont_write_bytecodedistutils.utilrr rrrr)rrrr;r;r<rs zeasy_install.byte_compilea bad install directory or PYTHONPATH You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s and your PYTHONPATH environment variable currently contains: %r Here are some of your options for correcting the problem: * You can choose a different installation directory, i.e., one that is on PYTHONPATH or supports .pth files * You can add the installation directory to the PYTHONPATH environment variable. (It must then also be on PYTHONPATH whenever you run Python and want to use the package(s) you are installing.) * You can set up the installation directory to support ".pth" files by using one of the approaches described here: https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations Please make the appropriate changes for your system and try again.cCs|j}||jtjjddfS)N PYTHONPATHr)_easy_install__no_default_msgrr>environr)rtemplater;r;r<rsz#easy_install.no_default_version_msgcCs|jr dStjj|jd}tdd}|jd}d}tjj|rtj d|jt j |}|j }WdQRX|j dstd |||krtjd ||jst|t j |d dd }|j|WdQRX|j|gd |_dS)z8Make sure there's a site.py in the target dir, if neededNzsite.pyrz site-patch.pyzutf-8rzChecking existing site.py in %sz def __boot():z;%s is not a setuptools-generated site.py; please remove it.z Creating %sr)encodingT)rr>r?r rr"rar@r riorreadrnrrrr#r%r)rZsitepysourceZcurrentZstrmr;r;r<r=s,       zeasy_install.install_site_pycCsj|js dSttjjd}xJtj|jD]:\}}|j|r(tjj | r(|j d|tj |dq(WdS)zCreate directories under ~.N~zos.makedirs('%s', 0o700)i) rrr>r?rrZ iteritemsrrnrZ debug_printr)rhomerr?r;r;r<r>szeasy_install.create_home_pathz/$base/lib/python$py_version_short/site-packagesz $base/bin)rr)rz$base/Lib/site-packagesz $base/ScriptscGs|jdj}|jrh|j}|j|d<|jjtj|j}x0|j D]$\}}t ||ddkr@t |||q@Wddl m }xJ|D]B}t ||}|dk rz|||}tjdkrtjj|}t |||qzWdS)Nrr0r)rr)Zget_finalized_commandrrrr rr>rDEFAULT_SCHEMErrrrrr?r)rrrrHrrrr;r;r<rTs         zeasy_install._expand)rQNrR)rSrTrU)rVrWrX)rYrZr[)r\r]r^)r_rDr`)rarbrc)rdrerf)rgrhri)rjrkrl)rmrnro)rprqrr)rsNrt)rurvrw)rxryrz)r{r|r})r~rr)rrr)rrr)rNr)rNr)F)F)T)N)r)Q__name__ __module__ __qualname____doc__ descriptionZcommand_consumes_argumentsZ user_optionsZboolean_optionsrrrZhelp_msgrZ negative_optrrrrr staticmethodrrrrrrrrrrrKrLlstriprrrrrr.r2r3r5 contextlibcontextmanagerr;r2r?rr@rOrWr,r+r]r[rFrGrhrirrjrrrLrrorrprrIrlrxrrrr=rrr rrr;r;r;r<r2xs    0 z   0    ;  $ $ '  ,6-5   %    cCs tjjddjtj}td|S)Nrr)r>rrrpathsepfilter)rr;r;r<rksrc Csg}|jttjg}tjtjkr0|jtjx|D]}|r6tjdkr`|jtjj |ddn\tj dkr|jtjj |ddtj dd dtjj |dd gn|j|tjj |ddgtjd kr6d |kr6tj j d }|r6tjj |ddtj dd d}|j|q6Wtdtdf}x"|D]}||kr |j|q WtjrR|jtjy|jtjWntk rzYnXttt|}|S)z& Return a list of 'site' dirs os2emxriscosZLibz site-packagesrlibrNrz site-pythondarwinzPython.frameworkHOMELibraryPythonpurelibplatlib)rr)extendrrrrrr{r>r?r seprrrrrrrgetsitepackagesAttributeErrorrrr!)sitedirsrrrZhome_spZ lib_pathsZsite_libr;r;r<rpsV            rccsi}x|D]}t|}||kr q d||<tjj|s6q tj|}||fVx|D]}|jds`qP|dkrjqPttjj||}tt |}|j xP|D]H}|j dst|j }||krd||<tjj|sq|tj|fVqWqPWq WdS)zBYield sys.path directories that might contain "old-style" packagesrz.ptheasy-install.pthsetuptools.pthimportN)rr) r!r>r?rrPrDrr rr rrnrstrip)Zinputsseenr#r1rrklinesliner;r;r< expand_pathss4           rc Cs&t|d}z tj|}|dkr$dS|d|d|d}|dkrHdS|j|dtjd|jd\}}}|dkrzdS|j|d|d d d }tj|}y<|j|} | j d d d} | j t j } |j tj| Wntjk rdSX|jd s|jd rdS|S|jXdS)znExtract configuration data from a bdist_wininst .exe Returns a configparser.RawConfigParser, or None rbN  zegg path translations for a given .exe filePURELIB/rPLATLIB/pywin32_system32PLATLIB/SCRIPTS/EGG-INFO/scripts/DATA/lib/site-packagesrrrzPKG-INFOrz .egg-inforNz EGG-INFO/z.pthz -nspkg.pthPURELIBPLATLIB\rz%s/%s/cSsg|]\}}|j|fqSr;)r')rrbyr;r;r<r$sz$get_exe_prefixes..)rr)rr)rr)rr)rr)rr)rZZipFileZinfolistrrrrDrr upperrrZPY3rar rMrNrnrrsortreverse)Z exe_filenamerrTrrrrVZpthr;r;r<r6s>     & c@sTeZdZdZdZffddZddZddZed d Z d d Z d dZ ddZ dS)r3z)A .pth file with Distribution paths in itFcCsp||_ttt||_ttjj|j|_|j t j |gddx(t |j D]}tt|jt|dqNWdS)NT)rrrr!rr>r?r#basedir_loadr&__init__r rrJr%)rrrr?r;r;r<r/szPthDistributions.__init__cCsg|_d}tj|j}tjj|jrt|jd}x|D]}|j drJd}q6|j }|jj ||j s6|j j drxq6t tjj|j|}|jd<tjj| s||kr|jjd|_q6d||<q6W|j|jr| rd|_x&|jo|jdj r |jjqWdS) NFZrtrT#rrr)rrfromkeysrr>r?rkrrrnrrrMr!r rr@popdirtyr)rZ saw_importrrkrr?r;r;r<r8s2        zPthDistributions._loadc Cs|js dStt|j|j}|rtjd|j|j|}dj |d}t j j |jr`t j |jt|jd}|j|WdQRXn(t j j|jrtjd|jt j |jd|_dS)z$Write changed .pth file back to diskNz Saving %srJrzDeleting empty %sF)rrrrrr rr _wrap_linesr r>r?rrrr%r@)rZ rel_pathsrdatarkr;r;r<rWs   zPthDistributions.savecCs|S)Nr;)rr;r;r<rmszPthDistributions._wrap_linescCsN|j|jko$|j|jkp$|jtjk}|r>|jj|jd|_tj||dS)z"Add `dist` to the distribution mapTN) rArrr>getcwdrrr&rJ)rrnew_pathr;r;r<rJqs  zPthDistributions.addcCs6x$|j|jkr$|jj|jd|_qWtj||dS)z'Remove `dist` from the distribution mapTN)rArrKrr&)rrr;r;r<rKs zPthDistributions.removecCstjjt|\}}t|j}|g}tjdkr2dp6tj}xVt||kr||jkrn|jtj |j |j |Stjj|\}}|j|q:W|SdS)Nr) r>r?rr!rraltseprrcurdirrr )rr?ZnpathZlastZbaselenrrr;r;r<rs    zPthDistributions.make_relativeN) rrrrrrrrrrrJrKrr;r;r;r<r3*s  c@s(eZdZeddZedZedZdS)RewritePthDistributionsccs(|jVx|D] }|VqW|jVdS)N)preludepostlude)clsrrr;r;r<rs  z#RewritePthDistributions._wrap_linesz? import sys sys.__plen = len(sys.path) z import sys new = sys.path[sys.__plen:] del sys.path[sys.__plen:] p = getattr(sys, '__egginsert', 0) sys.path[p:p] = new sys.__egginsert = p + len(new) N)rrr classmethodrr"rrr;r;r;r<rs  rZSETUPTOOLS_SYS_PATH_TECHNIQUErawZrewritecCs ttjtrtStjtjjS)z_ Return a regular expression based on first_line_re suitable for matching strings. )rrpatternr9recompilerar;r;r;r<_first_line_res rcCsd|tjtjgkr.tjdkr.t|tj||Stj\}}}t j ||d|dd||ffdS)Nrrrz %s %s) r>rrKrrdrS_IWRITErrrZreraise)funcargexcZetZevr}r;r;r< auto_chmods  rcCs.t|}t|tj|r"t|nt|dS)aa Fix any globally cached `dist_path` related data `dist_path` should be a path of a newly installed egg distribution (zipped or unzipped). sys.path_importer_cache contains finder objects that have been cached when importing data from the original distribution. Any such finders need to be cleared since the replacement distribution might be packaged differently, e.g. a zipped egg distribution might get replaced with an unzipped egg folder or vice versa. Having the old finders cached may then cause Python to attempt loading modules from the replacement distribution using an incorrect loader. zipimport.zipimporter objects are Python loaders charged with importing data packaged inside zip archives. If stale loaders referencing the original distribution, are left behind, they can fail to load modules from the replacement distribution. E.g. if an old zipimport.zipimporter instance is used to load data from a new zipped egg archive, it may cause the operation to attempt to locate the requested data in the wrong location - one indicated by the original distribution's zip archive directory information. Such an operation may then fail outright, e.g. report having read a 'bad local file header', or even worse, it may fail silently & return invalid data. zipimport._zip_directory_cache contains cached zip archive directory information for all existing zipimport.zipimporter instances and all such instances connected to the same archive share the same cached directory information. If asked, and the underlying Python implementation allows it, we can fix all existing zipimport.zipimporter instances instead of having to track them down and remove them one by one, by updating their shared cached zip archive directory information. This, of course, assumes that the replacement distribution is packaged as a zipped egg. If not asked to fix existing zipimport.zipimporter instances, we still do our best to clear any remaining zipimport.zipimporter related cached data that might somehow later get used when attempting to load data from the new distribution and thus cause such load operations to fail. Note that when tracking down such remaining stale data, we can not catch every conceivable usage from here, and we clear only those that we know of and have found to cause problems if left alive. Any remaining caches should be updated by whomever is in charge of maintaining them, i.e. they should be ready to handle us replacing their zip archives with new distributions at runtime. N)r!_uncacherpath_importer_cache!_replace_zip_directory_cache_data*_remove_and_clear_zip_directory_cache_data)Z dist_pathrvnormalized_pathr;r;r<rys <  rycCsTg}t|}xB|D]:}t|}|j|r|||dtjdfkr|j|qW|S)ap Return zipimporter cache entry keys related to a given normalized path. Alternative path spellings (e.g. those using different character case or those using alternative path separators) related to the same path are included. Any sub-path entries are included as well, i.e. those corresponding to zip archives embedded in other zip archives. rr)rr!rnr>rr)rcacheresultZ prefix_lenpZnpr;r;r<"_collect_zipimporter_cache_entriess   rcCsDx>t||D]0}||}||=|o*|||}|dk r |||<q WdS)a Update zipimporter cache data for a given normalized path. Any sub-path entries are processed as well, i.e. those corresponding to zip archives embedded in other zip archives. Given updater is a callable taking a cache entry key and the original entry (after already removing the entry from the cache), and expected to update the entry and possibly return a new one to be inserted in its place. Returning None indicates that the entry should not be replaced with a new one. If no updater is given, the cache entries are simply removed without any additional processing, the same as if the updater simply returned None. N)r)rrupdaterr old_entryZ new_entryr;r;r<_update_zipimporter_cache*s  r cCst||dS)N)r )rrr;r;r<rJsrcCsdd}t|tj|ddS)NcSs |jdS)N)clear)r?rr;r;r<2clear_and_remove_cached_zip_archive_directory_dataOszf_remove_and_clear_zip_directory_cache_data..clear_and_remove_cached_zip_archive_directory_data)r)r rs_zip_directory_cache)rr"r;r;r<rNsrZ__pypy__cCsdd}t|tj|ddS)NcSs&|jtj||jtj||S)N)r!rsrtupdater#)r?rr;r;r<)replace_cached_zip_archive_directory_dataes zT_replace_zip_directory_cache_data..replace_cached_zip_archive_directory_data)r)r rsr#)rr%r;r;r<rds rc Cs2yt||dWnttfk r(dSXdSdS)z%Is this string a valid Python script?execFTN)r SyntaxError TypeError)rOrr;r;r< is_pythonws r*cCsJy(tj|dd}|jd}WdQRXWnttfk r@|SX|dkS)zCDetermine if the specified executable is a .sh (contains a #! line)zlatin-1)rrNz#!)rrrrr)r&fpmagicr;r;r<is_shs r-cCs tj|gS)z@Quote a command line argument according to Windows parsing rules) subprocess list2cmdline)rr;r;r< nt_quote_argsr0cCsH|jds|jdrdSt||r&dS|jdrDd|jdjkSdS)zMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc. z.pyz.pywTz#!rrF)rDr*rn splitlinesr')r_rr;r;r<r\s  r\)rdcGsdS)Nr;)rr;r;r<_chmodsr2cCsRtjd||yt||Wn0tjk rL}ztjd|WYdd}~XnXdS)Nzchanging mode of %s to %ozchmod failed: %s)r rr2r>error)r?rer|r;r;r<rds rdc@seZdZdZgZeZeddZeddZ eddZ edd Z ed d Z d d Z eddZddZeddZeddZdS) CommandSpeczm A command spec for a #! header, specified as a list of arguments akin to those passed to Popen. cCs|S)zV Choose the best CommandSpec class based on environmental conditions. r;)r r;r;r<rYszCommandSpec.bestcCstjjtj}tjjd|S)N__PYVENV_LAUNCHER__)r>r?rBrr&rr)r Z_defaultr;r;r<_sys_executableszCommandSpec._sys_executablecCs:t||r|St|tr ||S|dkr0|jS|j|S)zg Construct a CommandSpec from a parameter to build_scripts, which may be None. N)rrfrom_environment from_string)r Zparamr;r;r< from_params  zCommandSpec.from_paramcCs||jgS)N)r6)r r;r;r<r7szCommandSpec.from_environmentcCstj|f|j}||S)z} Construct a command spec from a simple string representing a command line parseable by shlex.split. )shlexr split_args)r stringrr;r;r<r8szCommandSpec.from_stringcCs8tj|j||_tj|}t|s4dg|jdd<dS)Nz-xr)r:r_extract_optionsoptionsr.r/rH)rr_cmdliner;r;r<install_optionss zCommandSpec.install_optionscCs:|djd}tj|}|r.|jdp0dnd}|jS)zH Extract any options from the first line of the script. rJrrr)r1rmatchgrouprM)Z orig_scriptfirstrAr>r;r;r<r=s zCommandSpec._extract_optionscCs|j|t|jS)N)_renderrr>)rr;r;r< as_headerszCommandSpec.as_headercCs6d}x,|D]$}|j|r |j|r |ddSq W|S)Nz"'rr)rnrD)itemZ_QUOTESqr;r;r< _strip_quotess  zCommandSpec._strip_quotescCs tjdd|D}d|dS)Ncss|]}tj|jVqdS)N)r4rHrM)rrFr;r;r<rsz&CommandSpec._render..z#!rJ)r.r/)rr?r;r;r<rDszCommandSpec._renderN)rrrrr>rr;r rYr6r9r7r8r@rr=rErHrDr;r;r;r<r4s       r4c@seZdZeddZdS)WindowsCommandSpecF)rN)rrrrr;r;r;r;r<rIsrIc@seZdZdZejdjZeZ e dddZ e dddZ e dd d Z ed d Ze d dZe ddZe ddZe dddZdS)rXz` Encapsulates behavior around writing entry point scripts for console and gui apps. a # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r __requires__ = %(spec)r import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point(%(spec)r, %(group)r, %(name)r)() ) NFcCs6tjdt|rtntj}|jd||}|j||S)Nz Use get_argsr)warningsrDeprecationWarningWindowsScriptWriterrXrYget_script_headerrZ)r rr&wininstwriterheaderr;r;r<get_script_argss zScriptWriter.get_script_argscCs6tjdt|rd}|jjj|}|j||jS)NzUse get_headerz python.exe)rJrrKcommand_spec_classrYr9r@rE)r r_r&rNcmdr;r;r<rM's   zScriptWriter.get_script_headerc cs|dkr|j}t|j}xjdD]b}|d}xT|j|jD]B\}}|j||jt}|j||||} x| D] } | VqrWq>Wq"WdS)z Yield write_script() argument tuples for a distribution's console_scripts and gui_scripts entry points. NconsoleguiZ_scripts)rTrU) r^r9rNZ get_entry_mapr_ensure_safe_namerr_get_script_args) r rrPrtype_rBrZepr_rrr;r;r<rZ1s     zScriptWriter.get_argscCstjd|}|rtddS)z? Prevent paths in *_scripts entry point names. z[\\/]z+Path separators not allowed in script namesN)r searchr)rZ has_path_sepr;r;r<rVCs zScriptWriter._ensure_safe_namecCs tjdt|rtjS|jS)NzUse best)rJrrKrLrY)r Z force_windowsr;r;r< get_writerLs zScriptWriter.get_writercCs.tjdkstjdkr&tjdkr&tjS|SdS)zD Select the best ScriptWriter for this environment. win32javarN)rr{r>r_namerLrY)r r;r;r<rYRszScriptWriter.bestccs|||fVdS)Nr;)r rXrrPr_r;r;r<rW\szScriptWriter._get_script_argsrcCs"|jjj|}|j||jS)z;Create a #! line, getting options (if any) from script_text)rRrYr9r@rE)r r_r&rSr;r;r<r^as zScriptWriter.get_header)NF)NF)N)rN)rrrrrKrLrrr4rRr rQrMrZrrVrZrYrWr^r;r;r;r<rX s       rXc@sLeZdZeZeddZeddZeddZeddZ e d d Z d S) rLcCstjdt|jS)NzUse best)rJrrKrY)r r;r;r<rZls zWindowsScriptWriter.get_writercCs"tt|d}tjjdd}||S)zC Select the best ScriptWriter suitable for Windows )r&ZnaturalZSETUPTOOLS_LAUNCHERr&)rWindowsExecutableLauncherWriterr>rr)r Z writer_lookupZlauncherr;r;r<rYrs zWindowsScriptWriter.bestc #stddd|}|tjdjjdkrBdjft}tj|t dddd d dd g}|j ||j ||}fd d |D}|||d|fVdS)z For Windows, add a .py extensionz.pyaz.pyw)rTrUZPATHEXT;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.z.pyz -script.pyz.pycz.pyoz.execsg|] }|qSr;r;)rrb)rr;r<rsz8WindowsScriptWriter._get_script_args..rbN) rr>rr'rrrrJr UserWarningrK_adjust_header) r rXrrPr_extrrrr;)rr<rWs   z$WindowsScriptWriter._get_script_argscCsNd}d}|dkr||}}tjtj|tj}|j||d}|j|rJ|S|S)z Make sure 'pythonw' is used for gui and and 'python' is used for console (regardless of what sys.executable is). z pythonw.exez python.exerU)r<repl)r rescape IGNORECASEsub _use_header)r rXZ orig_headerr rcZ pattern_ob new_headerr;r;r<ras z"WindowsScriptWriter._adjust_headercCs$|ddjd}tjdkp"t|S)z Should _adjust_header use the replaced header? On non-windows systems, always use. On Windows systems, only use the replaced header if it resolves to an executable on the system. rr"r[r)rMrr{r)rhZ clean_headerr;r;r<rgs zWindowsScriptWriter._use_headerN) rrrrIrRr rZrYrWrarrgr;r;r;r<rLis    rLc@seZdZeddZdS)r^c #s|dkrd}d}dg}nd}d}dddg}|j||}fd d |D} |||d | fVd t|d fVtsd} | td fVdS)zG For Windows, add a .py extension and an .exe launcher rUz -script.pywz.pywZcliz -script.pyz.pyz.pycz.pyocsg|] }|qSr;r;)rrb)rr;r<rszDWindowsExecutableLauncherWriter._get_script_args..rbz.exernz .exe.manifestN)raget_win_launcherr=load_launcher_manifest) r rXrrPr_Z launcher_typerbrZhdrrZm_namer;)rr<rWs   z0WindowsExecutableLauncherWriter._get_script_argsN)rrrr rWr;r;r;r<r^sr^cCs2d|}tr|jdd}n |jdd}td|S)z Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string. z%s.exe.z-64.z-32.r)r=rNr")typeZ launcher_fnr;r;r<rjs  rjcCs0tjtd}tjr|tS|jdtSdS)Nzlauncher manifest.xmlzutf-8)r$r"rrPY2varsra)rZmanifestr;r;r<rks  rkFcCstj|||S)N)rQr)r? ignore_errorsonerrorr;r;r<rsrcCstjd}tj||S)N)r>umask)Ztmpr;r;r<rcs  rccCs:ddl}tjj|jd}|tjd<tjj|tdS)Nr) rr>r?r#__path__rargvrr5)rZargv0r;r;r< bootstraps   rvc sddlm}ddlmGfddd}|dkrBtjdd}t0|fddd g|tjdpfd|d |WdQRXdS) Nr)setup)r(cseZdZdZfddZdS)z-main..DistributionWithoutHelpCommandsrc s(tj|f||WdQRXdS)N) _patch_usage _show_help)rrkw)r(r;r<ry sz8main..DistributionWithoutHelpCommands._show_helpN)rrrZ common_usageryr;)r(r;r<DistributionWithoutHelpCommandssr{rz-qr2z-v)Z script_argsr-Z distclass)rrwZsetuptools.distr(rrurx)rurzrwr{r;)r(r<r5s    c #sLddl}tjdjfdd}|jj}||j_z dVWd||j_XdS)Nrze usage: %(script)s [options] requirement_or_url ... or: %(script)s --help csttjj|dS)N)Zscript)rr>r?r))r-)USAGEr;r< gen_usage sz_patch_usage..gen_usage)Zdistutils.corerKrLrZcorer})rr}Zsavedr;)r|r<rx s   rx)N)r&)N)rrrrrrZdistutils.errorsrrrr Zdistutils.command.installr r rr r Zdistutils.command.build_scriptsrr(rrr>rsrQr6rr rr rKrJrr9rr.r:rZsetuptools.externrZsetuptools.extern.six.movesrrrrZsetuptools.sandboxrZsetuptools.py31compatrrZsetuptools.py27compatrZsetuptools.commandrZsetuptools.archive_utilrZsetuptools.package_indexrrrrrZsetuptools.wheelrr$r r!r"r#r$r%r&r'r(r)r*r+r,r-r.Zpkg_resources.py31compatfilterwarningsZ PEP440Warning__all__r=r1rnrErHr"r2rrrr4r6r3rrrrrryrr rrbuiltin_module_namesrr*r-r0r\rdr2 ImportErrorrr4r6Zsys_executablerIobjectrXrLr^rQrMrjrkrrcrvr5rrxr;r;r;r< s           D |A))'l R    T`A  __pycache__/py36compat.cpython-36.opt-1.pyc000064400000010703147210141470014350 0ustar003 K]z@sdddlZddlmZddlmZddlmZddlmZGdddZe ejdr`Gd ddZdS) N)glob) convert_path)sdist)filterc@s\eZdZdZddZeddZddZdd Zd d Z d d Z ddZ ddZ ddZ dS)sdist_add_defaultsz Mix-in providing forward-compatibility for functionality as found in distutils on Python 3.7. Do not edit the code in this class except to update functionality as implemented in distutils. Instead, override in the subclass. cCs<|j|j|j|j|j|j|jdS)a9Add 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_scripts)selfr /usr/lib/python3.6/py36compat.py add_defaultsszsdist_add_defaults.add_defaultscCs:tjj|sdStjj|}tjj|\}}|tj|kS)z Case-sensitive path existence check >>> sdist_add_defaults._cs_path_exists(__file__) True >>> sdist_add_defaults._cs_path_exists(__file__.upper()) False F)ospathexistsabspathsplitlistdir)fspathrZ directoryfilenamerrr_cs_path_exists(s  z"sdist_add_defaults._cs_path_existscCs|j|jjg}x|D]}t|trn|}d}x(|D] }|j|r0d}|jj|Pq0W|s|jddj |q|j|r|jj|q|jd|qWdS)NFTz,standard file not found: should have one of z, zstandard file '%s' not found) ZREADMES distributionZ script_name isinstancetuplerfilelistappendwarnjoin)rZ standardsfnZaltsZgot_itrrrr9s       z*sdist_add_defaults._add_defaults_standardscCs8ddg}x*|D]"}ttjjt|}|jj|qWdS)Nz test/test*.pyz setup.cfg)rrrisfilerrextend)rZoptionalpatternfilesrrrrNs z)sdist_add_defaults._add_defaults_optionalcCsd|jd}|jjr$|jj|jx:|jD]0\}}}}x"|D]}|jjtj j ||q>Wq,WdS)Nbuild_py) get_finalized_commandrZhas_pure_modulesrr$get_source_files data_filesrrrr!)rr'ZpkgZsrc_dirZ build_dir filenamesrrrrr Ts    z'sdist_add_defaults._add_defaults_pythoncCs|jjr~xr|jjD]f}t|trDt|}tjj|rz|j j |q|\}}x,|D]$}t|}tjj|rR|j j |qRWqWdS)N) rZhas_data_filesr*rstrrrrr#rr)ritemdirnamer+frrrr ds     z+sdist_add_defaults._add_defaults_data_filescCs(|jjr$|jd}|jj|jdS)N build_ext)rZhas_ext_modulesr(rr$r))rr0rrrr us  z$sdist_add_defaults._add_defaults_extcCs(|jjr$|jd}|jj|jdS)N build_clib)rZhas_c_librariesr(rr$r))rr1rrrr zs  z'sdist_add_defaults._add_defaults_c_libscCs(|jjr$|jd}|jj|jdS)N build_scripts)rZ has_scriptsr(rr$r))rr2rrrr s  z(sdist_add_defaults._add_defaults_scriptsN)__name__ __module__ __qualname____doc__r staticmethodrrrr r r r r rrrrr s rrc@s eZdZdS)rN)r3r4r5rrrrrs) rrZdistutils.utilrZdistutils.commandrZsetuptools.extern.six.movesrrhasattrrrrrs    | __pycache__/rotate.cpython-36.pyc000064400000004707147210141470012711 0ustar003 K]t@s`ddlmZddlmZddlmZddlZddlZddlm Z ddl m Z Gddde Z dS) ) convert_path)log)DistutilsOptionErrorN)six)Commandc@s:eZdZdZdZdddgZgZd d ZddZddZ dS)rotatezDelete older distributionsz2delete older distributions, keeping N newest filesmatch=mpatterns to match (required) dist-dir=d%directory where the distributions arekeep=k(number of matching distributions to keepcCsd|_d|_d|_dS)N)matchdist_dirkeep)selfr/usr/lib/python3.6/rotate.pyinitialize_optionsszrotate.initialize_optionsc Cs|jdkrtd|jdkr$tdyt|j|_Wntk rPtdYnXt|jtjrxdd|jjdD|_|j dd dS) NzQMust specify one or more (comma-separated) match patterns (e.g. '.zip' or '.egg')z$Must specify number of files to keepz--keep must be an integercSsg|]}t|jqSr)rstrip).0prrr +sz+rotate.finalize_options..,Zbdistr)rr) rrrint ValueError isinstancerZ string_typessplitZset_undefined_options)rrrrfinalize_optionss  zrotate.finalize_optionscCs|jdddlm}x|jD]}|jjd|}|tjj|j|}dd|D}|j |j t j dt ||||jd}xD|D]<\}}t j d||jstjj|rtj|qtj|qWqWdS) NZegg_infor)glob*cSsg|]}tjj||fqSr)ospathgetmtime)rfrrrr6szrotate.run..z%d file(s) matching %sz Deleting %s)Z run_commandr"rZ distributionZget_namer$r%joinrsortreverserinfolenrZdry_runisdirshutilZrmtreeunlink)rr"patternfilestr'rrrrun/s       z rotate.runN)rr r )r r r )rrr) __name__ __module__ __qualname____doc__ descriptionZ user_optionsZboolean_optionsrr!r3rrrrr sr) Zdistutils.utilrZ distutilsrZdistutils.errorsrr$r.Zsetuptools.externrZ setuptoolsrrrrrrs     __pycache__/install_scripts.cpython-36.pyc000064400000004174147210141470014626 0ustar003 \@sDdZddlZddlmZddlmZddlmZGdddeZdS)zudistutils.command.install_scripts Implements the Distutils 'install_scripts' command, for installing Python scripts.N)Command)log)ST_MODEc@sLeZdZdZddddgZdd gZddZddZddZddZ ddZ d S)install_scriptsz%install scripts (Python or otherwise) install-dir=ddirectory to install scripts to build-dir=b'build directory (where to install from)forcef-force installation (overwrite existing files) skip-buildNskip the build stepscCsd|_d|_d|_d|_dS)Nr) install_dirr build_dir skip_build)selfr'/usr/lib64/python3.6/install_scripts.pyinitialize_optionssz"install_scripts.initialize_optionscCs |jdd |jdd d d dS) NZbuild build_scriptsrZinstallrrr r)rr)rr)r r )rr)Zset_undefined_options)rrrrfinalize_options!s  z install_scripts.finalize_optionscCs|js|jd|j|j|j|_tjdkrxT|jD]H}|j rNt j d|q6tj |t dBd@}t j d||tj||q6WdS)Nrposixzchanging mode of %simizchanging mode of %s to %o)rZ run_commandZ copy_treerroutfilesosname get_outputsZdry_runrinfostatrchmod)rfilemoderrrrun)s  zinstall_scripts.runcCs |jjp gS)N)Z distributionscripts)rrrr get_inputs8szinstall_scripts.get_inputscCs |jpgS)N)r)rrrrr;szinstall_scripts.get_outputs)rrr)r r r )r r r)rNr) __name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsrrr$r&rrrrrrsr) __doc__rZdistutils.corerZ distutilsrr rrrrrrs    __pycache__/__init__.cpython-36.opt-1.pyc000064400000001005147210141470014075 0ustar003 \@s2dZddddddddd d d d d ddddddgZdS)z\distutils.command Package containing implementation of all the standard Distutils commands.ZbuildZbuild_pyZ build_extZ build_clibZ build_scriptsZcleanZinstallZ install_libZinstall_headersZinstall_scriptsZ install_dataZsdistregisterZbdistZ bdist_dumbZ bdist_rpmZ bdist_wininstZcheckZuploadN)__doc____all__rr /usr/lib64/python3.6/__init__.pys&__pycache__/bdist_egg.cpython-36.pyc000064400000034002147210141470013331 0ustar003 K] G @sxdZddlmZddlmZmZddlmZddlm Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZmZmZdd lmZdd lmZdd lmZydd lmZmZd dZWn,ek rddlm Z mZddZYnXddZ!ddZ"ddZ#GdddeZ$e%j&dj'Z(ddZ)ddZ*ddZ+d d!d"Z,d#d$Z-d%d&Z.d'd(Z/d)d*d+d,gZ0d1d/d0Z1dS)2z6setuptools.command.bdist_egg Build .egg distributions)DistutilsSetupError) remove_treemkpath)log)CodeTypeN)six)get_build_platform Distributionensure_directory) EntryPoint)Library)Command)get_pathget_python_versioncCstdS)Npurelib)rrr/usr/lib/python3.6/bdist_egg.py _get_purelibsr)get_python_librcCstdS)NF)rrrrrrscCs2d|krtjj|d}|jdr.|dd}|S)N.rmodulei)ospathsplitextendswith)filenamerrr strip_module#s   rccs:x4tj|D]&\}}}|j|j|||fVq WdS)zbDo os.walk in a reproducible way, independent of indeterministic filesystem readdir order N)rwalksort)dirbasedirsfilesrrr sorted_walk+sr$c Cs6tjdj}t|d}|j||WdQRXdS)NaR def __bootstrap__(): global __bootstrap__, __loader__, __file__ import sys, pkg_resources, imp __file__ = pkg_resources.resource_filename(__name__, %r) __loader__ = None; del __bootstrap__, __loader__ imp.load_dynamic(__name__,__file__) __bootstrap__() w)textwrapdedentlstripopenwrite)ZresourcepyfileZ_stub_templatefrrr write_stub5s  r-c@seZdZdZd*dddefd+d-d.d/gZd ddgZddZddZddZ ddZ ddZ ddZ d d!Z d"d#Zd$d%Zd&d'Zd(d)Zd S)0 bdist_eggzcreate an "egg" distribution bdist-dir=b1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s)exclude-source-filesN+remove all .py files from the generated egg keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archive dist-dir=d-directory to put final built distributions in skip-build2skip rebuilding everything (for testing/debugging)cCs.d|_d|_d|_d|_d|_d|_d|_dS)Nr) bdist_dir plat_name keep_tempdist_dir skip_build egg_outputexclude_source_files)selfrrrinitialize_optionsZszbdist_egg.initialize_optionscCs|jd}|_|j|_|jdkr>|jdj}tjj|d|_|jdkrPt |_|j dd|j dkrt dd|j |jt|jjo|jj }tjj|j|d|_ dS)Negg_infoZbdistZeggr?z.egg)r?r?)get_finalized_commandei_cmdrEr< bdist_baserrjoinr=rZset_undefined_optionsrAr Zegg_nameZ egg_versionr distributionhas_ext_modulesr?)rCrGrHbasenamerrrfinalize_optionscs      zbdist_egg.finalize_optionsc Cs|j|jd_tjjtjjt}|jj g}|j_ x|D]}t |t rt |dkrtjj |drtjj|d}tjj|}||ks|j|tjr|t |dd|df}|jj j|qrgetattrr)rCZinstcmdZold_rootrk all_outputs ext_outputsZ to_compiler2Zext_namerextr+Z archive_rootrEZ script_dirZ native_libsZ libs_filerrrrunsz                    z bdist_egg.runc Cstjdxt|jD]\}}}x|D]}tjj||}|jdrXtjd|tj ||jdr&|}d}t j ||}tjj|tj |j dd} tjd|| fytj| Wntk rYnXtj|| q&WqWdS) Nz+Removing .py files from temporary directoryz.pyz Deleting %s __pycache__z#(?P.+)\.(?P[^.]+)\.pycnamez.pyczRenaming file from [%s] to [%s])rr_walk_eggr<rrrIrdebugrzrematchpardirgroupremoveOSErrorrename) rCr!r"r#rrZpath_oldpatternmZpath_newrrrrs*        zbdist_egg.zap_pyfilescCs2t|jdd}|dk r|Stjdt|j|jS)Nr|z4zip_safe flag not set; analyzing archive contents...)rrJrr~ analyze_eggr<rt)rCsaferrrr| s  zbdist_egg.zip_safec Cstj|jjpd}|jdijd}|dkr0dS|j s>|jrLtd|ftj dd}|j }dj |j}|jd}t j j|j}d t}|jstt j j|j|jd t|jd} | j|| jd S) Nzsetuptools.installationZ eggsecutabler%zGeggsecutable entry point (%r) cannot have 'extras' or refer to a modulerraH#!/bin/sh if [ `basename $0` = "%(basename)s" ] then exec python%(pyver)s -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from %(pkg)s import %(base)s; sys.exit(%(full)s())" "$@" else echo $0 is not the correct name for this egg file. echo Please rename it back to %(basename)s and try again. exec false fi )rea)r Z parse_maprJZ entry_pointsgetZattrsZextrasrsysversionZ module_namerIrrrLrAlocalsrerrjr)r*rx) rCZepmZepZpyverpkgZfullr!rLheaderr,rrrrs*      zbdist_egg.gen_headercCsltjj|j}tjj|d}xJ|jjjD]<}|j|r(tjj||t |d}t ||j ||q(WdS)z*Copy metadata (egg info) to the target_dirrN) rrnormpathrErIrGZfilelistr#r\rZr Z copy_file)rCZ target_dirZ norm_egg_infoprefixrtargetrrrrw:s zbdist_egg.copy_metadata_toc Csg}g}|jdi}x|t|jD]n\}}}x6|D].}tjj|djtkr.|j|||q.Wx*|D]"}|||d|tjj||<qfWqW|j j r |j d}xd|j D]Z} t | trq|j| j} |j| }tjj|jdstjjtjj|j|r|j|qW||fS)zAGet a list of relative paths to C extensions in the output distrorrPrlZ build_extzdl-)r<r$rrrlowerNATIVE_EXTENSIONSr^rIrJrKrF extensionsrXr Zget_ext_fullnamerZget_ext_filenamerLr\r}) rCrrpathsr!r"r#rZ build_cmdrfullnamerrrrsFs(   &      zbdist_egg.get_ext_outputs)r/r0r1)r3Nr4Pkeep the pseudo-installation tree around after creating the distribution archive)r5r6r)r7r8r9)r:Nr;)__name__ __module__ __qualname__ descriptionrZ user_optionsZboolean_optionsrDrMrcrdr`rrr|rrwrsrrrrr.Cs4   Q' r.z.dll .so .dylib .pydccsLt|}t|\}}}d|kr(|jd|||fVx|D] }|Vq:WdS)z@Walk an unpacked egg's contents, skipping the metadata directoryzEGG-INFON)r$nextr)egg_dirZwalkerr!r"r#Zbdfrrrrfs   rc Csx0tjD]$\}}tjjtjj|d|r |Sq Wts.visit) compression) zipfilerrrrjrr_Z ZIP_DEFLATEDZ ZIP_STOREDZZipFiler$rx) Z zip_filenamerrqrecompressrrrrrrrjr"r#r)rrerrs  r)rrTr%)2__doc__Zdistutils.errorsrZdistutils.dir_utilrrZ distutilsrtypesrrrrr&rZsetuptools.externrZ pkg_resourcesrr r r Zsetuptools.extensionr Z setuptoolsr sysconfigrrr ImportErrorZdistutils.sysconfigrrr$r-r.rrsplitrrrr{rrrrrfrrrrrsL         " $  __pycache__/install_lib.cpython-36.opt-1.pyc000064400000012046147210141470014641 0ustar003 \ @sLdZddlZddlZddlZddlmZddlmZdZ GdddeZ dS)zkdistutils.command.install_lib Implements the Distutils 'install_lib' command (install all Python modules).N)Command)DistutilsOptionErrorz.pyc @seZdZdZd*d+d,d-d.d/d0gZdd dgZdd iZddZddZddZ ddZ ddZ d d!Z d"d#Z d$d%Zd&d'Zd(d)ZdS)1 install_libz7install all Python modules (extensions and pure Python) install-dir=ddirectory to install to build-dir=b'build directory (where to install from)forcef-force installation (overwrite existing files)compileccompile .py to .pyc [default] no-compileNdon't compile .py files optimize=Olalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0] skip-buildskip the build stepscCs(d|_d|_d|_d|_d|_d|_dS)Nr) install_dir build_dirr roptimize skip_build)selfr#/usr/lib64/python3.6/install_lib.pyinitialize_options3s zinstall_lib.initialize_optionsc Cs|jddddddd|jdkr&d |_|jdkr6d |_t|jtsyt|j|_|jdkr^tWn ttfk rtdYnXdS)Ninstall build_librrrr rrrTFrzoptimize must be 0, 1, or 2)r!r)rr)r r )rr)rr)rr)rr"r#)Zset_undefined_optionsrr isinstanceintAssertionError ValueErrorr)rrrrfinalize_options<s$     zinstall_lib.finalize_optionscCs0|j|j}|dk r,|jjr,|j|dS)N)buildr distributionhas_pure_modules byte_compile)routfilesrrrrunVszinstall_lib.runcCs2|js.|jjr|jd|jjr.|jddS)Nbuild_py build_ext)rr*r+Z run_commandhas_ext_modules)rrrrr)fs    zinstall_lib.buildcCs8tjj|jr |j|j|j}n|jd|jdS|S)Nz3'%s' does not exist -- no Python modules to install)ospathisdirrZ copy_treerwarn)rr-rrrr ms  zinstall_lib.installcCsrtjr|jddSddlm}|jdj}|jrH||d|j||j d|j dkrn|||j |j||j |j ddS)Nz%byte-compiling is disabled, skipping.r)r,r )rr prefixdry_run)rr r6verboser7) sysdont_write_bytecoder5Zdistutils.utilr,get_finalized_commandrootrr r7rr8)rfilesr,Z install_rootrrrr,vs     zinstall_lib.byte_compilec Csh|sgS|j|}|j}t||}t|ttj}g}x(|D] } |jtjj|| |dq@W|S)N) r; get_outputsgetattrlenr2sepappendr3join) rZhas_anyZ build_cmdZ cmd_optionZ output_dirZ build_filesrZ prefix_lenZoutputsfilerrr_mutate_outputss    zinstall_lib._mutate_outputscCsvg}xl|D]d}tjjtjj|d}|tkr0q |jrL|jtjj |dd|j dkr |jtjj ||j dq W|S)Nr") optimizationr) r2r3splitextnormcasePYTHON_SOURCE_EXTENSIONrrB importlibutilcache_from_sourcer)rZ py_filenamesZbytecode_filesZpy_fileZextrrr_bytecode_filenamess     zinstall_lib._bytecode_filenamescCsR|j|jjdd|j}|jr*|j|}ng}|j|jjdd|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!r0)rEr*r+rrrNr1)rZ pure_outputsZbytecode_outputsZ ext_outputsrrrr>s   zinstall_lib.get_outputscCsLg}|jjr&|jd}|j|j|jjrH|jd}|j|j|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/r0)r*r+r;extendr>r1)rZinputsr/r0rrr get_inputss    zinstall_lib.get_inputs)rrr)rr r )r r r )rrr)rNr)rrr)rNr)__name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsZ negative_optrr(r.r)r r,rErNr>rPrrrrrs*   r) __doc__r2importlib.utilrKr9Zdistutils.corerZdistutils.errorsrrJrrrrrs  __pycache__/setopt.cpython-36.pyc000064400000010656147210141470012731 0ustar003 K]@sddlmZddlmZddlmZddlZddlZddlmZddl m Z ddd d gZ dd dZ dddZ Gdd d e ZGdd d eZdS)) convert_path)log)DistutilsOptionErrorN) configparser)Command config_file edit_config option_basesetoptlocalcCsh|dkr dS|dkr,tjjtjjtjdS|dkrZtjdkrBdpDd}tjjtd |St d |d S) zGet the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" r z setup.cfgglobalz distutils.cfguserposix.z~/%spydistutils.cfgz7config_file() type must be 'local', 'global', or 'user'N) ospathjoindirname distutils__file__name expanduserr ValueError)Zkinddotr/usr/lib/python3.6/setopt.pyrsFc Cs.tjd|tj}|j|gx|jD]\}}|dkrTtjd|||j|q*|j|svtjd|||j |x||jD]p\}}|dkrtjd||||j |||j |stjd|||j|qtjd|||||j |||qWq*Wtjd||s*t |d }|j|WdQRXdS) aYEdit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or deleted in that section. A setting of ``None`` means to delete that setting. zReading configuration from %sNzDeleting section [%s] from %szAdding new section [%s] to %szDeleting %s.%s from %sz#Deleting empty [%s] section from %szSetting %s.%s to %r in %sz Writing %sw)rdebugrZRawConfigParserreaditemsinfoZremove_sectionZ has_sectionZ add_sectionZ remove_optionoptionssetopenwrite) filenameZsettingsdry_runZoptsZsectionr"optionvaluefrrrr!s8            c@s2eZdZdZdddgZddgZd d Zd dZdS)r zr? descriptionr r@rAr6r;rSrrrrr ss )r )F)Zdistutils.utilrrrZdistutils.errorsrrZsetuptools.extern.six.movesrZ setuptoolsr__all__rrr r rrrrs        +'__pycache__/__init__.cpython-36.pyc000064400000001005147210141470013136 0ustar003 \@s2dZddddddddd d d d d ddddddgZdS)z\distutils.command Package containing implementation of all the standard Distutils commands.ZbuildZbuild_pyZ build_extZ build_clibZ build_scriptsZcleanZinstallZ install_libZinstall_headersZinstall_scriptsZ install_dataZsdistregisterZbdistZ bdist_dumbZ bdist_rpmZ bdist_wininstZcheckZuploadN)__doc____all__rr /usr/lib64/python3.6/__init__.pys&__pycache__/dist_info.cpython-36.pyc000064400000002445147210141470013366 0ustar003 K]@s8dZddlZddlmZddlmZGdddeZdS)zD Create a dist_info directory As defined in the wheel specification N)Command)logc@s.eZdZdZd gZddZddZd d Zd S) dist_infozcreate a .dist-info directory egg-base=eLdirectory containing .egg-info directories (default: top of the source tree)cCs d|_dS)N)egg_base)selfr /usr/lib/python3.6/dist_info.pyinitialize_optionsszdist_info.initialize_optionscCsdS)Nr )r r r r finalize_optionsszdist_info.finalize_optionscCsn|jd}|j|_|j|j|jdtd d}tjdjt j j ||jd}|j |j|dS)Negg_infoz .egg-infoz .dist-infoz creating '{}' bdist_wheel) Zget_finalized_commandrr runrlenrinfoformatospathabspathZegg2dist)r rZ dist_info_dirrr r r rs  z dist_info.runN)rrr)__name__ __module__ __qualname__ descriptionZ user_optionsr r rr r r r r s r)__doc__rZdistutils.corerZ distutilsrrr r r r s  __pycache__/bdist_egg.cpython-36.opt-1.pyc000064400000034002147210141470014270 0ustar003 K] G @sxdZddlmZddlmZmZddlmZddlm Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZmZmZdd lmZdd lmZdd lmZydd lmZmZd dZWn,ek rddlm Z mZddZYnXddZ!ddZ"ddZ#GdddeZ$e%j&dj'Z(ddZ)ddZ*ddZ+d d!d"Z,d#d$Z-d%d&Z.d'd(Z/d)d*d+d,gZ0d1d/d0Z1dS)2z6setuptools.command.bdist_egg Build .egg distributions)DistutilsSetupError) remove_treemkpath)log)CodeTypeN)six)get_build_platform Distributionensure_directory) EntryPoint)Library)Command)get_pathget_python_versioncCstdS)Npurelib)rrr/usr/lib/python3.6/bdist_egg.py _get_purelibsr)get_python_librcCstdS)NF)rrrrrrscCs2d|krtjj|d}|jdr.|dd}|S)N.rmodulei)ospathsplitextendswith)filenamerrr strip_module#s   rccs:x4tj|D]&\}}}|j|j|||fVq WdS)zbDo os.walk in a reproducible way, independent of indeterministic filesystem readdir order N)rwalksort)dirbasedirsfilesrrr sorted_walk+sr$c Cs6tjdj}t|d}|j||WdQRXdS)NaR def __bootstrap__(): global __bootstrap__, __loader__, __file__ import sys, pkg_resources, imp __file__ = pkg_resources.resource_filename(__name__, %r) __loader__ = None; del __bootstrap__, __loader__ imp.load_dynamic(__name__,__file__) __bootstrap__() w)textwrapdedentlstripopenwrite)ZresourcepyfileZ_stub_templatefrrr write_stub5s  r-c@seZdZdZd*dddefd+d-d.d/gZd ddgZddZddZddZ ddZ ddZ ddZ d d!Z d"d#Zd$d%Zd&d'Zd(d)Zd S)0 bdist_eggzcreate an "egg" distribution bdist-dir=b1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s)exclude-source-filesN+remove all .py files from the generated egg keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archive dist-dir=d-directory to put final built distributions in skip-build2skip rebuilding everything (for testing/debugging)cCs.d|_d|_d|_d|_d|_d|_d|_dS)Nr) bdist_dir plat_name keep_tempdist_dir skip_build egg_outputexclude_source_files)selfrrrinitialize_optionsZszbdist_egg.initialize_optionscCs|jd}|_|j|_|jdkr>|jdj}tjj|d|_|jdkrPt |_|j dd|j dkrt dd|j |jt|jjo|jj }tjj|j|d|_ dS)Negg_infoZbdistZeggr?z.egg)r?r?)get_finalized_commandei_cmdrEr< bdist_baserrjoinr=rZset_undefined_optionsrAr Zegg_nameZ egg_versionr distributionhas_ext_modulesr?)rCrGrHbasenamerrrfinalize_optionscs      zbdist_egg.finalize_optionsc Cs|j|jd_tjjtjjt}|jj g}|j_ x|D]}t |t rt |dkrtjj |drtjj|d}tjj|}||ks|j|tjr|t |dd|df}|jj j|qrgetattrr)rCZinstcmdZold_rootrk all_outputs ext_outputsZ to_compiler2Zext_namerextr+Z archive_rootrEZ script_dirZ native_libsZ libs_filerrrrunsz                    z bdist_egg.runc Cstjdxt|jD]\}}}x|D]}tjj||}|jdrXtjd|tj ||jdr&|}d}t j ||}tjj|tj |j dd} tjd|| fytj| Wntk rYnXtj|| q&WqWdS) Nz+Removing .py files from temporary directoryz.pyz Deleting %s __pycache__z#(?P.+)\.(?P[^.]+)\.pycnamez.pyczRenaming file from [%s] to [%s])rr_walk_eggr<rrrIrdebugrzrematchpardirgroupremoveOSErrorrename) rCr!r"r#rrZpath_oldpatternmZpath_newrrrrs*        zbdist_egg.zap_pyfilescCs2t|jdd}|dk r|Stjdt|j|jS)Nr|z4zip_safe flag not set; analyzing archive contents...)rrJrr~ analyze_eggr<rt)rCsaferrrr| s  zbdist_egg.zip_safec Cstj|jjpd}|jdijd}|dkr0dS|j s>|jrLtd|ftj dd}|j }dj |j}|jd}t j j|j}d t}|jstt j j|j|jd t|jd} | j|| jd S) Nzsetuptools.installationZ eggsecutabler%zGeggsecutable entry point (%r) cannot have 'extras' or refer to a modulerraH#!/bin/sh if [ `basename $0` = "%(basename)s" ] then exec python%(pyver)s -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from %(pkg)s import %(base)s; sys.exit(%(full)s())" "$@" else echo $0 is not the correct name for this egg file. echo Please rename it back to %(basename)s and try again. exec false fi )rea)r Z parse_maprJZ entry_pointsgetZattrsZextrasrsysversionZ module_namerIrrrLrAlocalsrerrjr)r*rx) rCZepmZepZpyverpkgZfullr!rLheaderr,rrrrs*      zbdist_egg.gen_headercCsltjj|j}tjj|d}xJ|jjjD]<}|j|r(tjj||t |d}t ||j ||q(WdS)z*Copy metadata (egg info) to the target_dirrN) rrnormpathrErIrGZfilelistr#r\rZr Z copy_file)rCZ target_dirZ norm_egg_infoprefixrtargetrrrrw:s zbdist_egg.copy_metadata_toc Csg}g}|jdi}x|t|jD]n\}}}x6|D].}tjj|djtkr.|j|||q.Wx*|D]"}|||d|tjj||<qfWqW|j j r |j d}xd|j D]Z} t | trq|j| j} |j| }tjj|jdstjjtjj|j|r|j|qW||fS)zAGet a list of relative paths to C extensions in the output distrorrPrlZ build_extzdl-)r<r$rrrlowerNATIVE_EXTENSIONSr^rIrJrKrF extensionsrXr Zget_ext_fullnamerZget_ext_filenamerLr\r}) rCrrpathsr!r"r#rZ build_cmdrfullnamerrrrsFs(   &      zbdist_egg.get_ext_outputs)r/r0r1)r3Nr4Pkeep the pseudo-installation tree around after creating the distribution archive)r5r6r)r7r8r9)r:Nr;)__name__ __module__ __qualname__ descriptionrZ user_optionsZboolean_optionsrDrMrcrdr`rrr|rrwrsrrrrr.Cs4   Q' r.z.dll .so .dylib .pydccsLt|}t|\}}}d|kr(|jd|||fVx|D] }|Vq:WdS)z@Walk an unpacked egg's contents, skipping the metadata directoryzEGG-INFON)r$nextr)egg_dirZwalkerr!r"r#Zbdfrrrrfs   rc Csx0tjD]$\}}tjjtjj|d|r |Sq Wts.visit) compression) zipfilerrrrjrr_Z ZIP_DEFLATEDZ ZIP_STOREDZZipFiler$rx) Z zip_filenamerrqrecompressrrrrrrrjr"r#r)rrerrs  r)rrTr%)2__doc__Zdistutils.errorsrZdistutils.dir_utilrrZ distutilsrtypesrrrrr&rZsetuptools.externrZ pkg_resourcesrr r r Zsetuptools.extensionr Z setuptoolsr sysconfigrrr ImportErrorZdistutils.sysconfigrrr$r-r.rrsplitrrrr{rrrrrfrrrrrsL         " $  __pycache__/saveopts.cpython-36.pyc000064400000001520147210141470013245 0ustar003 K]@s$ddlmZmZGdddeZdS)) edit_config option_basec@seZdZdZdZddZdS)saveoptsz#Save command-line options to a filez7save supplied options to setup.cfg or other config filecCsp|j}i}xP|jD]F}|dkr qx6|j|jD]$\}\}}|dkr0||j|i|<q0WqWt|j||jdS)Nrz command line)Z distributionZcommand_optionsZget_option_dictitems setdefaultrfilenameZdry_run)selfZdistZsettingscmdoptsrcvalr /usr/lib/python3.6/saveopts.pyrun s z saveopts.runN)__name__ __module__ __qualname____doc__ descriptionrr r r rrsrN)Zsetuptools.command.setoptrrrr r r rs__pycache__/install_scripts.cpython-36.opt-1.pyc000064400000004174147210141470015565 0ustar003 \@sDdZddlZddlmZddlmZddlmZGdddeZdS)zudistutils.command.install_scripts Implements the Distutils 'install_scripts' command, for installing Python scripts.N)Command)log)ST_MODEc@sLeZdZdZddddgZdd gZddZddZddZddZ ddZ d S)install_scriptsz%install scripts (Python or otherwise) install-dir=ddirectory to install scripts to build-dir=b'build directory (where to install from)forcef-force installation (overwrite existing files) skip-buildNskip the build stepscCsd|_d|_d|_d|_dS)Nr) install_dirr build_dir skip_build)selfr'/usr/lib64/python3.6/install_scripts.pyinitialize_optionssz"install_scripts.initialize_optionscCs |jdd |jdd d d dS) NZbuild build_scriptsrZinstallrrr r)rr)rr)r r )rr)Zset_undefined_options)rrrrfinalize_options!s  z install_scripts.finalize_optionscCs|js|jd|j|j|j|_tjdkrxT|jD]H}|j rNt j d|q6tj |t dBd@}t j d||tj||q6WdS)Nrposixzchanging mode of %simizchanging mode of %s to %o)rZ run_commandZ copy_treerroutfilesosname get_outputsZdry_runrinfostatrchmod)rfilemoderrrrun)s  zinstall_scripts.runcCs |jjp gS)N)Z distributionscripts)rrrr get_inputs8szinstall_scripts.get_inputscCs |jpgS)N)r)rrrrr;szinstall_scripts.get_outputs)rrr)r r r )r r r)rNr) __name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsrrr$r&rrrrrrsr) __doc__rZdistutils.corerZ distutilsrr rrrrrrs    __pycache__/easy_install.cpython-36.pyc000064400000176663147210141470014115 0ustar003 K]T @sdZddlmZddlmZddlmZmZddlmZmZm Z m Z ddl m Z m Z ddlmZmZddlmZdd lmZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd l Z dd l!Z!dd l"Z"dd l#Z#dd l$Z$dd l%Z%dd l&m'Z'dd l(m)Z)m*Z*dd l+m,Z,ddl-m.Z.ddl/m0Z0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9m:Z:m;Z;ddl4mm?Z?ddl@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOdd lPZ@ejQde@jRdddddddgZSdd ZTd!dZUe'jVr2d"d#ZWd$d%ZXnd&d#ZWd'd%ZXd(d)ZYGd*dde,ZZd+d,Z[d-d.Z\d/d0Z]d1dZ^d2dZ_Gd3ddeGZ`Gd4d5d5e`Zaejbjcd6d7d8kreaZ`d9d:Zdd;d<Zed=d>Zfd?d@ZgdpdAdBZhdCdDZidEdFZjdGejkkrejZlndHdIZldqdKdLZmdMdNZndOdPZodQdRZpyddSlmqZrWnesk r^dTdUZrYnXdVdWZqGdXdYdYetZueujvZwGdZd[d[euZxGd\d]d]eyZzGd^d_d_ezZ{Gd`dadae{Z|ezj}Z}ezj~Z~dbdcZdddeZdfeefdgdhZdidjZdkdlZdrdmdZe"jdndoZd S)sa% Easy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ https://setuptools.readthedocs.io/en/latest/easy_install.html )glob) get_platform) convert_path subst_vars)DistutilsArgErrorDistutilsOptionErrorDistutilsErrorDistutilsPlatformError)INSTALL_SCHEMES SCHEME_KEYS)logdir_util) first_line_re)find_executableN)six) configparsermap)Command) run_setup)get_pathget_config_vars) rmtree_safe)setopt)unpack_archive) PackageIndexparse_requirement_arg URL_SCHEME) bdist_eggegg_info)Wheel) yield_linesnormalize_pathresource_stringensure_directoryget_distributionfind_distributions Environment Requirement Distribution PathMetadata EggMetadata WorkingSetDistributionNotFoundVersionConflict DEVELOP_DISTdefault)categorysamefile easy_installPthDistributionsextract_wininst_cfgmainget_exe_prefixescCstjddkS)NP)structcalcsizer;r;"/usr/lib/python3.6/easy_install.pyis_64bitIsr=cCsjtjj|otjj|}ttjdo&|}|r:tjj||Stjjtjj|}tjjtjj|}||kS)z Determine if two paths reference the same file. Augments os.path.samefile to work on Windows and suppresses errors if the path doesn't exist. r1)ospathexistshasattrr1normpathnormcase)Zp1Zp2Z both_existZ use_samefileZnorm_p1Znorm_p2r;r;r<r1MscCs|S)Nr;)sr;r;r< _to_ascii_srEc Cs*ytj|ddStk r$dSXdS)NasciiTF)rZ text_type UnicodeError)rDr;r;r<isasciibs  rHcCs |jdS)NrF)encode)rDr;r;r<rEjsc Cs(y|jddStk r"dSXdS)NrFTF)rIrG)rDr;r;r<rHms  cCstj|jjddS)N z; )textwrapdedentstripreplace)textr;r;r<usrPc@seZdZdZdZdZdddddddddddddddddddddgZdd dd dd0d3d9ddddZ?ejdj Z@ddZAddZBddZCddZDddZEddZFddZGddZHejdj ZIddZJddZKddZLeMeMddddZNeMdddZOddZPdS)r2z'Manage a download/build/install processz Find/get/install Python packagesTprefix=Ninstallation prefixzip-okzinstall package as a zipfile multi-versionm%make apps have to require() a versionupgradeU1force upgrade (searches PyPI for latest versions) install-dir=dinstall package to DIR script-dir=rDinstall scripts to DIRexclude-scriptsxDon't install scripts always-copya'Copy all needed packages to install dir index-url=i base URL of Python Package Index find-links=f(additional URL(s) to search for packagesbuild-directory=b/download/extract/build in DIR; keep the results optimize=Olalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]record=3filename in which to record list of installed files always-unzipZ*don't install as a zipfile, no matter what site-dirs=S)list of directories where .pth files workeditablee+Install specified packages in editable formno-depsNdon't install dependencies allow-hosts=H$pattern(s) that hostnames must matchlocal-snapshots-okl(allow building eggs from local checkoutsversion"print version information and exit no-find-links9Don't load find-links defined in packages being installedz!install in user site-package '%s'usercCs,d|_d|_|_d|_|_|_d|_d|_d|_d|_ d|_ |_ d|_ |_ |_d|_|_|_d|_|_|_d|_d|_d|_d|_d|_d|_d|_d|_d|_tjrtj |_!tj"|_#n d|_!d|_#d|_$d|_%d|_&|_'d|_(i|_)d|_*d|_+|j,j-|_-|j,j.||j,j/ddS)NrFr2)0rzip_oklocal_snapshots_ok install_dir script_direxclude_scripts index_url find_linksbuild_directoryargsoptimizerecordrY always_copy multi_versionr{no_deps allow_hostsrootprefix no_reportrinstall_purelibinstall_platlibinstall_headers install_libinstall_scripts install_data install_baseinstall_platbasesiteENABLE_USER_SITE USER_BASEinstall_userbase USER_SITEinstall_usersite no_find_links package_indexpth_filealways_copy_from site_dirsinstalled_projectssitepy_installedZ_dry_run distributionverboseZ_set_command_optionsget_option_dict)selfr;r;r<initialize_optionssF     zeasy_install.initialize_optionscCs"dd|D}tt|j|dS)Ncss*|]"}tjj|stjj|r|VqdS)N)r>r?r@islink).0filenamer;r;r< sz/easy_install.delete_blockers..)listr _delete_path)rblockersZextant_blockersr;r;r<delete_blockersszeasy_install.delete_blockerscCsJtjd||jrdStjj|o.tjj| }|r8tntj}||dS)Nz Deleting %s) r infodry_runr>r?isdirrrmtreeunlink)rr?Zis_treeZremoverr;r;r<rs  zeasy_install._delete_pathcCs6tjdd}td}d}t|jfttdS)zT Render the Setuptools version and installation details, then exit. N setuptoolsz=setuptools {dist.version} from {dist.location} (Python {ver}))sysrr$printformatlocals SystemExit)Zverdisttmplr;r;r<_render_versions zeasy_install._render_versionc Cst|jo |jtjjd}tdd\}}|jj|jj|jj||dd|d|d||||t tddd |_ t j r|j |j d <|j|j d <|j|j|j|jd d d d|jdkr|j|_|jdkrd|_|jdd!|jdd"|jr|jr|j|_|j|_|jdd#tttj}t|_|jdk rdd|jjdD}xV|D]N}t jj!|s~t"j#d|n,t||krt$|dn|jj%t|q^W|j&s|j'|j(pd|_(|jdd|_)x4|jt|jfD] }||j)kr|j)j*d|qW|j+dk r8dd|j+jdD}ndg}|j,dkr`|j-|j(|j)|d|_,t.|j)tj|_/|j0dk rt1|j0t2j3r|j0j|_0ng|_0|j4r|j,j5|j)tj|js|j,j6|j0|jdd$t1|j7t8s@y2t8|j7|_7d|j7kodknst9Wnt9k r>t$dYnX|j&rZ|j: rZt;d|j<sjt;d g|_=dS)%Nrr exec_prefixrabiflags) Z dist_nameZ dist_versionZ dist_fullname py_versionpy_version_shortpy_version_nodotZ sys_prefixrZsys_exec_prefixrruserbaseZusersiterrrrFrrinstallrcSsg|]}tjj|jqSr;)r>r? expanduserrM)rrDr;r;r< 3sz1easy_install.finalize_options..,z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.pathzhttps://pypi.org/simple/cSsg|] }|jqSr;)rM)rrDr;r;r<rHs*)Z search_pathhostsrz--optimize must be 0, 1, or 2z9Must specify a build directory (-b) when using --editablez:No urls, filenames, or requirements specified (see --help))rr)rr)rr)rr)>rrrsplitrrZget_nameZ get_versionZ get_fullnamegetattr config_varsrrrr_fix_install_dir_for_user_siteexpand_basedirs expand_dirs_expandrrrZset_undefined_optionsrrrrr!r? get_site_dirs all_site_dirsrr>rr warnrappendr{check_site_dirr shadow_pathinsertrr create_indexr& local_indexr isinstancerZ string_typesrZscan_egg_linksadd_find_linksrint ValueErrorrrroutputs) rrrrrBrr]Z path_itemrr;r;r<finalize_optionss                zeasy_install.finalize_optionscCs`|j stj rdS|j|jdkr2d}t||j|_|_tj j ddd}|j |dS)z; Fix the install_dir if "--user" was used. Nz$User base directory is not specifiedposixZunixZ_user) rrrcreate_home_pathrr rrr>namerN select_scheme)rmsgZ scheme_namer;r;r<rms z+easy_install._fix_install_dir_for_user_sitecCs\xV|D]N}t||}|dk rtjdks0tjdkrrr?rrrsetattr)rattrsattrvalr;r;r< _expand_attrs|s    zeasy_install._expand_attrscCs|jdddgdS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.rrrN)r)rr;r;r<rszeasy_install.expand_basedirscCsddddddg}|j|dS)z+Calls `os.path.expanduser` on install dirs.rrrrrrN)r)rdirsr;r;r<rszeasy_install.expand_dirsc Cs|j|jjkrtj|jzx|jD]}|j||j q$W|jr|j}|j rt |j }x(t t |D]}|||d||<qfWddl m }|j|j|j|fd|j|jWdtj|jjXdS)Nr) file_utilz'writing list of installed files to '%s')rrr set_verbosityrr2rrrrlenrange distutilsrexecuteZ write_filewarn_deprecated_options)rspecrZroot_lenZcounterrr;r;r<runs$       zeasy_install.runc CsDy tj}Wn"tk r.tjdtj}YnXtjj|j d|S)zReturn a pseudo-tempname base in the install directory. This code is intentionally naive; if a malicious party can write to the target directory you're already in deep doodoo. rztest-easy-install-%s) r>getpid ExceptionrandomZrandintrmaxsizer?joinr)rpidr;r;r<pseudo_tempnames  zeasy_install.pseudo_tempnamecCsdS)Nr;)rr;r;r<rsz$easy_install.warn_deprecated_optionscCsdt|j}tjj|d}tjj|sTytj|Wn ttfk rR|j YnX||j k}| rv|j rv|j }nd|j d}tjj|}y*|rtj|t|djtj|Wn ttfk r|j YnX| r|j rt|j|r|jdkrt||j |_nd|_|tttkr6d|_n$|j rZtjj| rZd|_d|_||_dS)z;Verify that self.install_dir is .pth-capable dir, if neededzeasy-install.pthz .write-testwNT)r!rr>r?r r@makedirsOSErrorIOErrorcant_write_to_targetrrcheck_pth_processingrropencloserno_default_version_msgrr3r _pythonpathr)rinstdirrZ is_site_dirZtestfileZ test_existsr;r;r<rs>         zeasy_install.check_site_diraS can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: %s The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s z This directory does not currently exist. Please create it and try again, or choose a different installation directory (using the -d or --install-dir option). a Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://setuptools.readthedocs.io/en/latest/easy_install.html Please make the appropriate changes for your system and try again. cCsP|jtjd|jf}tjj|js6|d|j7}n|d|j7}t |dS)NrJ) _easy_install__cant_write_msgrexc_inforr>r?r@_easy_install__not_exists_id_easy_install__access_msgr)rrr;r;r<rs z!easy_install.cant_write_to_targetc Cs|j}tjd||jd}|d}tjj|}tdd}y8|rNtj|tjj |}t j j |ddt |d}Wn ttfk r|jYnXz|j|jft|jd }tj}tjd krtjj|\}} tjj|d } | jd kotjj| } | r| }d dlm} | |dddgd tjj|rJtjd|dSWd |r\|jtjj|rttj|tjj|rtj|X|jstjd|dS)z@Empirically verify whether .pth files are supported in inst. dirz Checking .pth file support in %sz.pthz.okzz import os f = open({ok_file!r}, 'w') f.write('OK') f.close() rJT)exist_okrNrz pythonw.exez python.exer)spawnz-Ez-cpassz-TEST PASSED: %s appears to support .pth filesz+TEST FAILED: %s does NOT support .pth filesF)rr rrr>r?r@ _one_linerrdirname pkg_resourcesZ py31compatrrrrrwriterrrr executablerrr lowerdistutils.spawnr rr) rrrZok_fileZ ok_existsrr#rkr&basenameZaltZuse_altr r;r;r<rsV            z!easy_install.check_pth_processingcCs\|j rN|jdrNx:|jdD],}|jd|r2q|j|||jd|qW|j|dS)z=Write all the scripts for `dist`, unless scripts are excludedscriptszscripts/N)rZmetadata_isdirZmetadata_listdirinstall_scriptZ get_metadatainstall_wrapper_scripts)rr script_namer;r;r<install_egg_scriptsSsz easy_install.install_egg_scriptscCs\tjj|rLxJtj|D].\}}}x"|D]}|jjtjj||q(WqWn |jj|dS)N)r>r?rwalkrrr )rr?baserfilesrr;r;r< add_outputas    zeasy_install.add_outputcCs|jrtd|fdS)NzjInvalid argument %r: you can't use filenames or URLs with --editable (except via the --find-links option).)r{r)rrr;r;r< not_editableiszeasy_install.not_editablecCs<|js dStjjtjj|j|jr8td|j|jfdS)Nz2%r already exists in %s; can't do a checkout there)r{r>r?r@r rkeyr)rrr;r;r<check_editableqs zeasy_install.check_editablec cs@tjtjdd}zt|VWdtjj|o8tt |XdS)Nz easy_install-)r) tempfilemkdtemprustrr>r?r@rr)rtmpdirr;r;r<_tmpdir{szeasy_install._tmpdirFcCs|js|j|j}t|tst|rT|j||jj||}|j d|||dSt j j |r||j||j d|||dSt |}|j||jj|||j|j|j |j}|dkrd|}|jr|d7}t|n0|jtkr|j|||d|S|j ||j||SWdQRXdS)NTz+Could not find suitable distribution for %rz2 (--always-copy skips system and development eggs)Using)r{install_site_pyr;rr'rr3rdownload install_itemr>r?r@rr5Zfetch_distributionrYrrrZ precedencer.process_distributionlocation)rrdepsr:dlrrr;r;r<r2s2         zeasy_install.easy_installcCs|p|j}|ptjj||k}|p,|jd }|pT|jdk oTtjjt|t|jk}|r| rx$|j|jD]}|j |krnPqnWd}t j dtjj ||r|j |||}x<|D]}|j|||qWn |j|g}|j||d|d|dk rx|D]}||kr|SqWdS)Nz.eggTz Processing %srr<)rr>r?r#endswithrr!r project_namerAr rr) install_eggsr@egg_distribution)rrr>r:rBZinstall_neededrZdistsr;r;r<r?s.         zeasy_install.install_itemcCs@t|}x2tD]*}d|}t||dkrt||||qWdS)z=Sets the install directories by applying the install schemes.Zinstall_N)r r rr)rrschemer4Zattrnamer;r;r<rs  zeasy_install.select_schemecGs|j||jj|||j|jkr2|jj||jj||j|||j|j<tj |j ||f||j dr|j r|jj |jd| r|j rdS|dk r|j|jkrtjd|dS|dks||kr|j}tt|}tj d|ytgj|g|j|j}Wn^tk rB}ztt|WYdd}~Xn0tk rp}zt|jWYdd}~XnX|js|jrx*|D]"}|j|jkr|j|jqWtj d|dS)Nzdependency_links.txtzSkipping dependencies for %szProcessing dependencies for %sz'Finished processing dependencies for %s) update_pthraddrr4remover.rr rinstallation_report has_metadatarrZget_metadata_linesrras_requirementr'r9r+Zresolver2r,rr-Zreportr)rZ requirementrrBrZdistreqZdistrosr|r;r;r<r@sB            z!easy_install.process_distributioncCs2|jdk r|j S|jdr dS|jds.dSdS)Nz not-zip-safeTzzip-safeF)rrM)rrr;r;r< should_unzips   zeasy_install.should_unzipcCstjj|j|j}tjj|r:d}tj||j|j||Stjj|rL|}nRtjj ||krftj |tj |}t |dkrtjj||d}tjj|r|}t |tj|||S)Nz<%r already exists in %s; build directory %s will not be keptrr)r>r?r rr4r@r rrr#rlistdirrr#shutilmove)rr dist_filename setup_basedstrcontentsr;r;r< maybe_moves"       zeasy_install.maybe_movecCs0|jr dSx tjj|D]}|j|qWdS)N)r ScriptWriterbestget_args write_script)rrrr;r;r<r,sz$easy_install.install_wrapper_scriptscCsNt|j}t||}|r8|j|t}tj||}|j|t|ddS)z/Generate a legacy script wrapper and install itrnN) r9rNis_python_script_load_templaterrX get_headerr[rE)rrr- script_textdev_pathrZ is_scriptZbodyr;r;r<r+"s   zeasy_install.install_scriptcCs(d}|r|jdd}td|}|jdS)z There are a couple of template scripts in the package. This function loads one of them and prepares it for use. z script.tmplz.tmplz (dev).tmplrzutf-8)rNr"decode)r`rZ raw_bytesr;r;r<r],s   zeasy_install._load_templatetc sjfdd|Dtjd|jtjjj|}j|jrLdSt }t |tjj |rptj |t |d|}|j|WdQRXt|d|dS)z1Write an executable file to the scripts directorycsg|]}tjjj|qSr;)r>r?r r)rrb)rr;r<r>sz-easy_install.write_script..zInstalling %s script to %sNri)rr rrr>r?r r2r current_umaskr#r@rrr%chmod)rr-rVmodertargetmaskrkr;)rr<r[;s   zeasy_install.write_scriptcCs`|jjdr|j||gS|jjdr8|j||gS|jjdrT|j||gS|}tjj|r|jd rt|||j ntjj |rtjj |}|j |r|j r|dk r|j|||}tjj|d}tjj|s2ttjj|dd}|stdtjj |t|dkr*td tjj ||d }|jrPtj|j||gS|j||SdS) Nz.eggz.exez.whlz.pyzsetup.pyrz"Couldn't find a setup script in %srzMultiple setup scripts in %sr)r'rD install_egg install_exe install_wheelr>r?isfilerunpack_progressrabspath startswithrrWr r@rrrr{r rreport_editablebuild_and_install)rrrSr:rT setup_scriptZsetupsr;r;r<rFOs<   zeasy_install.install_eggscCs>tjj|r"t|tjj|d}nttj|}tj ||dS)NzEGG-INFO)metadata) r>r?rr)r r* zipimport zipimporterr(Z from_filename)regg_pathrrr;r;r<rG{s    zeasy_install.egg_distributionc Cstjj|jtjj|}tjj|}|js2t||j|}t ||s|tjj |rttjj | rtt j ||jdn"tjj|r|jtj|fd|yd}tjj |r|j|rtjd}}n tjd}}nL|j|r|j||jd}}n*d}|j|rtjd}}n tjd}}|j|||f|dtjj|tjj|ft||d Wn$tk rzt|dd YnX|j||j|S) N)rz Removing FZMovingZCopyingZ ExtractingTz %s to %s)fix_zipimporter_caches)r>r?r rr)rmrr#rGr1rrr remove_treer@rrrnrQrRZcopytreerOZmkpathunpack_and_compileZcopy2r#update_dist_cachesr r2)rrur: destinationrZnew_dist_is_zippedrkrWr;r;r<rhsT               zeasy_install.install_eggc sTt|}|dkrtd|td|jdd|jddtd}tjj||jd}||_ |d}tjj|d}tjj|d }t |t |||_ |j ||tjj|st|d } | jd x<|jdD].\} } | d kr| jd | jddj| fqW| jtjj|d|jfddtj|Dtj|||j|jd|j||S)Nz(%s is not a valid distutils Windows .exerrrr)rErplatformz.eggz.tmpzEGG-INFOzPKG-INFOrzMetadata-Version: 1.0 target_versionz%s: %s _-r*csg|]}tjj|dqS)r)r>r?r )rr)rr;r<rsz,easy_install.install_exe..)rr)r4rr(getrr>r?r egg_namerAr#r)Z _provider exe_to_eggr@rr%itemsrNtitlerrrXrZrZ make_zipfilerrrh) rrSr:cfgrruegg_tmpZ _egg_infoZpkg_infrkkvr;)rr<ris<      " zeasy_install.install_exec s>t|ggifdd}t||g}xtD]l}|jjdr>|jd}|d}tj|dd|d<tjj f|}j ||j |tj ||q>W|j tj tjj dtj|xbdD]Z} t| rtjj d| d } tjj| st| d } | jd j t| d | jqWd S)z;Extract a bdist_wininst to the directories an egg would usecs|j}xԈD]\}}|j|r||t|d}|jd}tjjf|}|j}|jdsl|jdrtj |d |d <dtjj |dd<j |n4|jdr|dkrdtjj |dd<j ||SqW|jdst j d |dS) N/z.pydz.dllrrz.pyzSCRIPTS/z.pthzWARNING: can't process %sr)r'rnrrr>r?r rDr strip_modulesplitextrr r)srcrUrDoldnewpartsrC)r native_libsprefixes to_compile top_levelr;r<processs$      z(easy_install.exe_to_egg..processz.pydrrz.pyzEGG-INFOrrz.txtrrJNrrr)rr)r6rr'rDrrrr>r?r rZ write_stub byte_compileZwrite_safety_flagZ analyze_eggrr@rr%r) rrSrrZstubsresrZresourceZpyfilerZtxtrkr;)rrrrrr<rs6           zeasy_install.exe_to_eggc Cst|}|jsttjj|j|j}tjj|}|j sBt |tjj |rntjj | rnt j||j dn"tjj|r|jtj|fd|z.|j|j|fdtjj|tjj|fWdt|ddX|j||j|S)N)rz Removing zInstalling %s to %sF)rv)rZ is_compatibleAssertionErrorr>r?r rrrmrr#rrr rwr@rrZinstall_as_eggr)r#ryr2rG)rZ wheel_pathr:Zwheelrzr;r;r<rjs.      zeasy_install.install_wheela( Because this distribution was installed --multi-version, before you can import modules from this package in an application, you will need to 'import pkg_resources' and then use a 'require()' call similar to one of these examples, in order to select the desired version: pkg_resources.require("%(name)s") # latest installed version pkg_resources.require("%(name)s==%(version)s") # this exact version pkg_resources.require("%(name)s>=%(version)s") # this version or higher z Note also that the installation directory must be on sys.path at runtime for this to work. (e.g. by being the application's script directory, by being on PYTHONPATH, or by being added to sys.path by your code.) Installedc Cs`d}|jr@|j r@|d|j7}|jtttjkr@|d|j7}|j }|j }|j }d}|t S)z9Helpful installation message for display to package usersz %(what)s %(eggloc)s%(extras)srJr) rr_easy_install__mv_warningrrr!rr?_easy_install__id_warningrArErr) rZreqrZwhatrZegglocrrZextrasr;r;r<rLIsz easy_install.installation_reportaR Extracted editable version of %(spec)s to %(dirname)s If it uses setuptools in its setup script, you can activate it in "development" mode by going to that directory and running:: %(python)s setup.py develop See the setuptools documentation for the "develop" command for more info. cCs"tjj|}tj}d|jtS)NrJ)r>r?r#rr&_easy_install__editable_msgr)rrrqr#pythonr;r;r<robs zeasy_install.report_editablecCstjjdttjjdtt|}|jdkrNd|jd}|jdd|n|jdkrd|jdd|jrv|jdd t j d |t |ddd j |yt ||Wn6tk r}ztd |jdfWYdd}~XnXdS) Nzdistutils.command.bdist_eggzdistutils.command.egg_inforrrrr~z-qz-nz Running %s %s zSetup script exited with %s)rmodules setdefaultrrrrrrr rrr rrrr)rrqrTrrr;r;r<rgs      zeasy_install.run_setupc Csddg}tjdtjj|d}z|jtjj||j||j|||t|g}g}x2|D]*}x$||D]}|j|j |j |qlWq^W| r|j rt j d||St|t j|jXdS)Nrz --dist-dirz egg-dist-tmp-)rdirz+No eggs found in %s (setup script problem?))r6r7r>r?r#_set_fetcher_optionsrrr&rhrArr rrrr) rrqrTrZdist_dirZall_eggsZeggsr4rr;r;r<rp{s$   zeasy_install.build_and_installc Cst|jjdj}d }i}x2|jD]&\}}||kr4q"|d||jdd <q"Wt|d }tjj|d }t j ||d S)a When easy_install is about to run bdist_egg on a source dist, that source dist might have 'setup_requires' directives, requiring additional fetching. Ensure the fetcher options given to easy_install are available to that command as well. r2rrrrrrr}r~)r2z setup.cfgN)rrrrrr) rrcopyrrNdictr>r?r rZ edit_config) rr0Zei_optsZfetch_directivesZ fetch_optionsr4rZsettingsZ cfg_filenamer;r;r<rs  z!easy_install._set_fetcher_optionscCs0|jdkrdSxX|j|jD]H}|js2|j|jkrtjd||jj||j|jkr|jj|jqW|js|j|jjkrtjd|n2tjd||jj ||j|jkr|jj |j|j s,|jj |jdkr,t jj|jd}t jj|rt j|t|d}|j|jj|jd|jdS)Nz&Removing %s from easy-install.pth filez4%s is already the active version in easy-install.pthz"Adding %s to easy-install.pth filerzsetuptools.pthwtrJ)rr4rrAr rrKrpathsrJrrsaver>r?r rrrrr% make_relativer)rrr]rrkr;r;r<rIs4           zeasy_install.update_pthcCstjd|||S)NzUnpacking %s to %s)r debug)rrrUr;r;r<rlszeasy_install.unpack_progresscshggfdd}t|||jjsdx.D]&}tj|tjdBd@}t||q:WdS)Ncs\|jdr"|jd r"j|n|jds6|jdr@j|j||j rX|pZdS)Nz.pyz EGG-INFO/z.dllz.so)rDrnrrlr)rrU)rto_chmodrr;r<pfs    z+easy_install.unpack_and_compile..pfimi)rrrr>statST_MODErd)rrurzrrkrer;)rrrr<rxs   zeasy_install.unpack_and_compilec Csjtjr dSddlm}z@tj|jd||dd|jd|jrT|||jd|jdWdtj|jXdS)Nr)rr)rforcer) rdont_write_bytecodedistutils.utilrr rrrr)rrrr;r;r<rs zeasy_install.byte_compilea bad install directory or PYTHONPATH You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s and your PYTHONPATH environment variable currently contains: %r Here are some of your options for correcting the problem: * You can choose a different installation directory, i.e., one that is on PYTHONPATH or supports .pth files * You can add the installation directory to the PYTHONPATH environment variable. (It must then also be on PYTHONPATH whenever you run Python and want to use the package(s) you are installing.) * You can set up the installation directory to support ".pth" files by using one of the approaches described here: https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations Please make the appropriate changes for your system and try again.cCs|j}||jtjjddfS)N PYTHONPATHr)_easy_install__no_default_msgrr>environr)rtemplater;r;r<rsz#easy_install.no_default_version_msgcCs|jr dStjj|jd}tdd}|jd}d}tjj|rtj d|jt j |}|j }WdQRX|j dstd |||krtjd ||jst|t j |d dd }|j|WdQRX|j|gd |_dS)z8Make sure there's a site.py in the target dir, if neededNzsite.pyrz site-patch.pyzutf-8rzChecking existing site.py in %sz def __boot():z;%s is not a setuptools-generated site.py; please remove it.z Creating %sr)encodingT)rr>r?r rr"rar@r riorreadrnrrrr#r%r)rZsitepysourceZcurrentZstrmr;r;r<r=s,       zeasy_install.install_site_pycCsj|js dSttjjd}xJtj|jD]:\}}|j|r(tjj | r(|j d|tj |dq(WdS)zCreate directories under ~.N~zos.makedirs('%s', 0o700)i) rrr>r?rrZ iteritemsrrnrZ debug_printr)rhomerr?r;r;r<r>szeasy_install.create_home_pathz/$base/lib/python$py_version_short/site-packagesz $base/bin)rr)rz$base/Lib/site-packagesz $base/ScriptscGs|jdj}|jrh|j}|j|d<|jjtj|j}x0|j D]$\}}t ||ddkr@t |||q@Wddl m }xJ|D]B}t ||}|dk rz|||}tjdkrtjj|}t |||qzWdS)Nrr0r)rr)Zget_finalized_commandrrrr rr>rDEFAULT_SCHEMErrrrrr?r)rrrrHrrrr;r;r<rTs         zeasy_install._expand)rQNrR)rSrTrU)rVrWrX)rYrZr[)r\r]r^)r_rDr`)rarbrc)rdrerf)rgrhri)rjrkrl)rmrnro)rprqrr)rsNrt)rurvrw)rxryrz)r{r|r})r~rr)rrr)rrr)rNr)rNr)F)F)T)N)r)Q__name__ __module__ __qualname____doc__ descriptionZcommand_consumes_argumentsZ user_optionsZboolean_optionsrrrZhelp_msgrZ negative_optrrrrr staticmethodrrrrrrrrrrrKrLlstriprrrrrr.r2r3r5 contextlibcontextmanagerr;r2r?rr@rOrWr,r+r]r[rFrGrhrirrjrrrLrrorrprrIrlrxrrrr=rrr rrr;r;r;r<r2xs    0 z   0    ;  $ $ '  ,6-5   %    cCs tjjddjtj}td|S)Nrr)r>rrrpathsepfilter)rr;r;r<rksrc Csg}|jttjg}tjtjkr0|jtjx|D]}|r6tjdkr`|jtjj |ddn\tj dkr|jtjj |ddtj dd dtjj |dd gn|j|tjj |ddgtjd kr6d |kr6tj j d }|r6tjj |ddtj dd d}|j|q6Wtdtdf}x"|D]}||kr |j|q WtjrR|jtjy|jtjWntk rzYnXttt|}|S)z& Return a list of 'site' dirs os2emxriscosZLibz site-packagesrlibrNrz site-pythondarwinzPython.frameworkHOMELibraryPythonpurelibplatlib)rr)extendrrrrrr{r>r?r seprrrrrrrgetsitepackagesAttributeErrorrrr!)sitedirsrrrZhome_spZ lib_pathsZsite_libr;r;r<rpsV            rccsi}x|D]}t|}||kr q d||<tjj|s6q tj|}||fVx|D]}|jds`qP|dkrjqPttjj||}tt |}|j xP|D]H}|j dst|j }||krd||<tjj|sq|tj|fVqWqPWq WdS)zBYield sys.path directories that might contain "old-style" packagesrz.ptheasy-install.pthsetuptools.pthimportN)rr) r!r>r?rrPrDrr rr rrnrstrip)Zinputsseenr#r1rrklinesliner;r;r< expand_pathss4           rc Cs&t|d}z tj|}|dkr$dS|d|d|d}|dkrHdS|j|dtjd|jd\}}}|dkrzdS|j|d|d d d }tj|}y<|j|} | j d d d} | j t j } |j tj| Wntjk rdSX|jd s|jd rdS|S|jXdS)znExtract configuration data from a bdist_wininst .exe Returns a configparser.RawConfigParser, or None rbN  zegg path translations for a given .exe filePURELIB/rPLATLIB/pywin32_system32PLATLIB/SCRIPTS/EGG-INFO/scripts/DATA/lib/site-packagesrrrzPKG-INFOrz .egg-inforNz EGG-INFO/z.pthz -nspkg.pthPURELIBPLATLIB\rz%s/%s/cSsg|]\}}|j|fqSr;)r')rrbyr;r;r<r$sz$get_exe_prefixes..)rr)rr)rr)rr)rr)rr)rZZipFileZinfolistrrrrDrr upperrrZPY3rar rMrNrnrrsortreverse)Z exe_filenamerrTrrrrVZpthr;r;r<r6s>     & c@sTeZdZdZdZffddZddZddZed d Z d d Z d dZ ddZ dS)r3z)A .pth file with Distribution paths in itFcCsp||_ttt||_ttjj|j|_|j t j |gddx(t |j D]}tt|jt|dqNWdS)NT)rrrr!rr>r?r#basedir_loadr&__init__r rrJr%)rrrr?r;r;r<r/szPthDistributions.__init__cCsg|_d}tj|j}tjj|jrt|jd}x|D]}|j drJd}q6|j }|jj ||j s6|j j drxq6t tjj|j|}|jd<tjj| s||kr|jjd|_q6d||<q6W|j|jr| rd|_x&|jo|jdj r |jjqWdS) NFZrtrT#rrr)rrfromkeysrr>r?rkrrrnrrrMr!r rr@popdirtyr)rZ saw_importrrkrr?r;r;r<r8s2        zPthDistributions._loadc Cs|js dStt|j|j}|rtjd|j|j|}dj |d}t j j |jr`t j |jt|jd}|j|WdQRXn(t j j|jrtjd|jt j |jd|_dS)z$Write changed .pth file back to diskNz Saving %srJrzDeleting empty %sF)rrrrrr rr _wrap_linesr r>r?rrrr%r@)rZ rel_pathsrdatarkr;r;r<rWs   zPthDistributions.savecCs|S)Nr;)rr;r;r<rmszPthDistributions._wrap_linescCsN|j|jko$|j|jkp$|jtjk}|r>|jj|jd|_tj||dS)z"Add `dist` to the distribution mapTN) rArrr>getcwdrrr&rJ)rrnew_pathr;r;r<rJqs  zPthDistributions.addcCs6x$|j|jkr$|jj|jd|_qWtj||dS)z'Remove `dist` from the distribution mapTN)rArrKrr&)rrr;r;r<rKs zPthDistributions.removecCstjjt|\}}t|j}|g}tjdkr2dp6tj}xVt||kr||jkrn|jtj |j |j |Stjj|\}}|j|q:W|SdS)Nr) r>r?rr!rraltseprrcurdirrr )rr?ZnpathZlastZbaselenrrr;r;r<rs    zPthDistributions.make_relativeN) rrrrrrrrrrrJrKrr;r;r;r<r3*s  c@s(eZdZeddZedZedZdS)RewritePthDistributionsccs(|jVx|D] }|VqW|jVdS)N)preludepostlude)clsrrr;r;r<rs  z#RewritePthDistributions._wrap_linesz? import sys sys.__plen = len(sys.path) z import sys new = sys.path[sys.__plen:] del sys.path[sys.__plen:] p = getattr(sys, '__egginsert', 0) sys.path[p:p] = new sys.__egginsert = p + len(new) N)rrr classmethodrr"rr r;r;r;r<rs  rZSETUPTOOLS_SYS_PATH_TECHNIQUErawZrewritecCs ttjtrtStjtjjS)z_ Return a regular expression based on first_line_re suitable for matching strings. )rrpatternr9recompilerar;r;r;r<_first_line_res rcCsd|tjtjgkr.tjdkr.t|tj||Stj\}}}t j ||d|dd||ffdS)Nrrrz %s %s) r>rrKrrdrS_IWRITErrrZreraise)funcargexcZetZevr}r;r;r< auto_chmods  rcCs.t|}t|tj|r"t|nt|dS)aa Fix any globally cached `dist_path` related data `dist_path` should be a path of a newly installed egg distribution (zipped or unzipped). sys.path_importer_cache contains finder objects that have been cached when importing data from the original distribution. Any such finders need to be cleared since the replacement distribution might be packaged differently, e.g. a zipped egg distribution might get replaced with an unzipped egg folder or vice versa. Having the old finders cached may then cause Python to attempt loading modules from the replacement distribution using an incorrect loader. zipimport.zipimporter objects are Python loaders charged with importing data packaged inside zip archives. If stale loaders referencing the original distribution, are left behind, they can fail to load modules from the replacement distribution. E.g. if an old zipimport.zipimporter instance is used to load data from a new zipped egg archive, it may cause the operation to attempt to locate the requested data in the wrong location - one indicated by the original distribution's zip archive directory information. Such an operation may then fail outright, e.g. report having read a 'bad local file header', or even worse, it may fail silently & return invalid data. zipimport._zip_directory_cache contains cached zip archive directory information for all existing zipimport.zipimporter instances and all such instances connected to the same archive share the same cached directory information. If asked, and the underlying Python implementation allows it, we can fix all existing zipimport.zipimporter instances instead of having to track them down and remove them one by one, by updating their shared cached zip archive directory information. This, of course, assumes that the replacement distribution is packaged as a zipped egg. If not asked to fix existing zipimport.zipimporter instances, we still do our best to clear any remaining zipimport.zipimporter related cached data that might somehow later get used when attempting to load data from the new distribution and thus cause such load operations to fail. Note that when tracking down such remaining stale data, we can not catch every conceivable usage from here, and we clear only those that we know of and have found to cause problems if left alive. Any remaining caches should be updated by whomever is in charge of maintaining them, i.e. they should be ready to handle us replacing their zip archives with new distributions at runtime. N)r!_uncacherpath_importer_cache!_replace_zip_directory_cache_data*_remove_and_clear_zip_directory_cache_data)Z dist_pathrvnormalized_pathr;r;r<rys <  rycCsTg}t|}xB|D]:}t|}|j|r|||dtjdfkr|j|qW|S)ap Return zipimporter cache entry keys related to a given normalized path. Alternative path spellings (e.g. those using different character case or those using alternative path separators) related to the same path are included. Any sub-path entries are included as well, i.e. those corresponding to zip archives embedded in other zip archives. rr)rr!rnr>rr)rcacheresultZ prefix_lenpZnpr;r;r<"_collect_zipimporter_cache_entriess   rcCsDx>t||D]0}||}||=|o*|||}|dk r |||<q WdS)a Update zipimporter cache data for a given normalized path. Any sub-path entries are processed as well, i.e. those corresponding to zip archives embedded in other zip archives. Given updater is a callable taking a cache entry key and the original entry (after already removing the entry from the cache), and expected to update the entry and possibly return a new one to be inserted in its place. Returning None indicates that the entry should not be replaced with a new one. If no updater is given, the cache entries are simply removed without any additional processing, the same as if the updater simply returned None. N)r)rrupdaterr old_entryZ new_entryr;r;r<_update_zipimporter_cache*s  r!cCst||dS)N)r!)rrr;r;r<rJsrcCsdd}t|tj|ddS)NcSs |jdS)N)clear)r?r r;r;r<2clear_and_remove_cached_zip_archive_directory_dataOszf_remove_and_clear_zip_directory_cache_data..clear_and_remove_cached_zip_archive_directory_data)r)r!rs_zip_directory_cache)rr#r;r;r<rNsrZ__pypy__cCsdd}t|tj|ddS)NcSs&|jtj||jtj||S)N)r"rsrtupdater$)r?r r;r;r<)replace_cached_zip_archive_directory_dataes zT_replace_zip_directory_cache_data..replace_cached_zip_archive_directory_data)r)r!rsr$)rr&r;r;r<rds rc Cs2yt||dWnttfk r(dSXdSdS)z%Is this string a valid Python script?execFTN)r SyntaxError TypeError)rOrr;r;r< is_pythonws r+cCsJy(tj|dd}|jd}WdQRXWnttfk r@|SX|dkS)zCDetermine if the specified executable is a .sh (contains a #! line)zlatin-1)rrNz#!)rrrrr)r&fpmagicr;r;r<is_shs r.cCs tj|gS)z@Quote a command line argument according to Windows parsing rules) subprocess list2cmdline)rr;r;r< nt_quote_argsr1cCsH|jds|jdrdSt||r&dS|jdrDd|jdjkSdS)zMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc. z.pyz.pywTz#!rrF)rDr+rn splitlinesr')r_rr;r;r<r\s  r\)rdcGsdS)Nr;)rr;r;r<_chmodsr3cCsRtjd||yt||Wn0tjk rL}ztjd|WYdd}~XnXdS)Nzchanging mode of %s to %ozchmod failed: %s)r rr3r>error)r?rer|r;r;r<rds rdc@seZdZdZgZeZeddZeddZ eddZ edd Z ed d Z d d Z eddZddZeddZeddZdS) CommandSpeczm A command spec for a #! header, specified as a list of arguments akin to those passed to Popen. cCs|S)zV Choose the best CommandSpec class based on environmental conditions. r;)r r;r;r<rYszCommandSpec.bestcCstjjtj}tjjd|S)N__PYVENV_LAUNCHER__)r>r?rBrr&rr)r Z_defaultr;r;r<_sys_executableszCommandSpec._sys_executablecCs:t||r|St|tr ||S|dkr0|jS|j|S)zg Construct a CommandSpec from a parameter to build_scripts, which may be None. N)rrfrom_environment from_string)r Zparamr;r;r< from_params  zCommandSpec.from_paramcCs||jgS)N)r7)r r;r;r<r8szCommandSpec.from_environmentcCstj|f|j}||S)z} Construct a command spec from a simple string representing a command line parseable by shlex.split. )shlexr split_args)r stringrr;r;r<r9szCommandSpec.from_stringcCs8tj|j||_tj|}t|s4dg|jdd<dS)Nz-xr)r;r_extract_optionsoptionsr/r0rH)rr_cmdliner;r;r<install_optionss zCommandSpec.install_optionscCs:|djd}tj|}|r.|jdp0dnd}|jS)zH Extract any options from the first line of the script. rJrrr)r2rmatchgrouprM)Z orig_scriptfirstrBr?r;r;r<r>s zCommandSpec._extract_optionscCs|j|t|jS)N)_renderrr?)rr;r;r< as_headerszCommandSpec.as_headercCs6d}x,|D]$}|j|r |j|r |ddSq W|S)Nz"'rr)rnrD)itemZ_QUOTESqr;r;r< _strip_quotess  zCommandSpec._strip_quotescCs tjdd|D}d|dS)Ncss|]}tj|jVqdS)N)r5rIrM)rrGr;r;r<rsz&CommandSpec._render..z#!rJ)r/r0)rr@r;r;r<rEszCommandSpec._renderN)rrrrr?rr<r rYr7r:r8r9rArr>rFrIrEr;r;r;r<r5s       r5c@seZdZeddZdS)WindowsCommandSpecF)rN)rrrrr<r;r;r;r<rJsrJc@seZdZdZejdjZeZ e dddZ e dddZ e dd d Z ed d Ze d dZe ddZe ddZe dddZdS)rXz` Encapsulates behavior around writing entry point scripts for console and gui apps. a # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r __requires__ = %(spec)r import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point(%(spec)r, %(group)r, %(name)r)() ) NFcCs6tjdt|rtntj}|jd||}|j||S)Nz Use get_argsr)warningsrDeprecationWarningWindowsScriptWriterrXrYget_script_headerrZ)r rr&wininstwriterheaderr;r;r<get_script_argss zScriptWriter.get_script_argscCs6tjdt|rd}|jjj|}|j||jS)NzUse get_headerz python.exe)rKrrLcommand_spec_classrYr:rArF)r r_r&rOcmdr;r;r<rN's   zScriptWriter.get_script_headerc cs|dkr|j}t|j}xjdD]b}|d}xT|j|jD]B\}}|j||jt}|j||||} x| D] } | VqrWq>Wq"WdS)z Yield write_script() argument tuples for a distribution's console_scripts and gui_scripts entry points. NconsoleguiZ_scripts)rUrV) r^r9rNZ get_entry_mapr_ensure_safe_namerr_get_script_args) r rrQrtype_rCrZepr_rrr;r;r<rZ1s     zScriptWriter.get_argscCstjd|}|rtddS)z? Prevent paths in *_scripts entry point names. z[\\/]z+Path separators not allowed in script namesN)rsearchr)rZ has_path_sepr;r;r<rWCs zScriptWriter._ensure_safe_namecCs tjdt|rtjS|jS)NzUse best)rKrrLrMrY)r Z force_windowsr;r;r< get_writerLs zScriptWriter.get_writercCs.tjdkstjdkr&tjdkr&tjS|SdS)zD Select the best ScriptWriter for this environment. win32javarN)rr{r>r_namerMrY)r r;r;r<rYRszScriptWriter.bestccs|||fVdS)Nr;)r rYrrQr_r;r;r<rX\szScriptWriter._get_script_argsrcCs"|jjj|}|j||jS)z;Create a #! line, getting options (if any) from script_text)rSrYr:rArF)r r_r&rTr;r;r<r^as zScriptWriter.get_header)NF)NF)N)rN)rrrrrKrLrrr5rSr rRrNrZrrWr[rYrXr^r;r;r;r<rX s       rXc@sLeZdZeZeddZeddZeddZeddZ e d d Z d S) rMcCstjdt|jS)NzUse best)rKrrLrY)r r;r;r<r[ls zWindowsScriptWriter.get_writercCs"tt|d}tjjdd}||S)zC Select the best ScriptWriter suitable for Windows )r&ZnaturalZSETUPTOOLS_LAUNCHERr&)rWindowsExecutableLauncherWriterr>rr)r Z writer_lookupZlauncherr;r;r<rYrs zWindowsScriptWriter.bestc #stddd|}|tjdjjdkrBdjft}tj|t dddd d dd g}|j ||j ||}fd d |D}|||d|fVdS)z For Windows, add a .py extensionz.pyaz.pyw)rUrVZPATHEXT;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.z.pyz -script.pyz.pycz.pyoz.execsg|] }|qSr;r;)rrb)rr;r<rsz8WindowsScriptWriter._get_script_args..rbN) rr>rr'rrrrKr UserWarningrK_adjust_header) r rYrrQr_extrrrr;)rr<rXs   z$WindowsScriptWriter._get_script_argscCsNd}d}|dkr||}}tjtj|tj}|j||d}|j|rJ|S|S)z Make sure 'pythonw' is used for gui and and 'python' is used for console (regardless of what sys.executable is). z pythonw.exez python.exerV)r=repl)rrescape IGNORECASEsub _use_header)r rYZ orig_headerr rdZ pattern_ob new_headerr;r;r<rbs z"WindowsScriptWriter._adjust_headercCs$|ddjd}tjdkp"t|S)z Should _adjust_header use the replaced header? On non-windows systems, always use. On Windows systems, only use the replaced header if it resolves to an executable on the system. rr"r\r)rMrr{r)riZ clean_headerr;r;r<rhs zWindowsScriptWriter._use_headerN) rrrrJrSr r[rYrXrbrrhr;r;r;r<rMis    rMc@seZdZeddZdS)r_c #s|dkrd}d}dg}nd}d}dddg}|j||}fd d |D} |||d | fVd t|d fVtsd} | td fVdS)zG For Windows, add a .py extension and an .exe launcher rVz -script.pywz.pywZcliz -script.pyz.pyz.pycz.pyocsg|] }|qSr;r;)rrb)rr;r<rszDWindowsExecutableLauncherWriter._get_script_args..rbz.exernz .exe.manifestN)rbget_win_launcherr=load_launcher_manifest) r rYrrQr_Z launcher_typercrZhdrrZm_namer;)rr<rXs   z0WindowsExecutableLauncherWriter._get_script_argsN)rrrr rXr;r;r;r<r_sr_cCs2d|}tr|jdd}n |jdd}td|S)z Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string. z%s.exe.z-64.z-32.r)r=rNr")typeZ launcher_fnr;r;r<rks  rkcCs0tjtd}tjr|tS|jdtSdS)Nzlauncher manifest.xmlzutf-8)r$r"rrPY2varsra)rZmanifestr;r;r<rls  rlFcCstj|||S)N)rQr)r? ignore_errorsonerrorr;r;r<rsrcCstjd}tj||S)N)r>umask)Ztmpr;r;r<rcs  rccCs:ddl}tjj|jd}|tjd<tjj|tdS)Nr) rr>r?r#__path__rargvrr5)rZargv0r;r;r< bootstraps   rwc sddlm}ddlmGfddd}|dkrBtjdd}t0|fddd g|tjdpfd|d |WdQRXdS) Nr)setup)r(cseZdZdZfddZdS)z-main..DistributionWithoutHelpCommandsrc s(tj|f||WdQRXdS)N) _patch_usage _show_help)rrkw)r(r;r<rz sz8main..DistributionWithoutHelpCommands._show_helpN)rrrZ common_usagerzr;)r(r;r<DistributionWithoutHelpCommandssr|rz-qr2z-v)Z script_argsr-Z distclass)rrxZsetuptools.distr(rrvry)rvr{rxr|r;)r(r<r5s    c #sLddl}tjdjfdd}|jj}||j_z dVWd||j_XdS)Nrze usage: %(script)s [options] requirement_or_url ... or: %(script)s --help csttjj|dS)N)Zscript)rr>r?r))r-)USAGEr;r< gen_usage sz_patch_usage..gen_usage)Zdistutils.corerKrLrZcorer~)rr~Zsavedr;)r}r<ry s   ry)N)r')N)rrrrrrZdistutils.errorsrrrr Zdistutils.command.installr r rr r Zdistutils.command.build_scriptsrr(rrr>rsrQr6rrrr rKrKrr9rr/r;rZsetuptools.externrZsetuptools.extern.six.movesrrrrZsetuptools.sandboxrZsetuptools.py31compatrrZsetuptools.py27compatrZsetuptools.commandrZsetuptools.archive_utilrZsetuptools.package_indexrrrrrZsetuptools.wheelrr$r r!r"r#r$r%r&r'r(r)r*r+r,r-r.Zpkg_resources.py31compatfilterwarningsZ PEP440Warning__all__r=r1rorErHr"r2rrrr4r6r3rrrrrryrr!rrbuiltin_module_namesrr+r.r1r\rdr3 ImportErrorrr5r7Zsys_executablerJobjectrXrMr_rRrNrkrlrrcrwr5rryr;r;r;r< s           D |A))'l R    T`A  __pycache__/register.cpython-36.pyc000064400000020312147210141470013225 0ustar003 \-@sddZddlZddlZddlZddlZddlmZddlm Z ddl Tddl m Z Gddde Z dS) zhdistutils.command.register Implements the Distutils 'register' command (register with the repository). N)warn) PyPIRCCommand)*)logc@seZdZdZejdd gZejdddgZdd d fgZd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZd!ddZdS)"registerz7register the distribution with the Python package indexlist-classifiersN list the valid Trove classifiersstrictBWill stop the registering if the meta-data are not fully compliantverifycheckcCsdS)NT)selfr r /usr/lib64/python3.6/register.pyszregister.cCstj|d|_d|_dS)Nr)rinitialize_optionslist_classifiersr )rr r rrs zregister.initialize_optionscCs*tj|d|jfdd}||jjd<dS)Nr)r restructuredtextr )rr)rfinalize_optionsr distributionZcommand_options)rZ check_optionsr r rr$s zregister.finalize_optionscCsX|j|jx|jD]}|j|qW|jr<|jn|jrL|jn|jdS)N) r _set_configZget_sub_commandsZ run_commandZdry_runverify_metadatar classifiers send_metadata)rZcmd_namer r rrun+s  z register.runcCs8tdt|jjd}|j|j|_d|_|jdS)zDeprecated API.zddistutils.command.register.check_metadata is deprecated, use the check command insteadr rN)rPendingDeprecationWarningrZget_command_objZensure_finalizedr rr)rr r r rcheck_metadata:s zregister.check_metadatacCsz|j}|ikr@|d|_|d|_|d|_|d|_d|_n6|jd|jfkr^td|j|jdkrp|j|_d|_d S) z: Reads the configuration file and set attributes. usernamepassword repositoryrealmTZpypiz%s not found in .pypircFN)Z _read_pypircrrr r! has_configZDEFAULT_REPOSITORY ValueError)rconfigr r rrDs     zregister._set_configcCs*|jd}tjj|}tj|j|dS)z8 Fetch the list of classifiers from the server. z?:action=list_classifiersN)r urllibrequestZurlopenrinfo_read_pypi_response)rZurlZresponser r rrUs  zregister.classifierscCs&|j|jd\}}tjd||dS)zF Send the metadata to the package index server to be checked. r zServer response (%s): %sN)post_to_serverbuild_post_datarr')rcoderesultr r rr\szregister.verify_metadatac Cs|jrd}|j}|j}n d}d}}dj}x:||krf|jdtjt}|sTd}q.||kr.tdq.W|dkr|x|std}qtWx|st j d}qWt j j }t j j|jd }|j|j||||j|jd |\}}|jd ||ftj|d kr|jr||j_nj|jd tj|jd|jtjd}x&|jdkr\td}|s8d}q8W|jdkr|j||n|dkrddi} d| d<| d<| d<d| d<x| dstd| d<qWx| d| dkrNx| dst j d| d<qWx| dst j d| d<qW| d| dkrd| d<d| d<tdqWx| dsltd| d<qRW|j| \}}|d krtjd ||ntjdtjd nT|d!krdd"i} d| d<x| dstd#| d<qW|j| \}}tjd ||dS)$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. 1xz1 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: rZsubmitzServer response (%s): %szAI can store your PyPI login so future submissions will be faster.z (the login will be stored in %s)XZynzSave your login (y/N)?ny2z:actionusernamerZemailNZconfirmz 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.3Zpassword_resetzYour email address: )r"rrsplitannouncerINFOinputprintgetpassr%r&ZHTTPPasswordMgrparseZurlparser Z add_passwordr!r)r*rZ _get_rc_filelowerZ _store_pypircr') rZchoicerrchoicesauthhostr+r,datar r rrcs                     zregister.send_metadatacCs|jj}|d|j|j|j|j|j|j|j|j |j |j |j |j |j|j|jd}|ds|ds|drd|d<|S)Nz1.0)z:actionmetadata_versionr6versionZsummaryZ home_pageZauthorZ author_emaillicense descriptionkeywordsplatformrZ download_urlprovidesrequires obsoletesrJrKrLz1.1rD)rZmetadataZget_nameZ get_versionZget_descriptionZget_urlZ get_contactZget_contact_emailZ get_licenceZget_long_descriptionZ get_keywordsZ get_platformsZget_classifiersZget_download_urlZ get_providesZ get_requiresZ get_obsoletes)ractionmetarCr r rr*s* zregister.build_post_datacCsd|kr$|jd|d|jftjd}d|}|d}tj}x|jD]\}}t|tgtffkrp|g}xZ|D]R}t|}|j ||j d||j d|j ||rv|dd krv|j d qvWqJW|j ||j d |j j d }d |tt |d } t jj|j|| } t jjt jj|d} d}y| j| } Wnxt jjk r} z$|jrl| jj}| j| jf} WYdd} ~ XnJt jjk r} zdt| f} WYdd} ~ XnX|jr|j| }d} |jrd jdd|ddf}|j|tj| S)zC Post a query to the server, and return a string response. r6zRegistering %s to %sz3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254z --z--z* Content-Disposition: form-data; name="%s"z r  zutf-8z/multipart/form-data; boundary=%s; charset=utf-8)z Content-typezContent-length)Z password_mgrr/Nir0OK-K)r0rQ)r9r rr:ioStringIOitemstypestrwritegetvalueencodelenr%r&ZRequestZ build_openerZHTTPBasicAuthHandleropenerrorZ HTTPErrorZ show_responsefpreadr+msgZURLErrorr(join)rrCrAboundaryZ sep_boundaryZ end_boundaryZbodykeyvalueZheadersZreqopenerr,erbr r rr)sV         zregister.post_to_server)rNr)r Nr )N)__name__ __module__ __qualname__rGrZ user_optionsZboolean_optionsZ sub_commandsrrrrrrrrr*r)r r r rrs&  zr)__doc__r=rUZ urllib.parser%Zurllib.requestwarningsrZdistutils.corerZdistutils.errorsZ distutilsrrr r r rs   __pycache__/develop.cpython-36.opt-1.pyc000064400000014316147210141470014005 0ustar003 K]n@sddlmZddlmZddlmZmZddlZddlZddl Z ddl m Z ddl m Z mZmZddlmZddlmZddlZGd d d ejeZGd d d eZdS) ) convert_path)log)DistutilsErrorDistutilsOptionErrorN)six) Distribution PathMetadatanormalize_path) easy_install) namespacesc@sveZdZdZdZejddgZejdgZd Zd d Z d d Z ddZ e ddZ ddZddZddZddZdS)developzSet up package for developmentz%install package in 'development mode' uninstalluUninstall this source package egg-path=N-Set the path to be used in the .egg-link fileFcCs2|jrd|_|j|jn|j|jdS)NT)r Z multi_versionuninstall_linkZuninstall_namespacesinstall_for_developmentZwarn_deprecated_options)selfr/usr/lib/python3.6/develop.pyruns  z develop.runcCs&d|_d|_tj|d|_d|_dS)N.)r egg_pathr initialize_options setup_pathZalways_copy_from)rrrrr's  zdevelop.initialize_optionscCs|jd}|jr,d}|j|jf}t|||jg|_tj||j|j |j j t j d|jd}t jj|j||_|j|_|jdkrt jj|j|_t|j}tt jj|j|j}||krtd|t|t|t jj|j|jd|_|j|j|j|j|_dS)Negg_infoz-Please rename %r to %r before using 'develop'z*.eggz .egg-linkzA--egg-path must be a relative path from the install directory to ) project_name)get_finalized_commandZbroken_egg_inforrZegg_nameargsr finalize_optionsZexpand_basedirsZ expand_dirsZ package_indexscanglobospathjoin install_diregg_linkegg_baserabspathr rrrdist_resolve_setup_pathr)rZeitemplaterZ egg_link_fntargetrrrrr .s<           zdevelop.finalize_optionscCsh|jtjdjd}|tjkr0d|jdd}ttjj|||}|ttjkrdt d|ttj|S)z Generate a path from egg_base back to '.' where the setup script resides and ensure that path points to the setup path from $install_dir/$egg_path. /z../zGCan't get a consistent path to setup script from installation directory) replacer#seprstripcurdircountr r$r%r)r(r&rZ path_to_setupZresolvedrrrr+Xs zdevelop._resolve_setup_pathc CsDtjrt|jddr|jddd|jd|jd}t|j}|jd|d|jd|jddd|jd|jd}||_ ||j _ t ||j |j _n"|jd|jdd d|jd|jtjr|jtjdt_|jtjd |j|j|js,t|jd }|j|j d |jWdQRX|jd|j |j dS) NZuse_2to3FZbuild_pyr)Zinplacer)r(Z build_extr/zCreating %s (link to %s)w )rZPY3getattr distributionZreinitialize_commandZ run_commandrr Z build_librr*locationrrZ _providerZinstall_site_py setuptoolsZbootstrap_install_fromr Zinstall_namespacesrinfor'r(dry_runopenwriterZprocess_distributionZno_deps)rZbpy_cmdZ build_pathZei_cmdfrrrrks4          zdevelop.install_for_developmentcCstjj|jrztjd|j|jt|j}dd|D}|j||j g|j |j gfkrhtj d|dS|j sztj |j|j s|j|j|jjrtj ddS)NzRemoving %s (link to %s)cSsg|] }|jqSr)r2).0linerrr sz*develop.uninstall_link..z$Link points to %s: uninstall abortedz5Note: you must uninstall or replace scripts manually!)r#r$existsr'rr;r(r=closerrwarnr<unlinkZ update_pthr*r8scripts)rZ egg_link_filecontentsrrrrs    zdevelop.uninstall_linkc Cs||jk rtj||S|j|x^|jjp,gD]N}tjjt |}tjj |}t j |}|j }WdQRX|j||||q.WdS)N)r*r install_egg_scriptsinstall_wrapper_scriptsr8rGr#r$r)rbasenameior=readZinstall_script)rr*Z script_nameZ script_pathZstrmZ script_textrrrrIs     zdevelop.install_egg_scriptscCst|}tj||S)N)VersionlessRequirementr rJ)rr*rrrrJszdevelop.install_wrapper_scripts)r rr)rNr)__name__ __module__ __qualname____doc__ descriptionr Z user_optionsZboolean_optionsZcommand_consumes_argumentsrrr staticmethodr+rrrIrJrrrrr s  * /r c@s(eZdZdZddZddZddZdS) rNaz Adapt a pkg_resources.Distribution to simply return the project name as the 'requirement' so that scripts will work across multiple versions. >>> dist = Distribution(project_name='foo', version='1.0') >>> str(dist.as_requirement()) 'foo==1.0' >>> adapted_dist = VersionlessRequirement(dist) >>> str(adapted_dist.as_requirement()) 'foo' cCs ||_dS)N)_VersionlessRequirement__dist)rr*rrr__init__szVersionlessRequirement.__init__cCs t|j|S)N)r7rU)rnamerrr __getattr__sz"VersionlessRequirement.__getattr__cCs|jS)N)r)rrrras_requirementsz%VersionlessRequirement.as_requirementN)rOrPrQrRrVrXrYrrrrrNs rN)Zdistutils.utilrZ distutilsrZdistutils.errorsrrr#r"rLZsetuptools.externrZ pkg_resourcesrrr Zsetuptools.command.easy_installr r:r ZDevelopInstallerr objectrNrrrrs     4__pycache__/upload.cpython-36.opt-1.pyc000064400000012233147210141470013627 0ustar003 /f@sdZddlZddlZddlZddlZddlmZddlmZm Z m Z ddl m Z ddl mZmZddlmZddlmZdd lmZGd d d eZdS) zm distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to a package index). N)standard_b64encode)urlopenRequest HTTPError)urlparse)DistutilsErrorDistutilsOptionError) PyPIRCCommand)spawn)logc@sJeZdZdZejddgZejdgZdd Zd d Zd d Z ddZ dS)uploadzupload binary package to PyPIsignssign files to upload using gpg identity=iGPG identity used to sign filescCs,tj|d|_d|_d|_d|_d|_dS)NrF)r initialize_optionsusernamepassword show_responser identity)selfr/usr/lib64/python3.6/upload.pyr s  zupload.initialize_optionscCsvtj||jr |j r td|j}|ikrX|d|_|d|_|d|_|d|_ |j rr|j jrr|j j|_dS)Nz.Must use --sign for --identity to have meaningrr repositoryrealm) r finalize_optionsrr rZ _read_pypircrrrr distribution)rconfigrrrr(s     zupload.finalize_optionscCs>|jjsd}t|x$|jjD]\}}}|j|||qWdS)NzHMust create and upload files in one command (e.g. setup.py sdist upload))rZ dist_filesr upload_file)rmsgcommand pyversionfilenamerrrrun:s z upload.runc&)Cs^t|j\}}}}}} |s"|s"| r0td|j|d2krDtd||jr|ddd|g} |jrnd|jg| d d <t| |jd t|d } z | j} Wd| j X|j j } d d | j | j tjj|| f||tj| jd| j| j| j| j| j| j| j| j| j| j| j| j| j d}ytj!| j}WnPt"k r}z2d|}|j#|t$j%ddl&m'}|s|WYdd}~Xn X||d<d}|dkrt(j)\}}}|rd||f}n|dkrdt(j(dd}||d<|jrtjj|dt|dd jf|d<|j*d|j+j,d}d t-|j.d}d!}d"|j,d}|d#}t/j0}x|j1D]\}}d$|}t2|t3s|g}xr|D]j}t4|t5kr|d%|d7}|d}nt6|j,d&}|j7||j7|j,d&|j7d'|j7|qWqjW|j7||j8}d(||jf}|j#|t$j%d)|t6t9||d*} t:|j|| d+}!yt;|!}"|"j<}#|"j=}$Wnft>k r}z|j?}#|j=}$WYdd}~Xn8t@k r}z|j#t6|t$jAWYdd}~XnX|#d,kr8|j#d-|#|$ft$j%|jBrZ|jC|"}%d.jDd/d0|%d/d0f}|j#|t$j%n"d1|#|$f}|j#|t$jAtE|dS)3NzIncompatible url %shttphttpszunsupported schema Zgpgz --detach-signz-az --local-user)dry_runrbZ file_upload1z1.0)z:actionZprotocol_versionnameversioncontentZfiletyper$Z sha256_digestZmetadata_versionZsummaryZ home_pageZauthorZ author_emaillicense descriptionkeywordsplatformZ classifiersZ download_urlZprovidesZrequiresZ obsoletesz#calculating md5 checksum failed: %sr) get_fips_modeZ md5_digestrZ bdist_rpmzbuilt for %s %sZ bdist_dumbz built for %s)Ztersecommentz.ascZ gpg_signature:asciizBasic z3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s --s-- z+ Content-Disposition: form-data; name="%s"z; filename="%s"zutf-8s zSubmitting %s to %sz multipart/form-data; boundary=%s)z Content-typezContent-lengthZ Authorization)dataheaderszServer response (%s): %s -KzUpload failed (%s): %s)r'r()FrrAssertionErrorr rr r*openreadcloserZmetadataZget_nameZ get_versionospathbasenamehashlibZsha256Z hexdigestZget_descriptionZget_urlZ get_contactZget_contact_emailZ get_licenceZget_long_descriptionZ get_keywordsZ get_platformsZget_classifiersZget_download_urlZ get_providesZ get_requiresZ get_obsoletesZmd5 ValueErrorZannouncer INFOZ_hashlibr4r3distrrencoderdecodeioBytesIOitems isinstancelisttypetuplestrwritegetvaluelenrrZgetcoder"rcodeOSErrorZERRORrZ_read_pypi_responsejoinr)&rr#r$r%ZschemaZnetlocZurlZparamsZqueryZ fragmentsZgpg_argsfr/metar9Zdigester"r4r6rIr.idZ user_passZauthboundaryZ sep_boundaryZ end_boundaryZbodykeyvaluetitler:ZrequestresultZstatusreasontextrrrr!Bs                       zupload.upload_fileN)r rr)rrr) __name__ __module__ __qualname__r1r Z user_optionsZboolean_optionsrrr&r!rrrrr s r )__doc__rCrLr3rFbase64rZurllib.requestrrrZ urllib.parserZdistutils.errorsrrZdistutils.corer Zdistutils.spawnr Z distutilsr r rrrrs     __pycache__/build_py.cpython-36.opt-1.pyc000064400000024311147210141470014152 0ustar003 \ C@s~dZddlZddlZddlZddlmZddlmZddlTddl m Z m Z ddl m Z Gdd d eZGd d d ee ZdS) zHdistutils.command.build_py Implements the Distutils 'build_py' command.N)glob)Command)*) convert_path Mixin2to3)logc@seZdZdZd8d9d:d;dbuild_pyz5"build" pure Python modules (copy to build directory) build-lib=ddirectory to "build" (copy) tocompileccompile .py to .pyc no-compileN!don't compile .py files [default] optimize=Olalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]forcef2forcibly build everything (ignore file timestamps)cCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) build_lib py_modulespackage package_data package_dirr optimizer)selfr /usr/lib64/python3.6/build_py.pyinitialize_options szbuild_py.initialize_optionsc Cs|jddd|jj|_|jj|_|jj|_i|_|jjrbx&|jjjD]\}}t||j|<qHW|j|_ t |j t syt |j |_ Wn t tfk rtdYnXdS)NZbuildrrzoptimize must be 0, 1, or 2)rr)rr)Zset_undefined_options distributionpackagesrrritemsrget_data_files data_files isinstancerint ValueErrorAssertionErrorZDistutilsOptionError)rnamepathrrrfinalize_options*s"      zbuild_py.finalize_optionscCs:|jr|j|jr$|j|j|j|jdddS)Nr)include_bytecode)r build_modulesr"build_packagesbuild_package_data byte_compile get_outputs)rrrrrunCs z build_py.runcsg}|js|Sxr|jD]h}|j|}tjj|jg|jd}d|rRt|dfdd|j||D}|j ||||fqW|S)z?Generate list of '(package,src_dir,build_dir,filenames)' tuples.rcsg|]}|dqS)Nr).0file)plenrr tsz+build_py.get_data_files..) r"get_package_dirosr+joinrsplitlenfind_data_filesappend)rdatarsrc_dir build_dir filenamesr)r8rr$as   zbuild_py.get_data_filescs`|jjdg|jj|g}gx:|D]2}ttjj|t|}jfdd|Dq&WS)z6Return filenames for package's data files in 'src_dir'cs$g|]}|krtjj|r|qSr)r;r+isfile)r6fn)filesrrr9s z,build_py.find_data_files..)rgetrr;r+r<rextend)rrrBZglobspatternZfilelistr)rHrr?ys  zbuild_py.find_data_filescCshd}x^|jD]T\}}}}xF|D]>}tjj||}|jtjj||jtjj|||ddqWq WdS)z$Copy data files into build directoryNF) preserve_mode)r%r;r+r<mkpathdirname copy_file)rZlastdirrrBrCrDfilenametargetrrrr0s zbuild_py.build_package_datac Cs|jd}|js&|r tjj|SdSng}x|ry|jdj|}Wn*tk rn|jd|d|d=Yq,X|jd|tjj|Sq,W|jjd}|dk r|jd||rtjj|SdSdS)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).r4rErr5NrR)r=rr;r+r<KeyErrorinsertrI)rrr+tailZpdirrrrr:s(       zbuild_py.get_package_dircCsj|dkr8tjj|s td|tjj|s8td||rftjj|d}tjj|rZ|Stjd|dS)NrEz%package directory '%s' does not existz>supposed package directory '%s' exists, but is not a directoryz __init__.pyz!package init file '%s' not found z(or not a regular file)z8package init file '%s' not found (or not a regular file)) r;r+existsZDistutilsFileErrorisdirr<rFrwarn)rrrinit_pyrrr check_packages    zbuild_py.check_packagecCs&tjj|stjd||dSdSdS)Nz!file %s (for module %s) not foundFT)r;r+rFrrX)rmodule module_filerrr check_modules zbuild_py.check_modulec Cs|j||ttjj|d}g}tjj|jj}xX|D]P}tjj|}||krztjjtjj |d}|j |||fq8|j d|q8W|S)Nz*.pyrz excluding %s) rZrr;r+r<abspathr!Z script_namesplitextbasenamer@Z debug_print) rrrZ module_filesmodulesZ setup_scriptrZabs_fr[rrrfind_package_moduless   zbuild_py.find_package_modulesc Csi}g}x|jD]}|jd}dj|dd}|d}y||\}}Wn"tk rj|j|}d}YnX|s|j||} |df||<| r|j|d| ftjj||d} |j || sq|j||| fqW|S)aFinds 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. r4rr5__init__z.pyrRrR) rr=r<rSr:rZr@r;r+r]) rr"rar[r+rZ module_baserZcheckedrYr\rrr find_moduless*       zbuild_py.find_modulescCsRg}|jr|j|j|jrNx.|jD]$}|j|}|j||}|j|q&W|S)a4Compute 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.)rrJrdr"r:rb)rrarrmrrrfind_all_moduless   zbuild_py.find_all_modulescCsdd|jDS)NcSsg|] }|dqS)r5rRr)r6r[rrrr9-sz-build_py.get_source_files..)rf)rrrrget_source_files,szbuild_py.get_source_filescCs$|gt||dg}tjj|S)Nz.py)listr;r+r<)rrCrr[Z outfile_pathrrrget_module_outfile/szbuild_py.get_module_outfiler5cCs|j}g}xx|D]p\}}}|jd}|j|j||}|j||r|jr`|jtjj|dd|j dkr|jtjj||j dqW|dd|j D7}|S)Nr4rE) optimizationrcSs,g|]$\}}}}|D]}tjj||qqSr)r;r+r<)r6rrBrCrDrPrrrr9Cs z(build_py.get_outputs..) rfr=rirr@r importlibutilcache_from_sourcerr%)rr-raZoutputsrr[r\rPrrrr23s"       zbuild_py.get_outputscCsbt|tr|jd}nt|ttfs,td|j|j||}tj j |}|j ||j ||ddS)Nr4z:'package' must be a string (dot-separated), list, or tupler)rL) r&strr=rhtuple TypeErrorrirr;r+rNrMrO)rr[r\rZoutfiledirrrr build_moduleJs    zbuild_py.build_modulecCs.|j}x |D]\}}}|j|||qWdS)N)rdrr)rrarr[r\rrrr.Yszbuild_py.build_modulescCsLxF|jD]<}|j|}|j||}x |D]\}}}|j|||q(WqWdS)N)r"r:rbrr)rrrraZpackage_r[r\rrrr/bs   zbuild_py.build_packagescCstjr|jddSddlm}|j}|dtjkr>|tj}|jrZ||d|j ||j d|j dkr||||j |j ||j ddS)Nz%byte-compiling is disabled, skipping.r)r1r5)rrprefixdry_runrR) sysdont_write_bytecoderXdistutils.utilr1rr;sepr rrtr)rrHr1rsrrrr1vs    zbuild_py.byte_compile)r r r )r r r)rNr)rrr)rrr)r5)__name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsZ negative_optr r,r3r$r?r0r:rZr]rbrdrfrgrir2rrr.r/r1rrrrrs8   '4  rc@seZdZddZddZdS) build_py_2to3cCsLg|_|jr|j|jr*|j|j|j|j|j|jdddS)Nr)r-) updated_filesrr.r"r/r0Zrun_2to3r1r2)rrrrr3s zbuild_py_2to3.runcCs,tj||||}|dr(|jj|d|S)Nr5r)rrrr~r@)rr[r\rresrrrrrszbuild_py_2to3.build_moduleN)ryrzr{r3rrrrrrr}sr})__doc__r;importlib.utilrkrurZdistutils.corerZdistutils.errorsrwrrZ distutilsrrr}rrrrs   }__pycache__/egg_info.cpython-36.opt-1.pyc000064400000050633147210141470014126 0ustar003 K]`@sdZddlmZddlmZddlmZddlm Z ddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'j(Z(ddl)m*Z*ddlm+Z+ddZ,GdddeZ-GdddeZGdddeZ.ddZ/ddZ0ddZ1dd Z2d!d"Z3d#d$Z4d%d&Z5d'd(Z6d0d*d+Z7d,d-Z8d.d/Z9dS)1zUsetuptools.command.egg_info Create a distribution's .egg-info directory and contents)FileList)DistutilsInternalError) convert_path)logN)six)map)Command)sdist) walk_revctrl) edit_config) bdist_egg)parse_requirements safe_name parse_version safe_version yield_lines EntryPointiter_entry_points to_filename)glob) packagingcCsd}|jtjj}tjtj}d|f}xt|D]\}}|t|dk}|dkrv|rd|d7}q4|d||f7}q4d}t|} x:|| kr||} | dkr||d7}n| d kr||7}n| d kr|d} | | kr|| d kr| d} | | kr|| d kr| d} x&| | kr6|| d kr6| d} qW| | krR|tj| 7}nR||d| } d} | dd krd } | dd} | tj| 7} |d| f7}| }n|tj| 7}|d7}qW|s4||7}q4W|d7}tj|tj tj BdS)z Translate a file path glob like '*.txt' in to a regular expression. This differs from fnmatch.translate which allows wildcards to match directory separators. It also knows about '**/' which matches any number of directories. z[^%s]z**z.*z (?:%s+%s)*r*?[!]^Nz[%s]z\Z)flags) splitospathsepreescape enumeratelencompile MULTILINEDOTALL)rZpatZchunksr#Z valid_charcchunkZ last_chunkiZ chunk_lencharZinner_iinnerZ char_classr0/usr/lib/python3.6/egg_info.pytranslate_pattern$sV         r2c@seZdZdZd)d*d+d,gZdgZd diZddZeddZ e j ddZ ddZ ddZ d-ddZ ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(S).egg_infoz+create a distribution's .egg-info directory egg-base=eLdirectory containing .egg-info directories (default: top of the source tree)tag-dated0Add date stamp (e.g. 20050528) to version number tag-build=b-Specify explicit tag to add to version numberno-dateD"Don't include date stamp [default]cCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)NrF)egg_name egg_versionegg_baser3 tag_buildtag_datebroken_egg_infovtags)selfr0r0r1initialize_optionsszegg_info.initialize_optionscCsdS)Nr0)rGr0r0r1tag_svn_revisionszegg_info.tag_svn_revisioncCsdS)Nr0)rGvaluer0r0r1rIscCs0tj}|j|d<d|d<t|t|ddS)z Materialize the value of date into the build tag. Install build keys in a deterministic order to avoid arbitrary reordering on subsequent builds. rCrrD)r3N) collections OrderedDicttagsr dict)rGfilenamer3r0r0r1save_version_infos zegg_info.save_version_infoc CsVt|jj|_|j|_|j|_t|j}y6t |t j j }|rFdnd}t t||j|jfWn,tk rtjjd|j|jfYnX|jdkr|jj}|pijdtj|_|jdt|jd|_|jtjkrtjj|j|j|_d|jkr|j|j|jj_ |jj}|dk rR|j |jj!krR|j|_"t|j|_#d|j_dS)Nz%s==%sz%s===%sz2Invalid distribution name or version syntax: %s-%srrBz .egg-info-)$r distributionZget_namer@rMrFtagged_versionrAr isinstancerversionZVersionlistr ValueError distutilserrorsZDistutilsOptionErrorrBZ package_dirgetr!curdirZensure_dirnamerr3r"joincheck_broken_egg_infometadataZ _patched_distkeylowerZ_versionZ_parsed_version)rGZparsed_versionZ is_versionspecdirsZpdr0r0r1finalize_optionss8          zegg_info.finalize_optionsFcCsN|r|j|||n6tjj|rJ|dkr@| r@tjd||dS|j|dS)aWrite `data` to `filename` or delete if empty If `data` is non-empty, this routine is the same as ``write_file()``. If `data` is empty but not ``None``, this is the same as calling ``delete_file(filename)`. If `data` is ``None``, then this is a no-op unless `filename` exists, in which case a warning is issued about the orphaned file (if `force` is false), or deleted (if `force` is true). Nz$%s not set in setup(), but %s exists) write_filer!r"existsrwarn delete_file)rGwhatrOdataforcer0r0r1write_or_delete_files   zegg_info.write_or_delete_filecCsDtjd||tjr|jd}|js@t|d}|j||jdS)zWrite `data` to `filename` (if not a dry run) after announcing it `what` is used in a log message to identify what is being written to the file. zwriting %s to %szutf-8wbN) rinforZPY3encodedry_runopenwriteclose)rGrhrOrifr0r0r1rds   zegg_info.write_filecCs tjd||jstj|dS)z8Delete `filename` (if not a dry run) after announcing itz deleting %sN)rrmror!unlink)rGrOr0r0r1rgs zegg_info.delete_filecCs2|jj}|jr$|j|jr$t|St||jS)N)rRZ get_versionrFendswithr)rGrUr0r0r1rSs zegg_info.tagged_versioncCs|j|j|jj}x@tdD]4}|j|d|j}|||jtj j |j|jqWtj j |jd}tj j |r||j ||j dS)Nzegg_info.writers) installerznative_libs.txt)Zmkpathr3rRZfetch_build_eggrZrequireZresolvenamer!r"r\rerg find_sources)rGrvepwriternlr0r0r1run s     z egg_info.runcCs,d}|jr||j7}|jr(|tjd7}|S)Nrz-%Y%m%d)rCrDtimeZstrftime)rGrUr0r0r1rMs  z egg_info.tagscCs4tjj|jd}t|j}||_|j|j|_dS)z"Generate SOURCES.txt manifest filez SOURCES.txtN) r!r"r\r3manifest_makerrRmanifestr|filelist)rGZmanifest_filenameZmmr0r0r1rx s  zegg_info.find_sourcescCsd|jd}|jtjkr&tjj|j|}tjj|r`tjddddd||j |j |_ ||_ dS)Nz .egg-inforQNz Note: Your current .egg-info directory has a '-' in its name; this will not work correctly with "setup.py develop". Please rename %s to %s to correct this problem. ) r@rBr!r[r"r\rerrfr3rE)rGZbeir0r0r1r](s    zegg_info.check_broken_egg_infoN)r4r5r6)r7r8r9)r:r;r<)r=r>r?)F)__name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsZ negative_optrHpropertyrIsetterrPrcrkrdrgrSr|rMrxr]r0r0r0r1r3ws(  / r3c@s|eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)rcCs<|j|\}}}}|dkrV|jddj|x"|D]}|j|s4tjd|q4Wn|dkr|jddj|x"|D]}|j|sxtjd|qxWn|dkr|jd dj|x"|D]}|j|stjd |qWnZ|d kr(|jd dj|x&|D]}|j|stjd |qWn|dkrx|jd|dj|fx|D]"}|j ||sPtjd||qPWn|dkr|jd|dj|fx|D]"}|j ||stjd||qWnp|dkr|jd||j |s8tjd|n>|dkr,|jd||j |s8tjd|n t d|dS)Nincludezinclude  z%warning: no files found matching '%s'excludezexclude z9warning: no previously-included files found matching '%s'zglobal-includezglobal-include z>warning: no files found matching '%s' anywhere in distributionzglobal-excludezglobal-exclude zRwarning: no previously-included files matching '%s' found anywhere in distributionzrecursive-includezrecursive-include %s %sz:warning: no files found matching '%s' under directory '%s'zrecursive-excludezrecursive-exclude %s %szNwarning: no previously-included files matching '%s' found under directory '%s'graftzgraft z+warning: no directories found matching '%s'prunezprune z6no previously-included directories found matching '%s'z'this cannot happen: invalid action '%s')Z_parse_template_line debug_printr\rrrfrglobal_includeglobal_excluderecursive_includerecursive_excluderrr)rGlineactionZpatternsdirZ dir_patternpatternr0r0r1process_template_line;sd                 zFileList.process_template_linecCsVd}xLtt|jdddD]2}||j|r|jd|j||j|=d}qW|S)z Remove all files from the file list that match the predicate. Return True if any matching files were removed Frz removing Tr)ranger'filesr)rGZ predicatefoundr-r0r0r1 _remove_filesszFileList._remove_filescCs$ddt|D}|j|t|S)z#Include files that match 'pattern'.cSsg|]}tjj|s|qSr0)r!r"isdir).0rsr0r0r1 sz$FileList.include..)rextendbool)rGrrr0r0r1rs zFileList.includecCst|}|j|jS)z#Exclude files that match 'pattern'.)r2rmatch)rGrrr0r0r1rszFileList.excludecCs8tjj|d|}ddt|ddD}|j|t|S)zN Include all files anywhere in 'dir/' that match the pattern. z**cSsg|]}tjj|s|qSr0)r!r"r)rrsr0r0r1rsz.FileList.recursive_include..T) recursive)r!r"r\rrr)rGrrZ full_patternrr0r0r1rs zFileList.recursive_includecCs ttjj|d|}|j|jS)zM Exclude any file anywhere in 'dir/' that match the pattern. z**)r2r!r"r\rr)rGrrrr0r0r1rszFileList.recursive_excludecCs$ddt|D}|j|t|S)zInclude all files from 'dir/'.cSs"g|]}tjj|D]}|qqSr0)rXrfindall)rZ match_diritemr0r0r1rsz"FileList.graft..)rrr)rGrrr0r0r1rs  zFileList.graftcCsttjj|d}|j|jS)zFilter out files from 'dir/'.z**)r2r!r"r\rr)rGrrr0r0r1rszFileList.prunecsJ|jdkr|jttjjd|fdd|jD}|j|t|S)z Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees. Nz**csg|]}j|r|qSr0)r)rrs)rr0r1rsz+FileList.global_include..)Zallfilesrr2r!r"r\rr)rGrrr0)rr1rs   zFileList.global_includecCsttjjd|}|j|jS)zD Exclude all files anywhere that match the pattern. z**)r2r!r"r\rr)rGrrr0r0r1rszFileList.global_excludecCs8|jdr|dd}t|}|j|r4|jj|dS)N rr)rur _safe_pathrappend)rGrr"r0r0r1rs    zFileList.appendcCs|jjt|j|dS)N)rrfilterr)rGpathsr0r0r1rszFileList.extendcCstt|j|j|_dS)z Replace self.files with only safe paths Because some owners of FileList manipulate the underlying ``files`` attribute directly, this method must be called to repair those paths. N)rVrrr)rGr0r0r1_repairszFileList._repairc Csd}tj|}|dkr(tjd|dStj|d}|dkrNtj||ddSy tjj|shtjj|rldSWn&tk rtj||t j YnXdS)Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFzutf-8T) unicode_utilsfilesys_decoderrfZ try_encoder!r"reUnicodeEncodeErrorsysgetfilesystemencoding)rGr"Zenc_warnZu_pathZ utf8_pathr0r0r1rs  zFileList._safe_pathN)rrrrrrrrrrrrrrrrrr0r0r0r1r8sI     rc@s\eZdZdZddZddZddZdd Zd d Zd d Z e ddZ ddZ ddZ dS)r~z MANIFEST.incCsd|_d|_d|_d|_dS)Nr)Z use_defaultsrZ manifest_onlyZforce_manifest)rGr0r0r1rHsz!manifest_maker.initialize_optionscCsdS)Nr0)rGr0r0r1rcszmanifest_maker.finalize_optionscCsdt|_tjj|js|j|jtjj|jr<|j |j |jj |jj |jdS)N) rrr!r"rerwrite_manifest add_defaultstemplateZ read_templateprune_file_listsortZremove_duplicates)rGr0r0r1r|s  zmanifest_maker.runcCstj|}|jtjdS)N/)rrreplacer!r#)rGr"r0r0r1_manifest_normalizes z"manifest_maker._manifest_normalizecsBjjfddjjD}dj}jtj|f|dS)zo Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. csg|]}j|qSr0)r)rrs)rGr0r1r sz1manifest_maker.write_manifest..zwriting manifest file '%s'N)rrrrZexecuterd)rGrmsgr0)rGr1rs  zmanifest_maker.write_manifestcCs|j|stj||dS)N)_should_suppress_warningr rf)rGrr0r0r1rf$s zmanifest_maker.warncCs tjd|S)z; suppress missing-file warnings from sdist zstandard file .*not found)r$r)rr0r0r1r(sz'manifest_maker._should_suppress_warningcCsttj||jj|j|jj|jtt}|rB|jj|nt j j |jrX|j |j d}|jj|jdS)Nr3)r rrrrrrVr rr!r"reZ read_manifestget_finalized_commandrr3)rGZrcfilesZei_cmdr0r0r1r/s   zmanifest_maker.add_defaultscCsZ|jd}|jj}|jj|j|jj|tjtj }|jj d|d|dddS)Nbuildz(^|z)(RCS|CVS|\.svn)r)Zis_regex) rrRZ get_fullnamerrZ build_baser$r%r!r#Zexclude_pattern)rGrZbase_dirr#r0r0r1r;s    zmanifest_maker.prune_file_listN)rrrrrHrcr|rrrf staticmethodrrrr0r0r0r1r~s    r~c Cs8dj|}|jd}t|d}|j|WdQRXdS)z{Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it.  zutf-8rlN)r\rnrprq)rOcontentsrsr0r0r1rdEs   rdc Cs|tjd||jsx|jj}|j|j|_}|j|j|_}z|j |j Wd|||_|_Xt |jdd}t j |j |dS)Nz writing %sZzip_safe)rrmrorRr^rArUr@rwwrite_pkg_infor3getattrr Zwrite_safety_flag)cmdbasenamerOr^ZoldverZoldnameZsafer0r0r1rRs rcCstjj|rtjddS)NzsWARNING: 'depends.txt' is not used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.)r!r"rerrf)rrrOr0r0r1warn_depends_obsoletees rcCs,t|pf}dd}t||}|j|dS)NcSs|dS)Nrr0)rr0r0r1osz%_write_requirements..)rr writelines)streamZreqslinesZ append_crr0r0r1_write_requirementsms  rcCsn|j}tj}t||j|jp"i}x2t|D]&}|jdjft t|||q.W|j d||j dS)Nz [{extra}] Z requirements) rRrStringIOrZinstall_requiresextras_requiresortedrqformatvarsrkgetvalue)rrrOZdistrirZextrar0r0r1write_requirementsts  rcCs,tj}t||jj|jd||jdS)Nzsetup-requirements)iorrrRZsetup_requiresrkr)rrrOrir0r0r1write_setup_requirementssrcCs:tjdd|jjD}|jd|djt|ddS)NcSsg|]}|jdddqS).rr)r )rkr0r0r1rsz(write_toplevel_names..ztop-level namesr)rNfromkeysrRZiter_distribution_namesrdr\r)rrrOZpkgsr0r0r1write_toplevel_namessrcCst|||ddS)NT) write_arg)rrrOr0r0r1 overwrite_argsrFcCsHtjj|d}t|j|d}|dk r4dj|d}|j||||dS)Nrr)r!r"splitextrrRr\rk)rrrOrjZargnamerJr0r0r1rs rcCs|jj}t|tjs|dkr"|}nr|dk rg}xZt|jD]J\}}t|tjsttj||}dj tt t |j }|j d||fqsR           (   SBEI    __pycache__/install.cpython-36.opt-1.pyc000064400000033613147210141470014016 0ustar003 /fj@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZmZmZdd lmZdd l mZdd lmZdd lmZdZddddddZddddddddddddedZerdddddded <ddd!d"dded#<d+ZGd)d*d*eZdS),zFdistutils.command.install Implements the Distutils 'install' command.N)log)Command)DEBUG)get_config_vars)DistutilsPlatformError) write_file) convert_path subst_vars change_root) get_platform)DistutilsOptionError) USER_BASE) USER_SITETz$base/Lib/site-packagesz$base/Include/$dist_namez $base/Scriptsz$base)purelibplatlibheadersscriptsdataz/$base/lib/python$py_version_short/site-packagesz5$platbase/lib64/python$py_version_short/site-packagesz9$base/include/python$py_version_short$abiflags/$dist_namez $base/binz$base/lib/pythonz$base/lib64/pythonz$base/include/python/$dist_name) unix_prefix unix_homentz $usersitez4$userbase/Python$py_version_nodot/Include/$dist_namez)$userbase/Python$py_version_nodot/Scriptsz $userbasent_userz=$userbase/include/python$py_version_short$abiflags/$dist_namez $userbase/bin unix_userrrrrrc@s:eZdZdZd_d`dadbdddedfdgdidjdkdldmdndodpdqdrgZdd%d(gZer`ejd,dd-efejd,d diZ d.d/Z d0d1Z d2d3Z d4d5Z d6d7Zd8d9Zd:d;Zdd?Zd@dAZdBdCZdDdEZdFdGZdHdIZdJdKZdLdMZdNdOZdPdQZdRdSZdTdUZdVdWZdXefdYefdZefd[efd\d]d^fgZdS)sinstallz'install everything from build directoryprefix=Ninstallation prefix exec-prefix=.(Unix only) prefix for platform-specific fileshome=+(Unix only) home directory to install under install-base=;base installation directory (instead of --prefix or --home)install-platbase=z8base installation directory for platform-specific files z$(instead of --exec-prefix or --home)root=|jD]2}|j|}x"|jD]}||kr&|j|q&WqW|jrl|jrl|jtjj|j |jd|S)z.Assembles the outputs of all the sub-commands.z.pth) rget_finalized_commandrappendrrQrhr}r~r|)rWrrcmdrrXrXrYrbs  zinstall.get_outputscCs2g}x(|jD]}|j|}|j|jqW|S)z*Returns the inputs of all the sub-commands)rrextend get_inputs)rWZinputsrrrXrXrYrss  zinstall.get_inputscCs|jjp|jjS)zSReturns true if the current distribution has any Python modules to install.)rrZhas_pure_modulesZhas_ext_modules)rWrXrXrYhas_libs zinstall.has_libcCs |jjS)zLReturns true if the current distribution has any headers to install.)rr has_headers)rWrXrXrYrszinstall.has_headerscCs |jjS)zMReturns true if the current distribution has any scripts to. install.)rr has_scripts)rWrXrXrYrszinstall.has_scriptscCs |jjS)zJReturns true if the current distribution has any data to. install.)rrZhas_data_files)rWrXrXrYhas_dataszinstall.has_datarJrIrKrLZinstall_egg_infocCsdS)NTrX)rWrXrXrYszinstall.)rNr)rNr)rNr)r Nr!\base installation directory for platform-specific files (instead of --exec-prefix or --home))r"Nr)r#Nr$)r%Nr&)r'Nr(ginstallation directory for all module distributions (overrides --install-purelib and --install-platlib))r)Nr)r*Nr+)r,Nr-)r.Nr/)r0r1r2)r3Nr4)r5r6r7)r8r9r:)r;Nr<)r=Nr>) __name__ __module__ __qualname__ descriptionrZboolean_optionsrurrrrZrrkrlrmrrrvrxrzr{rryrrrrrrrrZ sub_commandsrXrXrXrYrIs   N3  " , r)rrrrr)__doc__rnrhZ distutilsrZdistutils.corerZdistutils.debugrZdistutils.sysconfigrZdistutils.errorsrZdistutils.file_utilrZdistutils.utilrr r r r Zsiter rruZWINDOWS_SCHEMErrrrXrXrXrYsV            __pycache__/setopt.cpython-36.opt-1.pyc000064400000010656147210141470013670 0ustar003 K]@sddlmZddlmZddlmZddlZddlZddlmZddl m Z ddd d gZ dd dZ dddZ Gdd d e ZGdd d eZdS)) convert_path)log)DistutilsOptionErrorN) configparser)Command config_file edit_config option_basesetoptlocalcCsh|dkr dS|dkr,tjjtjjtjdS|dkrZtjdkrBdpDd}tjjtd |St d |d S) zGet the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" r z setup.cfgglobalz distutils.cfguserposix.z~/%spydistutils.cfgz7config_file() type must be 'local', 'global', or 'user'N) ospathjoindirname distutils__file__name expanduserr ValueError)Zkinddotr/usr/lib/python3.6/setopt.pyrsFc Cs.tjd|tj}|j|gx|jD]\}}|dkrTtjd|||j|q*|j|svtjd|||j |x||jD]p\}}|dkrtjd||||j |||j |stjd|||j|qtjd|||||j |||qWq*Wtjd||s*t |d }|j|WdQRXdS) aYEdit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or deleted in that section. A setting of ``None`` means to delete that setting. zReading configuration from %sNzDeleting section [%s] from %szAdding new section [%s] to %szDeleting %s.%s from %sz#Deleting empty [%s] section from %szSetting %s.%s to %r in %sz Writing %sw)rdebugrZRawConfigParserreaditemsinfoZremove_sectionZ has_sectionZ add_sectionZ remove_optionoptionssetopenwrite) filenameZsettingsdry_runZoptsZsectionr"optionvaluefrrrr!s8            c@s2eZdZdZdddgZddgZd d Zd dZdS)r zr? descriptionr r@rAr6r;rSrrrrr ss )r )F)Zdistutils.utilrrrZdistutils.errorsrrZsetuptools.extern.six.movesrZ setuptoolsr__all__rrr r rrrrs        +'__pycache__/bdist_rpm.cpython-36.pyc000064400000031374147210141470013376 0ustar003 \T@sdZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl Tddl mZdd lmZGd d d eZdS) zwdistutils.command.bdist_rpm Implements the Distutils 'bdist_rpm' command (create RPM source and binary distributions).N)Command)DEBUG) get_platform) write_file)*)get_python_version)logc+@seZdZdZdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddg)Zd4d9d=d2dUgZd4d9d=dXZdYdZZd[d\Zd]d^Z d_d`Z dadbZ dcddZ dedfZ dS) bdist_rpmzcreate an RPM distribution bdist-base=N/base directory for creating built distributions rpm-base=dbase directory for creating RPMs (defaults to "rpm" under --bdist-base; must be specified for RPM 2) dist-dir=dDdirectory to put final RPM files in (and .spec files if --spec-only)python=Mpath to Python interpreter to hard-code in the .spec file (default: "python") fix-pythonLhard-code the exact path to the current Python interpreter in the .spec file spec-onlyonly regenerate spec file source-onlyonly generate source RPM binary-onlyonly generate binary RPM use-bzip27use bzip2 instead of gzip to create source distributiondistribution-name=gname of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!)group=9package classification [default: "Development/Libraries"]release=RPM release numberserial=RPM serial numbervendor=aRPM "vendor" (eg. "Joe Blow ") [default: maintainer or author from setup script] packager=BRPM packager (eg. "Jane Doe ") [default: vendor] doc-files=6list of documentation files (space or comma-separated) changelog= RPM changelogicon=name of icon file provides=%capabilities provided by this package requires=%capabilities required by this package conflicts=-capabilities which conflict with this packagebuild-requires=+capabilities required to build this package obsoletes=*capabilities made obsolete by this package no-autoreq+do not automatically calculate dependencies keep-tempk"don't clean up RPM build directory no-keep-temp&clean up RPM build directory [default]use-rpm-opt-flags8compile with RPM_OPT_FLAGS when building from source RPMno-rpm-opt-flags&do not pass any RPM CFLAGS to compiler rpm3-mode"RPM 3 compatibility mode (default) rpm2-modeRPM 2 compatibility mode prep-script=3Specify a script for the PREP phase of RPM building build-script=4Specify a script for the BUILD phase of RPM building pre-install=:Specify a script for the pre-INSTALL phase of RPM buildinginstall-script=6Specify a script for the INSTALL phase of RPM building post-install=;Specify a script for the post-INSTALL phase of RPM buildingpre-uninstall=rnroREADME README.txtrk1rlrirprqrrrsrtrurvrwrxryrzr|r}r~rrr)rr)Z ensure_stringrZ get_contactZget_contact_emailZensure_string_list isinstancerolistrrexistsappend_format_changelogrpZensure_filename)rZreadmerrrrs>                         zbdist_rpm.finalize_package_datac Cstrsz-bdist_rpm._make_spec_file..zbrp-python-bytecompile \ z%brp-python-bytecompile %{__python} \ z2# Workaround for http://bugs.python.org/issue14443z%define __os_install_post z Name: %{name}zVersion: %{version}zRelease: %{release}z-Source0: %{name}-%{unmangled_version}.tar.bz2z,Source0: %{name}-%{unmangled_version}.tar.gzz License: zGroup: z>BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootzPrefix: %{_prefix}zBuildArch: noarchz BuildArch: %sVendorPackagerProvidesRequires Conflicts Obsoletesz%s: %s NZUNKNOWNzUrl: zDistribution: zBuildRequires: zIcon: z AutoReq: 0z %descriptionz%s %srz%s buildzenv CFLAGS="$RPM_OPT_FLAGS" z>%s install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILESr{rr&%setup -n %{name}-%{unmangled_version}ZbuildrsZinstallrtcleanrurm -rf $RPM_BUILD_ROOT verifyscriptrvprerwpostrxpreunrypostunrz%rz%files -f INSTALLED_FILESz%defattr(-,root,root)z%doc z %changelog)rrrrrr)r{rrr)rrur)rrvN)rrwN)rrxN)rryN)rrzN)'rrZ get_versionreplacerkZget_description subprocessZ getoutputr splitlinesrrrhZ get_licenserjrrgetattrlowerrrZget_urlrirrqrrrrZget_long_descriptionrcrargvropenreadrrorp)rZ spec_fileZ vendor_hookZproblemZfixedZ fixed_hookZfieldvalZdef_setup_callZ def_buildZ install_cmdZscript_optionsZrpm_optattrdefaultrrrrs                   zbdist_rpm._make_spec_filecCs|s|Sg}x`|jjdD]N}|j}|ddkrD|jd|gq|ddkr\|j|q|jd|qW|ds||d=|S)zKFormat the changelog correctly and convert it to a list of strings rrrrrz )rrrr)rrpZ new_changelogrrrrr3s   zbdist_rpm._format_changelog)r Nr )r Nr )rrr)rNr)rNr)rNr)rNr)rNr)rNr)rNr)rNr )r!Nr")r#Nr$)r%Nr&)r'Nr()r)Nr*)r+Nr,)r-Nr.)r/Nr0)r1Nr2)r3Nr4)r5Nr6)r7Nr8)r9Nr:)r;r<r=)r>Nr?)r@NrA)rBNrC)rDNrE)rFNrG)rHNrI)rJNrK)rLNrM)rNNrO)rPNrQ)rRNrS)rTNrU)rVNrW)rXNrY)rZNr[)r\r]r^)__name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsZ negative_optrrrrrrrrrrrr s--)r )__doc__rrrZdistutils.corerZdistutils.debugrZdistutils.utilrZdistutils.file_utilrZdistutils.errorsZdistutils.sysconfigrZ distutilsrr rrrrs      __pycache__/dist_info.cpython-36.opt-1.pyc000064400000002445147210141470014325 0ustar003 K]@s8dZddlZddlmZddlmZGdddeZdS)zD Create a dist_info directory As defined in the wheel specification N)Command)logc@s.eZdZdZd gZddZddZd d Zd S) dist_infozcreate a .dist-info directory egg-base=eLdirectory containing .egg-info directories (default: top of the source tree)cCs d|_dS)N)egg_base)selfr /usr/lib/python3.6/dist_info.pyinitialize_optionsszdist_info.initialize_optionscCsdS)Nr )r r r r finalize_optionsszdist_info.finalize_optionscCsn|jd}|j|_|j|j|jdtd d}tjdjt j j ||jd}|j |j|dS)Negg_infoz .egg-infoz .dist-infoz creating '{}' bdist_wheel) Zget_finalized_commandrr runrlenrinfoformatospathabspathZegg2dist)r rZ dist_info_dirrr r r rs  z dist_info.runN)rrr)__name__ __module__ __qualname__ descriptionZ user_optionsr r rr r r r r s r)__doc__rZdistutils.corerZ distutilsrrr r r r s  __pycache__/build_ext.cpython-36.opt-1.pyc000064400000040234147210141470014324 0ustar003 \z@sdZddlZddlZddlZddlZddlmZddlTddlm Z m Z ddlm Z ddl m Z ddlmZdd lmZdd lmZdd lmZejd Zd dZGdddeZdS)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_compilerget_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]*)*$cCsddlm}|dS)Nr)show_compilers)distutils.ccompilerr )r r!/usr/lib64/python3.6/build_ext.pyr s r c@seZdZdZdejZd`dad d d efdcdddefdddedfdddefdgdhdidjdkdldmdndodpgZd d%d(d1d8gZ d:d2d;e fgZ dd?Z d@dAZdBdCZdDdEZdFdGZdHdIZdJdKZdLdMZejdNdOZdPdQZdRdSZdTdUZdVdWZdXdYZdZd[Zd\d]Zd^d_Zd2S)q build_extz8build C/C++ extensions (compile/link to build directory)z (separated by '%s') build-lib=b(directory for compiled extension modules build-temp=t1directory for temporary files (build by-products)z plat-name=pz>platform name to cross-compile for, if supported (default: %s)inplaceiz=ignore build-lib and put compiled extensions into the source z,directory alongside your pure Python modulesz include-dirs=Iz.list of directories to search for header filesdefine=DC preprocessor macros to defineundef=U!C preprocessor macros to undefine libraries=l!external C libraries to link withz library-dirs=Lz.directories to search for external C librariesrpath=R7directories to search for shared C libraries at runtime link-objects=O2extra explicit link objects to include in the linkdebugg'compile/link with debugging informationforcef2forcibly build everything (ignore file timestamps) compiler=cspecify the compiler type parallel=jnumber of parallel build jobsswig-cppN)make SWIG create C++ files (default is C) swig-opts=!list of SWIG command line optionsswig=path to the SWIG executableuser#add user include, library and rpathz help-compilerzlist available compilerscCsd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_d|_dS)Nr) extensions build_lib plat_name build_temprpackage include_dirsdefineundef libraries library_dirsrpath link_objectsr+r.compilerswigswig_cpp swig_optsr=parallel)selfrrrinitialize_optionsjs*zbuild_ext.initialize_optionsc Csddlm}|jdd'd(d)d*d+d,d-|jdkr8|jj|_|jj|_|j}|jd d }|j dkrn|jj pjg|_ t |j t r|j j t j|_ tjtjkr|j jt jjtjd |j j|||kr|j j||jd|jd|jdkrg|_|jdkrg|_nt |jt r&|jj t j|_|jdkr:g|_nt |jt rX|jj t j|_t jdkrT|jjt jjtjdtjtjkr|jjt jjtjd|jrt jj|jd|_nt jj|jd|_|j jt jjtttdd}|r|jj||j dkrd}n|j dd}t jjtjd}|rHt jj||}|jj|tj!dddks|tj!dddkrtj"j#t jjtjdr|jjt jjtjddt$dn |jjd|j%d r|j&s|jj|j%d!n |jjd|j'r|j'j d"}d#d$|D|_'|j(r4|j(j d"|_(|j)dkrHg|_)n|j)j d%|_)|j*rt jjt+d }t jjt+d} t jj,|r|j j|t jj,| r|jj| |jj| t |j-t ryt.|j-|_-Wnt/k rt0d&YnXdS).Nr) sysconfigZbuildr@rBrKr+r.rOrA)Z plat_specificincluderGrJntZlibsZDebugZRelease_homewin32ZPCbuildcygwinatheosbinlibpythonconfig.Py_ENABLE_SHAREDLIBDIR,cSsg|] }|dfqS)1r).0Zsymbolrrr sz.build_ext.finalize_options.. zparallel should be an integer)r@r@)rBrB)rKrK)r+r+)r.r.)rOrO)rArA)1 distutilsrRZset_undefined_optionsrC distributionZ ext_packageZ ext_modulesr?Zget_python_incrD isinstancestrsplitospathsepsys exec_prefixbase_exec_prefixappendpathjoinZensure_string_listrGrHrInameprefixr+rBdirnamergetattrrAplatform executable startswithrget_config_varZ python_buildrErFrNr=r isdirrOint ValueErrorZDistutilsOptionError) rPrRZ py_includeZplat_py_include _sys_homesuffixZnew_libZdefinesZ user_includeZuser_librrrfinalize_optionss                    (         zbuild_ext.finalize_optionscCstddlm}|jsdS|jjrL|jd}|jj|jp:g|j j |j ||j |j |j|jd|_ t|j tjdkr|jtkr|j j|j|jdk r|j j|j|jdk rx |jD]\}}|j j||qW|jdk rx|jD]}|j j|qW|jdk r|j j|j|j dk r4|j j|j |jdk rN|j j|j|j dk rh|j j!|j |j"dS)Nr) new_compiler build_clib)rKverbosedry_runr.rU)#r rr?riZhas_c_librariesget_finalized_commandrGextendZget_library_namesrHrrrrKrrr.rrmrurAr Z initializerDZset_include_dirsrEZ define_macrorFZundefine_macroZ set_librariesZset_library_dirsrIZset_runtime_library_dirsrJZset_link_objectsbuild_extensions)rPrrruvaluemacrorrrruns>             z build_ext.runc Cst|tstdxnt|D]`\}}t|tr4qt|t sLt|dkrTtd|\}}tjd|t|t ozt j |stdt|t stdt||d}x*dD]"}|j |}|dk rt|||qW|j d|_d|krtjd|j d}|rxg|_g|_xj|D]b} t| to,t| dks8tdt| dkrX|jj| dnt| dkr|jj| qW|||<qWdS)aEnsure 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 instanceszMeach 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)sourcesrDrHrG extra_objectsextra_compile_argsextra_link_argsNrIZdef_filez9'def_file' element of build info dict no longer supportedmacrosrSz9'macros' element of build info dict must be 1- or 2-tupler)rDrHrGrrr)rSr)rjlistDistutilsSetupError enumeratertuplelenr warnrkextension_name_rematchdictgetsetattrruntime_library_dirs define_macros undef_macrosrr) rPr?rextext_nameZ build_infokeyvalrrrrrcheck_extensions_listUsT           zbuild_ext.check_extensions_listcCs0|j|jg}x|jD]}|j|jqW|S)N)rr?rr)rP filenamesrrrrget_source_filess   zbuild_ext.get_source_filescCs6|j|jg}x |jD]}|j|j|jqW|S)N)rr?rrget_ext_fullpathru)rPZoutputsrrrr get_outputss   zbuild_ext.get_outputscCs(|j|j|jr|jn|jdS)N)rr?rO_build_extensions_parallel_build_extensions_serial)rPrrrrs  zbuild_ext.build_extensionscsj}jdkrtj}yddlm}Wntk r@d}YnX|dkrVjdS||dTfddjD}x6tj|D]&\}}j ||j WdQRXqWWdQRXdS)NTr)ThreadPoolExecutor) max_workerscsg|]}jj|qSr)Zsubmitbuild_extension)rer)executorrPrrrfsz8build_ext._build_extensions_parallel..) rOrm cpu_countconcurrent.futuresr ImportErrorrr?zip_filter_build_errorsresult)rPworkersrZfuturesrZfutr)rrPrrs       z$build_ext._build_extensions_parallelc Cs4x.|jD]$}|j||j|WdQRXqWdS)N)r?rr)rPrrrrrs  z"build_ext._build_extensions_serialccsTy dVWnDtttfk rN}z"|js*|jd|j|fWYdd}~XnXdS)Nz"building extension "%s" failed: %s)ZCCompilerErrorZDistutilsErrorZ CompileErrorZoptionalrru)rPrerrrrs zbuild_ext._filter_build_errorsc CsX|j}|dkst|ttf r,td|jt|}|j|j}||j}|jpZt ||dsnt j d|jdSt j d|j|j ||}|jpg}|jdd}x|jD]}|j|fqW|jj||j||j|j ||jd}|dd|_|jr|j|j|jp g}|jp|jj|} |jj|||j||j|j||j ||j |j| d dS)Nzjin 'ext_modules' option (extension '%s'), 'sources' must be present and must be a list of source filenamesZnewerz$skipping '%s' extension (up-to-date)zbuilding '%s' extension)Z output_dirrrDr+extra_postargsdepends)rGrHrrexport_symbolsr+rBZ target_lang)!rrjrrrrurrr.rr r+info swig_sourcesrrrrrrKcompilerBrDZ_built_objectsrrrlanguageZdetect_languageZlink_shared_object get_librariesrHrget_export_symbols) rPrrext_pathrZ extra_argsrrFZobjectsrrrrrsN         zbuild_ext.build_extensioncCs2g}g}i}|jrtjd|js6d|jks6d|jkr        zbuild_ext.swig_sourcescCs`tjdkrdStjdkrNxBd D]&}tjjd|d}tjj|r|SqWdSntd tjd S) 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. posixrLrU1.31.21.1z c:\swig%szswig.exez>I don't know how to find (much less run) SWIG on platform '%s'N)rrr)rmrursrtisfileZDistutilsPlatformError)rPZversfnrrrrfs    zbuild_ext.find_swigcCs|j|}|jd}|j|d}|jsRtjj|dd|g}tjj|j|Sdj|dd}|jd}tjj |j |}tjj||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). r`rSNrbuild_pyrrr) get_ext_fullnamerlget_ext_filenamerrmrsrtr@rabspathZget_package_dir)rPrfullnameZmodpathfilenamerCrZ package_dirrrrr~s   zbuild_ext.get_ext_fullpathcCs |jdkr|S|jd|SdS)zSReturns the fullname of a given extension name. Adds the `package.` prefixNr`)rC)rPrrrrrs zbuild_ext.get_ext_fullnamecCs.ddlm}|jd}|d}tjj||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)r|r` EXT_SUFFIX)distutils.sysconfigr|rlrmrsrt)rPrr|rZ ext_suffixrrrrs  zbuild_ext.get_ext_filenamecCs0d|jjdd}||jkr*|jj||jS)aReturn 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. ZPyInit_r`rSr)rurlrrr)rPrZ initfunc_namerrrrs  zbuild_ext.get_export_symbolscCstjdkrfddlm}t|j|s\d}|jr4|d}|tjd?tjd?d@f}|j|gS|jSnRtjd d d krd }|tjd?tjd?d@f}|j|gStjd d d kr>ddl m }d }|tjd?tjd?d@f}g}xB|j dj D]0}|j dr|j|dd n |j|qW|j|dg|StjdkrP|jStjd ddkrj|jSddl m }|j drdjtjd?tjd?d@|j d}|j|gS|jSd 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). rWr) MSVCCompilerz python%d%dZ_dNrYrZz python%d.%dr[)rRSHLIBSz-lrmdarwinaixraz python{}.{}{}ABIFLAGS)roryZdistutils._msvccompilerrrjrKr+ hexversionrGrhrRr|rlr{rrformat)rPrrtemplateZ pythonlibrRZextrar]rrrrsJ             zbuild_ext.get_libraries)rrr)rrriignore build-lib and put compiled extensions into the source directory alongside your pure Python modules)rrr)rrr)rrr )r!r"r#)r%r&r')r(r)r*)r+r,r-)r.r/r0)r1r2r3)r4r5r6)r7Nr8)r9Nr:)r;Nr<)r=Nr>) __name__ __module__ __qualname__ descriptionrmrnZsep_byr Z user_optionsZboolean_optionsr Z help_optionsrQrrrrrrrr contextlibcontextmanagerrrrrrrrrrrrrrr!s  @N  K6   r)__doc__rrmreroZdistutils.corerZdistutils.errorsrrrrZdistutils.dep_utilrZdistutils.extensionrZdistutils.utilr rhr Zsiter rrr rrrrrs"       __pycache__/build_clib.cpython-36.opt-1.pyc000064400000011531147210141470014433 0ustar003 \V@sTdZddlZddlmZddlTddlmZddlmZddZ Gd d d eZ dS) 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)logcCsddlm}|dS)Nr)show_compilers)distutils.ccompilerr)rr"/usr/lib64/python3.6/build_clib.pyrs rc@sleZdZdZd"d#d$d%d&gZdd gZdddefgZddZddZ ddZ ddZ ddZ ddZ d d!ZdS)' build_clibz/build C/C++ libraries used by Python extensions build-clib=b%directory to build C/C++ libraries to build-temp=t,directory to put temporary build by-productsdebugg"compile with debugging informationforcef2forcibly build everything (ignore file timestamps) compiler=cspecify the compiler typez help-compilerNzlist available compilerscCs:d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) r build_temp libraries include_dirsdefineundefrrcompiler)selfrrr initialize_options4szbuild_clib.initialize_optionscCsh|jdddd d d |jj|_|jr0|j|j|jdkrH|jjpDg|_t|jtrd|jjtj |_dS) NZbuildrr rrr)rr )rr)rr)rr)rr) Zset_undefined_optionsZ distributionrcheck_library_listr isinstancestrsplitospathsep)r rrr finalize_optionsDs    zbuild_clib.finalize_optionscCs|js dSddlm}||j|j|jd|_t|j|jdk rN|jj|j|j dk rzx |j D]\}}|jj ||q`W|j dk rx|j D]}|jj |qW|j |jdS)Nr) new_compiler)rdry_runr)rrr)rr*rrrZset_include_dirsrZ define_macrorZundefine_macrobuild_libraries)r r)namevalueZmacrorrr run^s        zbuild_clib.runcCst|tstdx|D]|}t|t rs    launcher manifest.xml000064400000001164147210141470010661 0ustar00 bdist_rpm.py000064400000052247147210141470007114 0ustar00"""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.util import get_platform 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 \") " "[default: maintainer or author from setup script]"), ('packager=', None, "RPM packager (eg. \"Jane Doe \") " "[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. 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 = ['rpm'] if os.path.exists('/usr/bin/rpmbuild') or \ os.path.exists('/bin/rpmbuild'): 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: spec_file.extend(open(val, 'r').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 bdist_egg.py000064400000043411147210141470007051 0ustar00"""setuptools.command.bdist_egg Build .egg distributions""" from distutils.errors import DistutilsSetupError from distutils.dir_util import remove_tree, mkpath from distutils import log from types import CodeType import sys import os import re import textwrap import marshal from setuptools.extern import six from pkg_resources import get_build_platform, Distribution, ensure_directory from pkg_resources import EntryPoint from setuptools.extension import Library from setuptools import Command try: # Python 2.7 or >=3.2 from sysconfig import get_path, get_python_version def _get_purelib(): return get_path("purelib") except ImportError: from distutils.sysconfig import get_python_lib, get_python_version def _get_purelib(): return get_python_lib(False) def strip_module(filename): if '.' in filename: filename = os.path.splitext(filename)[0] if filename.endswith('module'): filename = filename[:-6] return filename def sorted_walk(dir): """Do os.walk in a reproducible way, independent of indeterministic filesystem readdir order """ for base, dirs, files in os.walk(dir): dirs.sort() files.sort() yield base, dirs, files def write_stub(resource, pyfile): _stub_template = textwrap.dedent(""" def __bootstrap__(): global __bootstrap__, __loader__, __file__ import sys, pkg_resources, imp __file__ = pkg_resources.resource_filename(__name__, %r) __loader__ = None; del __bootstrap__, __loader__ imp.load_dynamic(__name__,__file__) __bootstrap__() """).lstrip() with open(pyfile, 'w') as f: f.write(_stub_template % resource) class bdist_egg(Command): description = "create an \"egg\" distribution" user_options = [ ('bdist-dir=', 'b', "temporary directory for creating the distribution"), ('plat-name=', 'p', "platform name to embed in generated filenames " "(default: %s)" % get_build_platform()), ('exclude-source-files', None, "remove all .py files from the generated egg"), ('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)"), ] boolean_options = [ 'keep-temp', 'skip-build', 'exclude-source-files' ] def initialize_options(self): self.bdist_dir = None self.plat_name = None self.keep_temp = 0 self.dist_dir = None self.skip_build = 0 self.egg_output = None self.exclude_source_files = None def finalize_options(self): ei_cmd = self.ei_cmd = self.get_finalized_command("egg_info") self.egg_info = ei_cmd.egg_info if self.bdist_dir is None: bdist_base = self.get_finalized_command('bdist').bdist_base self.bdist_dir = os.path.join(bdist_base, 'egg') if self.plat_name is None: self.plat_name = get_build_platform() self.set_undefined_options('bdist', ('dist_dir', 'dist_dir')) if self.egg_output is None: # Compute filename of the output egg basename = Distribution( None, None, ei_cmd.egg_name, ei_cmd.egg_version, get_python_version(), self.distribution.has_ext_modules() and self.plat_name ).egg_name() self.egg_output = os.path.join(self.dist_dir, basename + '.egg') def do_install_data(self): # Hack for packages that install data to install's --install-lib self.get_finalized_command('install').install_lib = self.bdist_dir site_packages = os.path.normcase(os.path.realpath(_get_purelib())) old, self.distribution.data_files = self.distribution.data_files, [] for item in old: if isinstance(item, tuple) and len(item) == 2: if os.path.isabs(item[0]): realpath = os.path.realpath(item[0]) normalized = os.path.normcase(realpath) if normalized == site_packages or normalized.startswith( site_packages + os.sep ): item = realpath[len(site_packages) + 1:], item[1] # XXX else: raise ??? self.distribution.data_files.append(item) try: log.info("installing package data to %s", self.bdist_dir) self.call_command('install_data', force=0, root=None) finally: self.distribution.data_files = old def get_outputs(self): return [self.egg_output] def call_command(self, cmdname, **kw): """Invoke reinitialized command `cmdname` with keyword args""" for dirname in INSTALL_DIRECTORY_ATTRS: kw.setdefault(dirname, self.bdist_dir) kw.setdefault('skip_build', self.skip_build) kw.setdefault('dry_run', self.dry_run) cmd = self.reinitialize_command(cmdname, **kw) self.run_command(cmdname) return cmd def run(self): # Generate metadata first self.run_command("egg_info") # We run install_lib before install_data, because some data hacks # pull their data path from the install_lib command. log.info("installing library code to %s", self.bdist_dir) instcmd = self.get_finalized_command('install') old_root = instcmd.root instcmd.root = None if self.distribution.has_c_libraries() and not self.skip_build: self.run_command('build_clib') cmd = self.call_command('install_lib', warn_dir=0) instcmd.root = old_root all_outputs, ext_outputs = self.get_ext_outputs() self.stubs = [] to_compile = [] for (p, ext_name) in enumerate(ext_outputs): filename, ext = os.path.splitext(ext_name) pyfile = os.path.join(self.bdist_dir, strip_module(filename) + '.py') self.stubs.append(pyfile) log.info("creating stub loader for %s", ext_name) if not self.dry_run: write_stub(os.path.basename(ext_name), pyfile) to_compile.append(pyfile) ext_outputs[p] = ext_name.replace(os.sep, '/') if to_compile: cmd.byte_compile(to_compile) if self.distribution.data_files: self.do_install_data() # Make the EGG-INFO directory archive_root = self.bdist_dir egg_info = os.path.join(archive_root, 'EGG-INFO') self.mkpath(egg_info) if self.distribution.scripts: script_dir = os.path.join(egg_info, 'scripts') log.info("installing scripts to %s", script_dir) self.call_command('install_scripts', install_dir=script_dir, no_ep=1) self.copy_metadata_to(egg_info) native_libs = os.path.join(egg_info, "native_libs.txt") if all_outputs: log.info("writing %s", native_libs) if not self.dry_run: ensure_directory(native_libs) libs_file = open(native_libs, 'wt') libs_file.write('\n'.join(all_outputs)) libs_file.write('\n') libs_file.close() elif os.path.isfile(native_libs): log.info("removing %s", native_libs) if not self.dry_run: os.unlink(native_libs) write_safety_flag( os.path.join(archive_root, 'EGG-INFO'), self.zip_safe() ) if os.path.exists(os.path.join(self.egg_info, 'depends.txt')): log.warn( "WARNING: 'depends.txt' will not be used by setuptools 0.6!\n" "Use the install_requires/extras_require setup() args instead." ) if self.exclude_source_files: self.zap_pyfiles() # Make the archive make_zipfile(self.egg_output, archive_root, verbose=self.verbose, dry_run=self.dry_run, mode=self.gen_header()) if not self.keep_temp: remove_tree(self.bdist_dir, dry_run=self.dry_run) # Add to 'Distribution.dist_files' so that the "upload" command works getattr(self.distribution, 'dist_files', []).append( ('bdist_egg', get_python_version(), self.egg_output)) def zap_pyfiles(self): log.info("Removing .py files from temporary directory") for base, dirs, files in walk_egg(self.bdist_dir): for name in files: path = os.path.join(base, name) if name.endswith('.py'): log.debug("Deleting %s", path) os.unlink(path) if base.endswith('__pycache__'): path_old = path pattern = r'(?P.+)\.(?P[^.]+)\.pyc' m = re.match(pattern, name) path_new = os.path.join( base, os.pardir, m.group('name') + '.pyc') log.info( "Renaming file from [%s] to [%s]" % (path_old, path_new)) try: os.remove(path_new) except OSError: pass os.rename(path_old, path_new) def zip_safe(self): safe = getattr(self.distribution, 'zip_safe', None) if safe is not None: return safe log.warn("zip_safe flag not set; analyzing archive contents...") return analyze_egg(self.bdist_dir, self.stubs) def gen_header(self): epm = EntryPoint.parse_map(self.distribution.entry_points or '') ep = epm.get('setuptools.installation', {}).get('eggsecutable') if ep is None: return 'w' # not an eggsecutable, do it the usual way. if not ep.attrs or ep.extras: raise DistutilsSetupError( "eggsecutable entry point (%r) cannot have 'extras' " "or refer to a module" % (ep,) ) pyver = sys.version[:3] pkg = ep.module_name full = '.'.join(ep.attrs) base = ep.attrs[0] basename = os.path.basename(self.egg_output) header = ( "#!/bin/sh\n" 'if [ `basename $0` = "%(basename)s" ]\n' 'then exec python%(pyver)s -c "' "import sys, os; sys.path.insert(0, os.path.abspath('$0')); " "from %(pkg)s import %(base)s; sys.exit(%(full)s())" '" "$@"\n' 'else\n' ' echo $0 is not the correct name for this egg file.\n' ' echo Please rename it back to %(basename)s and try again.\n' ' exec false\n' 'fi\n' ) % locals() if not self.dry_run: mkpath(os.path.dirname(self.egg_output), dry_run=self.dry_run) f = open(self.egg_output, 'w') f.write(header) f.close() return 'a' def copy_metadata_to(self, target_dir): "Copy metadata (egg info) to the target_dir" # normalize the path (so that a forward-slash in egg_info will # match using startswith below) norm_egg_info = os.path.normpath(self.egg_info) prefix = os.path.join(norm_egg_info, '') for path in self.ei_cmd.filelist.files: if path.startswith(prefix): target = os.path.join(target_dir, path[len(prefix):]) ensure_directory(target) self.copy_file(path, target) def get_ext_outputs(self): """Get a list of relative paths to C extensions in the output distro""" all_outputs = [] ext_outputs = [] paths = {self.bdist_dir: ''} for base, dirs, files in sorted_walk(self.bdist_dir): for filename in files: if os.path.splitext(filename)[1].lower() in NATIVE_EXTENSIONS: all_outputs.append(paths[base] + filename) for filename in dirs: paths[os.path.join(base, filename)] = (paths[base] + filename + '/') if self.distribution.has_ext_modules(): build_cmd = self.get_finalized_command('build_ext') for ext in build_cmd.extensions: if isinstance(ext, Library): continue fullname = build_cmd.get_ext_fullname(ext.name) filename = build_cmd.get_ext_filename(fullname) if not os.path.basename(filename).startswith('dl-'): if os.path.exists(os.path.join(self.bdist_dir, filename)): ext_outputs.append(filename) return all_outputs, ext_outputs NATIVE_EXTENSIONS = dict.fromkeys('.dll .so .dylib .pyd'.split()) def walk_egg(egg_dir): """Walk an unpacked egg's contents, skipping the metadata directory""" walker = sorted_walk(egg_dir) base, dirs, files = next(walker) if 'EGG-INFO' in dirs: dirs.remove('EGG-INFO') yield base, dirs, files for bdf in walker: yield bdf def analyze_egg(egg_dir, stubs): # check for existing flag in EGG-INFO for flag, fn in safety_flags.items(): if os.path.exists(os.path.join(egg_dir, 'EGG-INFO', fn)): return flag if not can_scan(): return False safe = True for base, dirs, files in walk_egg(egg_dir): for name in files: if name.endswith('.py') or name.endswith('.pyw'): continue elif name.endswith('.pyc') or name.endswith('.pyo'): # always scan, even if we already know we're not safe safe = scan_module(egg_dir, base, name, stubs) and safe return safe def write_safety_flag(egg_dir, safe): # Write or remove zip safety flag file(s) for flag, fn in safety_flags.items(): fn = os.path.join(egg_dir, fn) if os.path.exists(fn): if safe is None or bool(safe) != flag: os.unlink(fn) elif safe is not None and bool(safe) == flag: f = open(fn, 'wt') f.write('\n') f.close() safety_flags = { True: 'zip-safe', False: 'not-zip-safe', } def scan_module(egg_dir, base, name, stubs): """Check whether module possibly uses unsafe-for-zipfile stuff""" filename = os.path.join(base, name) if filename[:-1] in stubs: return True # Extension module pkg = base[len(egg_dir) + 1:].replace(os.sep, '.') module = pkg + (pkg and '.' or '') + os.path.splitext(name)[0] if sys.version_info < (3, 3): skip = 8 # skip magic & date elif sys.version_info < (3, 7): skip = 12 # skip magic & date & file size else: skip = 16 # skip magic & reserved? & date & file size f = open(filename, 'rb') f.read(skip) code = marshal.load(f) f.close() safe = True symbols = dict.fromkeys(iter_symbols(code)) for bad in ['__file__', '__path__']: if bad in symbols: log.warn("%s: module references %s", module, bad) safe = False if 'inspect' in symbols: for bad in [ 'getsource', 'getabsfile', 'getsourcefile', 'getfile' 'getsourcelines', 'findsource', 'getcomments', 'getframeinfo', 'getinnerframes', 'getouterframes', 'stack', 'trace' ]: if bad in symbols: log.warn("%s: module MAY be using inspect.%s", module, bad) safe = False return safe def iter_symbols(code): """Yield names and strings used by `code` and its nested code objects""" for name in code.co_names: yield name for const in code.co_consts: if isinstance(const, six.string_types): yield const elif isinstance(const, CodeType): for name in iter_symbols(const): yield name def can_scan(): if not sys.platform.startswith('java') and sys.platform != 'cli': # CPython, PyPy, etc. return True log.warn("Unable to analyze compiled code on this platform.") log.warn("Please ask the author to include a 'zip_safe'" " setting (either True or False) in the package's setup.py") # Attribute names of options for commands that might need to be convinced to # install to the egg build directory INSTALL_DIRECTORY_ATTRS = [ 'install_lib', 'install_dir', 'install_data', 'install_base' ] def make_zipfile(zip_filename, base_dir, verbose=0, dry_run=0, compress=True, mode='w'): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. """ import zipfile mkpath(os.path.dirname(zip_filename), dry_run=dry_run) log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) def visit(z, dirname, names): for name in names: path = os.path.normpath(os.path.join(dirname, name)) if os.path.isfile(path): p = path[len(base_dir) + 1:] if not dry_run: z.write(path, p) log.debug("adding '%s'", p) compression = zipfile.ZIP_DEFLATED if compress else zipfile.ZIP_STORED if not dry_run: z = zipfile.ZipFile(zip_filename, mode, compression=compression) for dirname, dirs, files in sorted_walk(base_dir): visit(z, dirname, files) z.close() else: for dirname, dirs, files in sorted_walk(base_dir): visit(None, dirname, files) return zip_filename py36compat.py000064400000011572147210141470007132 0ustar00import os from glob import glob from distutils.util import convert_path from distutils.command import sdist from setuptools.extern.six.moves import filter class sdist_add_defaults: """ Mix-in providing forward-compatibility for functionality as found in distutils on Python 3.7. Do not edit the code in this class except to update functionality as implemented in distutils. Instead, override in the subclass. """ 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_add_defaults._cs_path_exists(__file__) True >>> sdist_add_defaults._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()) if hasattr(sdist.sdist, '_add_defaults_standards'): # disable the functionality already available upstream class sdist_add_defaults: pass rotate.py000064400000004164147210141470006422 0ustar00from distutils.util import convert_path from distutils import log from distutils.errors import DistutilsOptionError import os import shutil from setuptools.extern import six from setuptools import Command class rotate(Command): """Delete older distributions""" description = "delete older distributions, keeping N newest files" user_options = [ ('match=', 'm', "patterns to match (required)"), ('dist-dir=', 'd', "directory where the distributions are"), ('keep=', 'k', "number of matching distributions to keep"), ] boolean_options = [] def initialize_options(self): self.match = None self.dist_dir = None self.keep = None def finalize_options(self): if self.match is None: raise DistutilsOptionError( "Must specify one or more (comma-separated) match patterns " "(e.g. '.zip' or '.egg')" ) if self.keep is None: raise DistutilsOptionError("Must specify number of files to keep") try: self.keep = int(self.keep) except ValueError: raise DistutilsOptionError("--keep must be an integer") if isinstance(self.match, six.string_types): self.match = [ convert_path(p.strip()) for p in self.match.split(',') ] self.set_undefined_options('bdist', ('dist_dir', 'dist_dir')) def run(self): self.run_command("egg_info") from glob import glob for pattern in self.match: pattern = self.distribution.get_name() + '*' + pattern files = glob(os.path.join(self.dist_dir, pattern)) files = [(os.path.getmtime(f), f) for f in files] files.sort() files.reverse() log.info("%d file(s) matching %s", len(files), pattern) files = files[self.keep:] for (t, f) in files: log.info("Deleting %s", f) if not self.dry_run: if os.path.isdir(f): shutil.rmtree(f) else: os.unlink(f) upload_docs.py000064400000016217147210141470007422 0ustar00# -*- coding: utf-8 -*- """upload_docs Implements a Distutils 'upload_docs' subcommand (upload documentation to PyPI's pythonhosted.org). """ from base64 import standard_b64encode from distutils import log from distutils.errors import DistutilsOptionError import os import socket import zipfile import tempfile import shutil import itertools import functools from setuptools.extern import six from setuptools.extern.six.moves import http_client, urllib from pkg_resources import iter_entry_points from .upload import upload def _encode(s): errors = 'surrogateescape' if six.PY3 else 'strict' return s.encode('utf-8', errors) class upload_docs(upload): # override the default repository as upload_docs isn't # supported by Warehouse (and won't be). DEFAULT_REPOSITORY = 'https://pypi.python.org/pypi/' description = 'Upload documentation to PyPI' user_options = [ ('repository=', 'r', "url of repository [default: %s]" % upload.DEFAULT_REPOSITORY), ('show-response', None, 'display full response text from server'), ('upload-dir=', None, 'directory to upload'), ] boolean_options = upload.boolean_options def has_sphinx(self): if self.upload_dir is None: for ep in iter_entry_points('distutils.commands', 'build_sphinx'): return True sub_commands = [('build_sphinx', has_sphinx)] def initialize_options(self): upload.initialize_options(self) self.upload_dir = None self.target_dir = None def finalize_options(self): upload.finalize_options(self) if self.upload_dir is None: if self.has_sphinx(): build_sphinx = self.get_finalized_command('build_sphinx') self.target_dir = build_sphinx.builder_target_dir else: build = self.get_finalized_command('build') self.target_dir = os.path.join(build.build_base, 'docs') else: self.ensure_dirname('upload_dir') self.target_dir = self.upload_dir if 'pypi.python.org' in self.repository: log.warn("Upload_docs command is deprecated. Use RTD instead.") self.announce('Using upload directory %s' % self.target_dir) def create_zipfile(self, filename): zip_file = zipfile.ZipFile(filename, "w") try: self.mkpath(self.target_dir) # just in case for root, dirs, files in os.walk(self.target_dir): if root == self.target_dir and not files: tmpl = "no files found in upload directory '%s'" raise DistutilsOptionError(tmpl % self.target_dir) for name in files: full = os.path.join(root, name) relative = root[len(self.target_dir):].lstrip(os.path.sep) dest = os.path.join(relative, name) zip_file.write(full, dest) finally: zip_file.close() def run(self): # Run sub commands for cmd_name in self.get_sub_commands(): self.run_command(cmd_name) tmp_dir = tempfile.mkdtemp() name = self.distribution.metadata.get_name() zip_file = os.path.join(tmp_dir, "%s.zip" % name) try: self.create_zipfile(zip_file) self.upload_file(zip_file) finally: shutil.rmtree(tmp_dir) @staticmethod def _build_part(item, sep_boundary): key, values = item title = '\nContent-Disposition: form-data; name="%s"' % key # handle multiple entries for the same name if not isinstance(values, list): values = [values] for value in values: if isinstance(value, tuple): title += '; filename="%s"' % value[0] value = value[1] else: value = _encode(value) yield sep_boundary yield _encode(title) yield b"\n\n" yield value if value and value[-1:] == b'\r': yield b'\n' # write an extra newline (lurve Macs) @classmethod def _build_multipart(cls, data): """ Build up the MIME payload for the POST data """ boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' sep_boundary = b'\n--' + boundary end_boundary = sep_boundary + b'--' end_items = end_boundary, b"\n", builder = functools.partial( cls._build_part, sep_boundary=sep_boundary, ) part_groups = map(builder, data.items()) parts = itertools.chain.from_iterable(part_groups) body_items = itertools.chain(parts, end_items) content_type = 'multipart/form-data; boundary=%s' % boundary.decode('ascii') return b''.join(body_items), content_type def upload_file(self, filename): with open(filename, 'rb') as f: content = f.read() meta = self.distribution.metadata data = { ':action': 'doc_upload', 'name': meta.get_name(), 'content': (os.path.basename(filename), content), } # set up the authentication credentials = _encode(self.username + ':' + self.password) credentials = standard_b64encode(credentials) if six.PY3: credentials = credentials.decode('ascii') auth = "Basic " + credentials body, ct = self._build_multipart(data) msg = "Submitting documentation to %s" % (self.repository) self.announce(msg, log.INFO) # build the Request # We can't use urllib2 since we need to send the Basic # auth right with the first request schema, netloc, url, params, query, fragments = \ urllib.parse.urlparse(self.repository) assert not params and not query and not fragments if schema == 'http': conn = http_client.HTTPConnection(netloc) elif schema == 'https': conn = http_client.HTTPSConnection(netloc) else: raise AssertionError("unsupported schema " + schema) data = '' try: conn.connect() conn.putrequest("POST", url) content_type = ct conn.putheader('Content-type', content_type) conn.putheader('Content-length', str(len(body))) conn.putheader('Authorization', auth) conn.endheaders() conn.send(body) except socket.error as e: self.announce(str(e), log.ERROR) return r = conn.getresponse() if r.status == 200: msg = 'Server response (%s): %s' % (r.status, r.reason) self.announce(msg, log.INFO) elif r.status == 301: location = r.getheader('Location') if location is None: location = 'https://pythonhosted.org/%s/' % meta.get_name() msg = 'Upload successful. Visit %s' % location self.announce(msg, log.INFO) else: msg = 'Upload failed (%s): %s' % (r.status, r.reason) self.announce(msg, log.ERROR) if self.show_response: print('-' * 75, r.read(), '-' * 75) dist_info.py000064400000001700147210141470007073 0ustar00""" Create a dist_info directory As defined in the wheel specification """ import os from distutils.core import Command from distutils import log class dist_info(Command): description = 'create a .dist-info directory' user_options = [ ('egg-base=', 'e', "directory containing .egg-info directories" " (default: top of the source tree)"), ] def initialize_options(self): self.egg_base = None def finalize_options(self): pass def run(self): egg_info = self.get_finalized_command('egg_info') egg_info.egg_base = self.egg_base egg_info.finalize_options() egg_info.run() dist_info_dir = egg_info.egg_info[:-len('.egg-info')] + '.dist-info' log.info("creating '{}'".format(os.path.abspath(dist_info_dir))) bdist_wheel = self.get_finalized_command('bdist_wheel') bdist_wheel.egg2dist(egg_info.egg_info, dist_info_dir) register.py000064400000026700147210141470006750 0ustar00"""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 saveopts.py000064400000001222147210141470006760 0ustar00from setuptools.command.setopt import edit_config, option_base class saveopts(option_base): """Save command-line options to a file""" description = "save supplied options to setup.cfg or other config file" def run(self): dist = self.distribution settings = {} for cmd in dist.command_options: if cmd == 'saveopts': continue # don't save our own options! for opt, (src, val) in dist.get_option_dict(cmd).items(): if src == "command line": settings.setdefault(cmd, {})[opt] = val edit_config(self.filename, settings, self.dry_run) build_py.py000064400000041414147210141470006732 0ustar00"""distutils.command.build_py Implements the Distutils 'build_py' command.""" import os import importlib.util import sys from glob 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(os.path.join(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(os.path.join(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 bdist_wininst.py000064400000036244147210141470010010 0ustar00"""distutils.command.bdist_wininst Implements the Distutils 'bdist_wininst' command: create a windows installer exe-program.""" import sys, os from distutils.core import Command from distutils.util import get_platform from distutils.dir_util import create_tree, remove_tree from distutils.errors import * from distutils.sysconfig import get_python_version from distutils import log class bdist_wininst(Command): # Marker for tests that we have the unsupported bdist_wininst _unsupported = True description = "create an executable installer for MS Windows" 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"), ('bitmap=', 'b', "bitmap to use for the installer instead of python-powered logo"), ('title=', 't', "title to display on the installer background instead of default"), ('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"), ('user-access-control=', None, "specify Vista's UAC handling - 'none'/default=no " "handling, 'auto'=use UAC if target Python installed for " "all users, 'force'=always use UAC"), ] boolean_options = ['keep-temp', 'no-target-compile', 'no-target-optimize', 'skip-build'] 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.bitmap = None self.title = None self.skip_build = None self.install_script = None self.pre_install_script = None self.user_access_control = None def finalize_options(self): self.set_undefined_options('bdist', ('skip_build', 'skip_build')) if self.bdist_dir is None: if self.skip_build and self.plat_name: # If build is skipped and plat_name is overridden, bdist will # not see the correct 'plat_name' - so set that up manually. bdist = self.distribution.get_command_obj('bdist') bdist.plat_name = self.plat_name # next the command will be initialized using that name bdist_base = self.get_finalized_command('bdist').bdist_base self.bdist_dir = os.path.join(bdist_base, 'wininst') if not self.target_version: self.target_version = "" if not self.skip_build and self.distribution.has_ext_modules(): short_version = get_python_version() if self.target_version and self.target_version != short_version: raise DistutilsOptionError( "target version can only be %s, or the '--skip-build'" \ " option must be specified" % (short_version,)) self.target_version = short_version self.set_undefined_options('bdist', ('dist_dir', 'dist_dir'), ('plat_name', 'plat_name'), ) 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) def run(self): if (sys.platform != "win32" and (self.distribution.has_ext_modules() or self.distribution.has_c_libraries())): raise DistutilsPlatformError \ ("distribution contains extensions and/or C libraries; " "must be compiled on a Windows 32 platform") 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 install.plat_name = self.plat_name 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) # Use a custom scheme for the zip-file, because we have to decide # at installation time which scheme to use. for key in ('purelib', 'platlib', 'headers', 'scripts', 'data'): value = key.upper() if key == 'headers': value = value + '/Include/$dist_name' setattr(install, 'install_' + key, value) 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] # And make an archive relative to the root of the # pseudo-installation tree. from tempfile import mktemp archive_basename = mktemp() fullname = self.distribution.get_fullname() arcname = self.make_archive(archive_basename, "zip", root_dir=self.bdist_dir) # create an exe containing the zip-file self.create_exe(arcname, fullname, self.bitmap) if self.distribution.has_ext_modules(): pyversion = get_python_version() else: pyversion = 'any' self.distribution.dist_files.append(('bdist_wininst', pyversion, self.get_installer_filename(fullname))) # remove the zip-file again log.debug("removing temporary file '%s'", arcname) os.remove(arcname) if not self.keep_temp: remove_tree(self.bdist_dir, dry_run=self.dry_run) def get_inidata(self): # Return data describing the installation. lines = [] metadata = self.distribution.metadata # Write the [metadata] section. lines.append("[metadata]") # 'info' will be displayed in the installer's dialog box, # describing the items to be installed. info = (metadata.long_description or '') + '\n' # Escape newline characters def escape(s): return s.replace("\n", "\\n") for name in ["author", "author_email", "description", "maintainer", "maintainer_email", "name", "url", "version"]: data = getattr(metadata, name, "") if data: info = info + ("\n %s: %s" % \ (name.capitalize(), escape(data))) lines.append("%s=%s" % (name, escape(data))) # The [setup] section contains entries controlling # the installer runtime. lines.append("\n[Setup]") if self.install_script: lines.append("install_script=%s" % self.install_script) lines.append("info=%s" % escape(info)) lines.append("target_compile=%d" % (not self.no_target_compile)) lines.append("target_optimize=%d" % (not self.no_target_optimize)) if self.target_version: lines.append("target_version=%s" % self.target_version) if self.user_access_control: lines.append("user_access_control=%s" % self.user_access_control) title = self.title or self.distribution.get_fullname() lines.append("title=%s" % escape(title)) import time import distutils build_info = "Built %s with distutils-%s" % \ (time.ctime(time.time()), distutils.__version__) lines.append("build_info=%s" % build_info) return "\n".join(lines) def create_exe(self, arcname, fullname, bitmap=None): import struct self.mkpath(self.dist_dir) cfgdata = self.get_inidata() installer_name = self.get_installer_filename(fullname) self.announce("creating %s" % installer_name) if bitmap: bitmapdata = open(bitmap, "rb").read() bitmaplen = len(bitmapdata) else: bitmaplen = 0 file = open(installer_name, "wb") file.write(self.get_exe_bytes()) if bitmap: file.write(bitmapdata) # Convert cfgdata from unicode to ascii, mbcs encoded if isinstance(cfgdata, str): cfgdata = cfgdata.encode("mbcs") # Append the pre-install script cfgdata = cfgdata + b"\0" if self.pre_install_script: # We need to normalize newlines, so we open in text mode and # convert back to bytes. "latin-1" simply avoids any possible # failures. with open(self.pre_install_script, "r", encoding="latin-1") as script: script_data = script.read().encode("latin-1") cfgdata = cfgdata + script_data + b"\n\0" else: # empty pre-install script cfgdata = cfgdata + b"\0" file.write(cfgdata) # The 'magic number' 0x1234567B is used to make sure that the # binary layout of 'cfgdata' is what the wininst.exe binary # expects. If the layout changes, increment that number, make # the corresponding changes to the wininst.exe sources, and # recompile them. header = struct.pack(" 1: raise DistutilsError( "Multiple setup scripts in %s" % os.path.abspath(dist_filename) ) setup_script = setups[0] # Now run it, and return the result if self.editable: log.info(self.report_editable(spec, setup_script)) return [] else: return self.build_and_install(setup_script, setup_base) def egg_distribution(self, egg_path): if os.path.isdir(egg_path): metadata = PathMetadata(egg_path, os.path.join(egg_path, 'EGG-INFO')) else: metadata = EggMetadata(zipimport.zipimporter(egg_path)) return Distribution.from_filename(egg_path, metadata=metadata) def install_egg(self, egg_path, tmpdir): destination = os.path.join( self.install_dir, os.path.basename(egg_path), ) destination = os.path.abspath(destination) if not self.dry_run: ensure_directory(destination) dist = self.egg_distribution(egg_path) if not samefile(egg_path, destination): if os.path.isdir(destination) and not os.path.islink(destination): dir_util.remove_tree(destination, dry_run=self.dry_run) elif os.path.exists(destination): self.execute( os.unlink, (destination,), "Removing " + destination, ) try: new_dist_is_zipped = False if os.path.isdir(egg_path): if egg_path.startswith(tmpdir): f, m = shutil.move, "Moving" else: f, m = shutil.copytree, "Copying" elif self.should_unzip(dist): self.mkpath(destination) f, m = self.unpack_and_compile, "Extracting" else: new_dist_is_zipped = True if egg_path.startswith(tmpdir): f, m = shutil.move, "Moving" else: f, m = shutil.copy2, "Copying" self.execute( f, (egg_path, destination), (m + " %s to %s") % ( os.path.basename(egg_path), os.path.dirname(destination) ), ) update_dist_caches( destination, fix_zipimporter_caches=new_dist_is_zipped, ) except Exception: update_dist_caches(destination, fix_zipimporter_caches=False) raise self.add_output(destination) return self.egg_distribution(destination) def install_exe(self, dist_filename, tmpdir): # See if it's valid, get data cfg = extract_wininst_cfg(dist_filename) if cfg is None: raise DistutilsError( "%s is not a valid distutils Windows .exe" % dist_filename ) # Create a dummy distribution object until we build the real distro dist = Distribution( None, project_name=cfg.get('metadata', 'name'), version=cfg.get('metadata', 'version'), platform=get_platform(), ) # Convert the .exe to an unpacked egg egg_path = os.path.join(tmpdir, dist.egg_name() + '.egg') dist.location = egg_path egg_tmp = egg_path + '.tmp' _egg_info = os.path.join(egg_tmp, 'EGG-INFO') pkg_inf = os.path.join(_egg_info, 'PKG-INFO') ensure_directory(pkg_inf) # make sure EGG-INFO dir exists dist._provider = PathMetadata(egg_tmp, _egg_info) # XXX self.exe_to_egg(dist_filename, egg_tmp) # Write EGG-INFO/PKG-INFO if not os.path.exists(pkg_inf): f = open(pkg_inf, 'w') f.write('Metadata-Version: 1.0\n') for k, v in cfg.items('metadata'): if k != 'target_version': f.write('%s: %s\n' % (k.replace('_', '-').title(), v)) f.close() script_dir = os.path.join(_egg_info, 'scripts') # delete entry-point scripts to avoid duping self.delete_blockers([ os.path.join(script_dir, args[0]) for args in ScriptWriter.get_args(dist) ]) # Build .egg file from tmpdir bdist_egg.make_zipfile( egg_path, egg_tmp, verbose=self.verbose, dry_run=self.dry_run, ) # install the .egg return self.install_egg(egg_path, tmpdir) def exe_to_egg(self, dist_filename, egg_tmp): """Extract a bdist_wininst to the directories an egg would use""" # Check for .pth file and set up prefix translations prefixes = get_exe_prefixes(dist_filename) to_compile = [] native_libs = [] top_level = {} def process(src, dst): s = src.lower() for old, new in prefixes: if s.startswith(old): src = new + src[len(old):] parts = src.split('/') dst = os.path.join(egg_tmp, *parts) dl = dst.lower() if dl.endswith('.pyd') or dl.endswith('.dll'): parts[-1] = bdist_egg.strip_module(parts[-1]) top_level[os.path.splitext(parts[0])[0]] = 1 native_libs.append(src) elif dl.endswith('.py') and old != 'SCRIPTS/': top_level[os.path.splitext(parts[0])[0]] = 1 to_compile.append(dst) return dst if not src.endswith('.pth'): log.warn("WARNING: can't process %s", src) return None # extract, tracking .pyd/.dll->native_libs and .py -> to_compile unpack_archive(dist_filename, egg_tmp, process) stubs = [] for res in native_libs: if res.lower().endswith('.pyd'): # create stubs for .pyd's parts = res.split('/') resource = parts[-1] parts[-1] = bdist_egg.strip_module(parts[-1]) + '.py' pyfile = os.path.join(egg_tmp, *parts) to_compile.append(pyfile) stubs.append(pyfile) bdist_egg.write_stub(resource, pyfile) self.byte_compile(to_compile) # compile .py's bdist_egg.write_safety_flag( os.path.join(egg_tmp, 'EGG-INFO'), bdist_egg.analyze_egg(egg_tmp, stubs)) # write zip-safety flag for name in 'top_level', 'native_libs': if locals()[name]: txt = os.path.join(egg_tmp, 'EGG-INFO', name + '.txt') if not os.path.exists(txt): f = open(txt, 'w') f.write('\n'.join(locals()[name]) + '\n') f.close() def install_wheel(self, wheel_path, tmpdir): wheel = Wheel(wheel_path) assert wheel.is_compatible() destination = os.path.join(self.install_dir, wheel.egg_name()) destination = os.path.abspath(destination) if not self.dry_run: ensure_directory(destination) if os.path.isdir(destination) and not os.path.islink(destination): dir_util.remove_tree(destination, dry_run=self.dry_run) elif os.path.exists(destination): self.execute( os.unlink, (destination,), "Removing " + destination, ) try: self.execute( wheel.install_as_egg, (destination,), ("Installing %s to %s") % ( os.path.basename(wheel_path), os.path.dirname(destination) ), ) finally: update_dist_caches(destination, fix_zipimporter_caches=False) self.add_output(destination) return self.egg_distribution(destination) __mv_warning = textwrap.dedent(""" Because this distribution was installed --multi-version, before you can import modules from this package in an application, you will need to 'import pkg_resources' and then use a 'require()' call similar to one of these examples, in order to select the desired version: pkg_resources.require("%(name)s") # latest installed version pkg_resources.require("%(name)s==%(version)s") # this exact version pkg_resources.require("%(name)s>=%(version)s") # this version or higher """).lstrip() __id_warning = textwrap.dedent(""" Note also that the installation directory must be on sys.path at runtime for this to work. (e.g. by being the application's script directory, by being on PYTHONPATH, or by being added to sys.path by your code.) """) def installation_report(self, req, dist, what="Installed"): """Helpful installation message for display to package users""" msg = "\n%(what)s %(eggloc)s%(extras)s" if self.multi_version and not self.no_report: msg += '\n' + self.__mv_warning if self.install_dir not in map(normalize_path, sys.path): msg += '\n' + self.__id_warning eggloc = dist.location name = dist.project_name version = dist.version extras = '' # TODO: self.report_extras(req, dist) return msg % locals() __editable_msg = textwrap.dedent(""" Extracted editable version of %(spec)s to %(dirname)s If it uses setuptools in its setup script, you can activate it in "development" mode by going to that directory and running:: %(python)s setup.py develop See the setuptools documentation for the "develop" command for more info. """).lstrip() def report_editable(self, spec, setup_script): dirname = os.path.dirname(setup_script) python = sys.executable return '\n' + self.__editable_msg % locals() def run_setup(self, setup_script, setup_base, args): sys.modules.setdefault('distutils.command.bdist_egg', bdist_egg) sys.modules.setdefault('distutils.command.egg_info', egg_info) args = list(args) if self.verbose > 2: v = 'v' * (self.verbose - 1) args.insert(0, '-' + v) elif self.verbose < 2: args.insert(0, '-q') if self.dry_run: args.insert(0, '-n') log.info( "Running %s %s", setup_script[len(setup_base) + 1:], ' '.join(args) ) try: run_setup(setup_script, args) except SystemExit as v: raise DistutilsError("Setup script exited with %s" % (v.args[0],)) def build_and_install(self, setup_script, setup_base): args = ['bdist_egg', '--dist-dir'] dist_dir = tempfile.mkdtemp( prefix='egg-dist-tmp-', dir=os.path.dirname(setup_script) ) try: self._set_fetcher_options(os.path.dirname(setup_script)) args.append(dist_dir) self.run_setup(setup_script, setup_base, args) all_eggs = Environment([dist_dir]) eggs = [] for key in all_eggs: for dist in all_eggs[key]: eggs.append(self.install_egg(dist.location, setup_base)) if not eggs and not self.dry_run: log.warn("No eggs found in %s (setup script problem?)", dist_dir) return eggs finally: rmtree(dist_dir) log.set_verbosity(self.verbose) # restore our log verbosity def _set_fetcher_options(self, base): """ When easy_install is about to run bdist_egg on a source dist, that source dist might have 'setup_requires' directives, requiring additional fetching. Ensure the fetcher options given to easy_install are available to that command as well. """ # find the fetch options from easy_install and write them out # to the setup.cfg file. ei_opts = self.distribution.get_option_dict('easy_install').copy() fetch_directives = ( 'find_links', 'site_dirs', 'index_url', 'optimize', 'site_dirs', 'allow_hosts', ) fetch_options = {} for key, val in ei_opts.items(): if key not in fetch_directives: continue fetch_options[key.replace('_', '-')] = val[1] # create a settings dictionary suitable for `edit_config` settings = dict(easy_install=fetch_options) cfg_filename = os.path.join(base, 'setup.cfg') setopt.edit_config(cfg_filename, settings) def update_pth(self, dist): if self.pth_file is None: return for d in self.pth_file[dist.key]: # drop old entries if self.multi_version or d.location != dist.location: log.info("Removing %s from easy-install.pth file", d) self.pth_file.remove(d) if d.location in self.shadow_path: self.shadow_path.remove(d.location) if not self.multi_version: if dist.location in self.pth_file.paths: log.info( "%s is already the active version in easy-install.pth", dist, ) else: log.info("Adding %s to easy-install.pth file", dist) self.pth_file.add(dist) # add new entry if dist.location not in self.shadow_path: self.shadow_path.append(dist.location) if not self.dry_run: self.pth_file.save() if dist.key == 'setuptools': # Ensure that setuptools itself never becomes unavailable! # XXX should this check for latest version? filename = os.path.join(self.install_dir, 'setuptools.pth') if os.path.islink(filename): os.unlink(filename) f = open(filename, 'wt') f.write(self.pth_file.make_relative(dist.location) + '\n') f.close() def unpack_progress(self, src, dst): # Progress filter for unpacking log.debug("Unpacking %s to %s", src, dst) return dst # only unpack-and-compile skips files for dry run def unpack_and_compile(self, egg_path, destination): to_compile = [] to_chmod = [] def pf(src, dst): if dst.endswith('.py') and not src.startswith('EGG-INFO/'): to_compile.append(dst) elif dst.endswith('.dll') or dst.endswith('.so'): to_chmod.append(dst) self.unpack_progress(src, dst) return not self.dry_run and dst or None unpack_archive(egg_path, destination, pf) self.byte_compile(to_compile) if not self.dry_run: for f in to_chmod: mode = ((os.stat(f)[stat.ST_MODE]) | 0o555) & 0o7755 chmod(f, mode) def byte_compile(self, to_compile): if sys.dont_write_bytecode: return from distutils.util import byte_compile try: # try to make the byte compile messages quieter log.set_verbosity(self.verbose - 1) byte_compile(to_compile, optimize=0, force=1, dry_run=self.dry_run) if self.optimize: byte_compile( to_compile, optimize=self.optimize, force=1, dry_run=self.dry_run, ) finally: log.set_verbosity(self.verbose) # restore original verbosity __no_default_msg = textwrap.dedent(""" bad install directory or PYTHONPATH You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s and your PYTHONPATH environment variable currently contains: %r Here are some of your options for correcting the problem: * You can choose a different installation directory, i.e., one that is on PYTHONPATH or supports .pth files * You can add the installation directory to the PYTHONPATH environment variable. (It must then also be on PYTHONPATH whenever you run Python and want to use the package(s) you are installing.) * You can set up the installation directory to support ".pth" files by using one of the approaches described here: https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations Please make the appropriate changes for your system and try again.""").lstrip() def no_default_version_msg(self): template = self.__no_default_msg return template % (self.install_dir, os.environ.get('PYTHONPATH', '')) def install_site_py(self): """Make sure there's a site.py in the target dir, if needed""" if self.sitepy_installed: return # already did it, or don't need to sitepy = os.path.join(self.install_dir, "site.py") source = resource_string("setuptools", "site-patch.py") source = source.decode('utf-8') current = "" if os.path.exists(sitepy): log.debug("Checking existing site.py in %s", self.install_dir) with io.open(sitepy) as strm: current = strm.read() if not current.startswith('def __boot():'): raise DistutilsError( "%s is not a setuptools-generated site.py; please" " remove it." % sitepy ) if current != source: log.info("Creating %s", sitepy) if not self.dry_run: ensure_directory(sitepy) with io.open(sitepy, 'w', encoding='utf-8') as strm: strm.write(source) self.byte_compile([sitepy]) self.sitepy_installed = True def create_home_path(self): """Create directories under ~.""" if not self.user: return home = convert_path(os.path.expanduser("~")) for name, path in six.iteritems(self.config_vars): if path.startswith(home) and not os.path.isdir(path): self.debug_print("os.makedirs('%s', 0o700)" % path) os.makedirs(path, 0o700) INSTALL_SCHEMES = dict( posix=dict( install_dir='$base/lib/python$py_version_short/site-packages', script_dir='$base/bin', ), ) DEFAULT_SCHEME = dict( install_dir='$base/Lib/site-packages', script_dir='$base/Scripts', ) def _expand(self, *attrs): config_vars = self.get_finalized_command('install').config_vars if self.prefix: # Set default install_dir/scripts from --prefix config_vars = config_vars.copy() config_vars['base'] = self.prefix scheme = self.INSTALL_SCHEMES.get(os.name, self.DEFAULT_SCHEME) for attr, val in scheme.items(): if getattr(self, attr, None) is None: setattr(self, attr, val) from distutils.util import subst_vars for attr in attrs: val = getattr(self, attr) if val is not None: val = subst_vars(val, config_vars) if os.name == 'posix': val = os.path.expanduser(val) setattr(self, attr, val) def _pythonpath(): items = os.environ.get('PYTHONPATH', '').split(os.pathsep) return filter(None, items) def get_site_dirs(): """ Return a list of 'site' dirs """ sitedirs = [] # start with PYTHONPATH sitedirs.extend(_pythonpath()) prefixes = [sys.prefix] if sys.exec_prefix != sys.prefix: prefixes.append(sys.exec_prefix) for prefix in prefixes: if prefix: if sys.platform in ('os2emx', 'riscos'): sitedirs.append(os.path.join(prefix, "Lib", "site-packages")) elif os.sep == '/': sitedirs.extend([ os.path.join( prefix, "lib", "python" + sys.version[:3], "site-packages", ), os.path.join(prefix, "lib", "site-python"), ]) else: sitedirs.extend([ prefix, os.path.join(prefix, "lib", "site-packages"), ]) if sys.platform == 'darwin': # for framework builds *only* we add the standard Apple # locations. Currently only per-user, but /Library and # /Network/Library could be added too if 'Python.framework' in prefix: home = os.environ.get('HOME') if home: home_sp = os.path.join( home, 'Library', 'Python', sys.version[:3], 'site-packages', ) sitedirs.append(home_sp) lib_paths = get_path('purelib'), get_path('platlib') for site_lib in lib_paths: if site_lib not in sitedirs: sitedirs.append(site_lib) if site.ENABLE_USER_SITE: sitedirs.append(site.USER_SITE) try: sitedirs.extend(site.getsitepackages()) except AttributeError: pass sitedirs = list(map(normalize_path, sitedirs)) return sitedirs def expand_paths(inputs): """Yield sys.path directories that might contain "old-style" packages""" seen = {} for dirname in inputs: dirname = normalize_path(dirname) if dirname in seen: continue seen[dirname] = 1 if not os.path.isdir(dirname): continue files = os.listdir(dirname) yield dirname, files for name in files: if not name.endswith('.pth'): # We only care about the .pth files continue if name in ('easy-install.pth', 'setuptools.pth'): # Ignore .pth files that we control continue # Read the .pth file f = open(os.path.join(dirname, name)) lines = list(yield_lines(f)) f.close() # Yield existing non-dupe, non-import directory lines from it for line in lines: if not line.startswith("import"): line = normalize_path(line.rstrip()) if line not in seen: seen[line] = 1 if not os.path.isdir(line): continue yield line, os.listdir(line) def extract_wininst_cfg(dist_filename): """Extract configuration data from a bdist_wininst .exe Returns a configparser.RawConfigParser, or None """ f = open(dist_filename, 'rb') try: endrec = zipfile._EndRecData(f) if endrec is None: return None prepended = (endrec[9] - endrec[5]) - endrec[6] if prepended < 12: # no wininst data here return None f.seek(prepended - 12) tag, cfglen, bmlen = struct.unpack("egg path translations for a given .exe file""" prefixes = [ ('PURELIB/', ''), ('PLATLIB/pywin32_system32', ''), ('PLATLIB/', ''), ('SCRIPTS/', 'EGG-INFO/scripts/'), ('DATA/lib/site-packages', ''), ] z = zipfile.ZipFile(exe_filename) try: for info in z.infolist(): name = info.filename parts = name.split('/') if len(parts) == 3 and parts[2] == 'PKG-INFO': if parts[1].endswith('.egg-info'): prefixes.insert(0, ('/'.join(parts[:2]), 'EGG-INFO/')) break if len(parts) != 2 or not name.endswith('.pth'): continue if name.endswith('-nspkg.pth'): continue if parts[0].upper() in ('PURELIB', 'PLATLIB'): contents = z.read(name) if six.PY3: contents = contents.decode() for pth in yield_lines(contents): pth = pth.strip().replace('\\', '/') if not pth.startswith('import'): prefixes.append((('%s/%s/' % (parts[0], pth)), '')) finally: z.close() prefixes = [(x.lower(), y) for x, y in prefixes] prefixes.sort() prefixes.reverse() return prefixes class PthDistributions(Environment): """A .pth file with Distribution paths in it""" dirty = False def __init__(self, filename, sitedirs=()): self.filename = filename self.sitedirs = list(map(normalize_path, sitedirs)) self.basedir = normalize_path(os.path.dirname(self.filename)) self._load() Environment.__init__(self, [], None, None) for path in yield_lines(self.paths): list(map(self.add, find_distributions(path, True))) def _load(self): self.paths = [] saw_import = False seen = dict.fromkeys(self.sitedirs) if os.path.isfile(self.filename): f = open(self.filename, 'rt') for line in f: if line.startswith('import'): saw_import = True continue path = line.rstrip() self.paths.append(path) if not path.strip() or path.strip().startswith('#'): continue # skip non-existent paths, in case somebody deleted a package # manually, and duplicate paths as well path = self.paths[-1] = normalize_path( os.path.join(self.basedir, path) ) if not os.path.exists(path) or path in seen: self.paths.pop() # skip it self.dirty = True # we cleaned up, so we're dirty now :) continue seen[path] = 1 f.close() if self.paths and not saw_import: self.dirty = True # ensure anything we touch has import wrappers while self.paths and not self.paths[-1].strip(): self.paths.pop() def save(self): """Write changed .pth file back to disk""" if not self.dirty: return rel_paths = list(map(self.make_relative, self.paths)) if rel_paths: log.debug("Saving %s", self.filename) lines = self._wrap_lines(rel_paths) data = '\n'.join(lines) + '\n' if os.path.islink(self.filename): os.unlink(self.filename) with open(self.filename, 'wt') as f: f.write(data) elif os.path.exists(self.filename): log.debug("Deleting empty %s", self.filename) os.unlink(self.filename) self.dirty = False @staticmethod def _wrap_lines(lines): return lines def add(self, dist): """Add `dist` to the distribution map""" new_path = ( dist.location not in self.paths and ( dist.location not in self.sitedirs or # account for '.' being in PYTHONPATH dist.location == os.getcwd() ) ) if new_path: self.paths.append(dist.location) self.dirty = True Environment.add(self, dist) def remove(self, dist): """Remove `dist` from the distribution map""" while dist.location in self.paths: self.paths.remove(dist.location) self.dirty = True Environment.remove(self, dist) def make_relative(self, path): npath, last = os.path.split(normalize_path(path)) baselen = len(self.basedir) parts = [last] sep = os.altsep == '/' and '/' or os.sep while len(npath) >= baselen: if npath == self.basedir: parts.append(os.curdir) parts.reverse() return sep.join(parts) npath, last = os.path.split(npath) parts.append(last) else: return path class RewritePthDistributions(PthDistributions): @classmethod def _wrap_lines(cls, lines): yield cls.prelude for line in lines: yield line yield cls.postlude prelude = _one_liner(""" import sys sys.__plen = len(sys.path) """) postlude = _one_liner(""" import sys new = sys.path[sys.__plen:] del sys.path[sys.__plen:] p = getattr(sys, '__egginsert', 0) sys.path[p:p] = new sys.__egginsert = p + len(new) """) if os.environ.get('SETUPTOOLS_SYS_PATH_TECHNIQUE', 'raw') == 'rewrite': PthDistributions = RewritePthDistributions def _first_line_re(): """ Return a regular expression based on first_line_re suitable for matching strings. """ if isinstance(first_line_re.pattern, str): return first_line_re # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern. return re.compile(first_line_re.pattern.decode()) def auto_chmod(func, arg, exc): if func in [os.unlink, os.remove] and os.name == 'nt': chmod(arg, stat.S_IWRITE) return func(arg) et, ev, _ = sys.exc_info() six.reraise(et, (ev[0], ev[1] + (" %s %s" % (func, arg)))) def update_dist_caches(dist_path, fix_zipimporter_caches): """ Fix any globally cached `dist_path` related data `dist_path` should be a path of a newly installed egg distribution (zipped or unzipped). sys.path_importer_cache contains finder objects that have been cached when importing data from the original distribution. Any such finders need to be cleared since the replacement distribution might be packaged differently, e.g. a zipped egg distribution might get replaced with an unzipped egg folder or vice versa. Having the old finders cached may then cause Python to attempt loading modules from the replacement distribution using an incorrect loader. zipimport.zipimporter objects are Python loaders charged with importing data packaged inside zip archives. If stale loaders referencing the original distribution, are left behind, they can fail to load modules from the replacement distribution. E.g. if an old zipimport.zipimporter instance is used to load data from a new zipped egg archive, it may cause the operation to attempt to locate the requested data in the wrong location - one indicated by the original distribution's zip archive directory information. Such an operation may then fail outright, e.g. report having read a 'bad local file header', or even worse, it may fail silently & return invalid data. zipimport._zip_directory_cache contains cached zip archive directory information for all existing zipimport.zipimporter instances and all such instances connected to the same archive share the same cached directory information. If asked, and the underlying Python implementation allows it, we can fix all existing zipimport.zipimporter instances instead of having to track them down and remove them one by one, by updating their shared cached zip archive directory information. This, of course, assumes that the replacement distribution is packaged as a zipped egg. If not asked to fix existing zipimport.zipimporter instances, we still do our best to clear any remaining zipimport.zipimporter related cached data that might somehow later get used when attempting to load data from the new distribution and thus cause such load operations to fail. Note that when tracking down such remaining stale data, we can not catch every conceivable usage from here, and we clear only those that we know of and have found to cause problems if left alive. Any remaining caches should be updated by whomever is in charge of maintaining them, i.e. they should be ready to handle us replacing their zip archives with new distributions at runtime. """ # There are several other known sources of stale zipimport.zipimporter # instances that we do not clear here, but might if ever given a reason to # do so: # * Global setuptools pkg_resources.working_set (a.k.a. 'master working # set') may contain distributions which may in turn contain their # zipimport.zipimporter loaders. # * Several zipimport.zipimporter loaders held by local variables further # up the function call stack when running the setuptools installation. # * Already loaded modules may have their __loader__ attribute set to the # exact loader instance used when importing them. Python 3.4 docs state # that this information is intended mostly for introspection and so is # not expected to cause us problems. normalized_path = normalize_path(dist_path) _uncache(normalized_path, sys.path_importer_cache) if fix_zipimporter_caches: _replace_zip_directory_cache_data(normalized_path) else: # Here, even though we do not want to fix existing and now stale # zipimporter cache information, we still want to remove it. Related to # Python's zip archive directory information cache, we clear each of # its stale entries in two phases: # 1. Clear the entry so attempting to access zip archive information # via any existing stale zipimport.zipimporter instances fails. # 2. Remove the entry from the cache so any newly constructed # zipimport.zipimporter instances do not end up using old stale # zip archive directory information. # This whole stale data removal step does not seem strictly necessary, # but has been left in because it was done before we started replacing # the zip archive directory information cache content if possible, and # there are no relevant unit tests that we can depend on to tell us if # this is really needed. _remove_and_clear_zip_directory_cache_data(normalized_path) def _collect_zipimporter_cache_entries(normalized_path, cache): """ Return zipimporter cache entry keys related to a given normalized path. Alternative path spellings (e.g. those using different character case or those using alternative path separators) related to the same path are included. Any sub-path entries are included as well, i.e. those corresponding to zip archives embedded in other zip archives. """ result = [] prefix_len = len(normalized_path) for p in cache: np = normalize_path(p) if (np.startswith(normalized_path) and np[prefix_len:prefix_len + 1] in (os.sep, '')): result.append(p) return result def _update_zipimporter_cache(normalized_path, cache, updater=None): """ Update zipimporter cache data for a given normalized path. Any sub-path entries are processed as well, i.e. those corresponding to zip archives embedded in other zip archives. Given updater is a callable taking a cache entry key and the original entry (after already removing the entry from the cache), and expected to update the entry and possibly return a new one to be inserted in its place. Returning None indicates that the entry should not be replaced with a new one. If no updater is given, the cache entries are simply removed without any additional processing, the same as if the updater simply returned None. """ for p in _collect_zipimporter_cache_entries(normalized_path, cache): # N.B. pypy's custom zipimport._zip_directory_cache implementation does # not support the complete dict interface: # * Does not support item assignment, thus not allowing this function # to be used only for removing existing cache entries. # * Does not support the dict.pop() method, forcing us to use the # get/del patterns instead. For more detailed information see the # following links: # https://github.com/pypa/setuptools/issues/202#issuecomment-202913420 # http://bit.ly/2h9itJX old_entry = cache[p] del cache[p] new_entry = updater and updater(p, old_entry) if new_entry is not None: cache[p] = new_entry def _uncache(normalized_path, cache): _update_zipimporter_cache(normalized_path, cache) def _remove_and_clear_zip_directory_cache_data(normalized_path): def clear_and_remove_cached_zip_archive_directory_data(path, old_entry): old_entry.clear() _update_zipimporter_cache( normalized_path, zipimport._zip_directory_cache, updater=clear_and_remove_cached_zip_archive_directory_data) # PyPy Python implementation does not allow directly writing to the # zipimport._zip_directory_cache and so prevents us from attempting to correct # its content. The best we can do there is clear the problematic cache content # and have PyPy repopulate it as needed. The downside is that if there are any # stale zipimport.zipimporter instances laying around, attempting to use them # will fail due to not having its zip archive directory information available # instead of being automatically corrected to use the new correct zip archive # directory information. if '__pypy__' in sys.builtin_module_names: _replace_zip_directory_cache_data = \ _remove_and_clear_zip_directory_cache_data else: def _replace_zip_directory_cache_data(normalized_path): def replace_cached_zip_archive_directory_data(path, old_entry): # N.B. In theory, we could load the zip directory information just # once for all updated path spellings, and then copy it locally and # update its contained path strings to contain the correct # spelling, but that seems like a way too invasive move (this cache # structure is not officially documented anywhere and could in # theory change with new Python releases) for no significant # benefit. old_entry.clear() zipimport.zipimporter(path) old_entry.update(zipimport._zip_directory_cache[path]) return old_entry _update_zipimporter_cache( normalized_path, zipimport._zip_directory_cache, updater=replace_cached_zip_archive_directory_data) def is_python(text, filename=''): "Is this string a valid Python script?" try: compile(text, filename, 'exec') except (SyntaxError, TypeError): return False else: return True def is_sh(executable): """Determine if the specified executable is a .sh (contains a #! line)""" try: with io.open(executable, encoding='latin-1') as fp: magic = fp.read(2) except (OSError, IOError): return executable return magic == '#!' def nt_quote_arg(arg): """Quote a command line argument according to Windows parsing rules""" return subprocess.list2cmdline([arg]) def is_python_script(script_text, filename): """Is this text, as a whole, a Python script? (as opposed to shell/bat/etc. """ if filename.endswith('.py') or filename.endswith('.pyw'): return True # extension says it's Python if is_python(script_text, filename): return True # it's syntactically valid Python if script_text.startswith('#!'): # It begins with a '#!' line, so check if 'python' is in it somewhere return 'python' in script_text.splitlines()[0].lower() return False # Not any Python I can recognize try: from os import chmod as _chmod except ImportError: # Jython compatibility def _chmod(*args): pass def chmod(path, mode): log.debug("changing mode of %s to %o", path, mode) try: _chmod(path, mode) except os.error as e: log.debug("chmod failed: %s", e) class CommandSpec(list): """ A command spec for a #! header, specified as a list of arguments akin to those passed to Popen. """ options = [] split_args = dict() @classmethod def best(cls): """ Choose the best CommandSpec class based on environmental conditions. """ return cls @classmethod def _sys_executable(cls): _default = os.path.normpath(sys.executable) return os.environ.get('__PYVENV_LAUNCHER__', _default) @classmethod def from_param(cls, param): """ Construct a CommandSpec from a parameter to build_scripts, which may be None. """ if isinstance(param, cls): return param if isinstance(param, list): return cls(param) if param is None: return cls.from_environment() # otherwise, assume it's a string. return cls.from_string(param) @classmethod def from_environment(cls): return cls([cls._sys_executable()]) @classmethod def from_string(cls, string): """ Construct a command spec from a simple string representing a command line parseable by shlex.split. """ items = shlex.split(string, **cls.split_args) return cls(items) def install_options(self, script_text): self.options = shlex.split(self._extract_options(script_text)) cmdline = subprocess.list2cmdline(self) if not isascii(cmdline): self.options[:0] = ['-x'] @staticmethod def _extract_options(orig_script): """ Extract any options from the first line of the script. """ first = (orig_script + '\n').splitlines()[0] match = _first_line_re().match(first) options = match.group(1) or '' if match else '' return options.strip() def as_header(self): return self._render(self + list(self.options)) @staticmethod def _strip_quotes(item): _QUOTES = '"\'' for q in _QUOTES: if item.startswith(q) and item.endswith(q): return item[1:-1] return item @staticmethod def _render(items): cmdline = subprocess.list2cmdline( CommandSpec._strip_quotes(item.strip()) for item in items) return '#!' + cmdline + '\n' # For pbr compat; will be removed in a future version. sys_executable = CommandSpec._sys_executable() class WindowsCommandSpec(CommandSpec): split_args = dict(posix=False) class ScriptWriter(object): """ Encapsulates behavior around writing entry point scripts for console and gui apps. """ template = textwrap.dedent(r""" # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r __requires__ = %(spec)r import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point(%(spec)r, %(group)r, %(name)r)() ) """).lstrip() command_spec_class = CommandSpec @classmethod def get_script_args(cls, dist, executable=None, wininst=False): # for backward compatibility warnings.warn("Use get_args", DeprecationWarning) writer = (WindowsScriptWriter if wininst else ScriptWriter).best() header = cls.get_script_header("", executable, wininst) return writer.get_args(dist, header) @classmethod def get_script_header(cls, script_text, executable=None, wininst=False): # for backward compatibility warnings.warn("Use get_header", DeprecationWarning) if wininst: executable = "python.exe" cmd = cls.command_spec_class.best().from_param(executable) cmd.install_options(script_text) return cmd.as_header() @classmethod def get_args(cls, dist, header=None): """ Yield write_script() argument tuples for a distribution's console_scripts and gui_scripts entry points. """ if header is None: header = cls.get_header() spec = str(dist.as_requirement()) for type_ in 'console', 'gui': group = type_ + '_scripts' for name, ep in dist.get_entry_map(group).items(): cls._ensure_safe_name(name) script_text = cls.template % locals() args = cls._get_script_args(type_, name, header, script_text) for res in args: yield res @staticmethod def _ensure_safe_name(name): """ Prevent paths in *_scripts entry point names. """ has_path_sep = re.search(r'[\\/]', name) if has_path_sep: raise ValueError("Path separators not allowed in script names") @classmethod def get_writer(cls, force_windows): # for backward compatibility warnings.warn("Use best", DeprecationWarning) return WindowsScriptWriter.best() if force_windows else cls.best() @classmethod def best(cls): """ Select the best ScriptWriter for this environment. """ if sys.platform == 'win32' or (os.name == 'java' and os._name == 'nt'): return WindowsScriptWriter.best() else: return cls @classmethod def _get_script_args(cls, type_, name, header, script_text): # Simply write the stub with no extension. yield (name, header + script_text) @classmethod def get_header(cls, script_text="", executable=None): """Create a #! line, getting options (if any) from script_text""" cmd = cls.command_spec_class.best().from_param(executable) cmd.install_options(script_text) return cmd.as_header() class WindowsScriptWriter(ScriptWriter): command_spec_class = WindowsCommandSpec @classmethod def get_writer(cls): # for backward compatibility warnings.warn("Use best", DeprecationWarning) return cls.best() @classmethod def best(cls): """ Select the best ScriptWriter suitable for Windows """ writer_lookup = dict( executable=WindowsExecutableLauncherWriter, natural=cls, ) # for compatibility, use the executable launcher by default launcher = os.environ.get('SETUPTOOLS_LAUNCHER', 'executable') return writer_lookup[launcher] @classmethod def _get_script_args(cls, type_, name, header, script_text): "For Windows, add a .py extension" ext = dict(console='.pya', gui='.pyw')[type_] if ext not in os.environ['PATHEXT'].lower().split(';'): msg = ( "{ext} not listed in PATHEXT; scripts will not be " "recognized as executables." ).format(**locals()) warnings.warn(msg, UserWarning) old = ['.pya', '.py', '-script.py', '.pyc', '.pyo', '.pyw', '.exe'] old.remove(ext) header = cls._adjust_header(type_, header) blockers = [name + x for x in old] yield name + ext, header + script_text, 't', blockers @classmethod def _adjust_header(cls, type_, orig_header): """ Make sure 'pythonw' is used for gui and and 'python' is used for console (regardless of what sys.executable is). """ pattern = 'pythonw.exe' repl = 'python.exe' if type_ == 'gui': pattern, repl = repl, pattern pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE) new_header = pattern_ob.sub(string=orig_header, repl=repl) return new_header if cls._use_header(new_header) else orig_header @staticmethod def _use_header(new_header): """ Should _adjust_header use the replaced header? On non-windows systems, always use. On Windows systems, only use the replaced header if it resolves to an executable on the system. """ clean_header = new_header[2:-1].strip('"') return sys.platform != 'win32' or find_executable(clean_header) class WindowsExecutableLauncherWriter(WindowsScriptWriter): @classmethod def _get_script_args(cls, type_, name, header, script_text): """ For Windows, add a .py extension and an .exe launcher """ if type_ == 'gui': launcher_type = 'gui' ext = '-script.pyw' old = ['.pyw'] else: launcher_type = 'cli' ext = '-script.py' old = ['.py', '.pyc', '.pyo'] hdr = cls._adjust_header(type_, header) blockers = [name + x for x in old] yield (name + ext, hdr + script_text, 't', blockers) yield ( name + '.exe', get_win_launcher(launcher_type), 'b' # write in binary mode ) if not is_64bit(): # install a manifest for the launcher to prevent Windows # from detecting it as an installer (which it will for # launchers like easy_install.exe). Consider only # adding a manifest for launchers detected as installers. # See Distribute #143 for details. m_name = name + '.exe.manifest' yield (m_name, load_launcher_manifest(name), 't') # for backward-compatibility get_script_args = ScriptWriter.get_script_args get_script_header = ScriptWriter.get_script_header def get_win_launcher(type): """ Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string. """ launcher_fn = '%s.exe' % type if is_64bit(): launcher_fn = launcher_fn.replace(".", "-64.") else: launcher_fn = launcher_fn.replace(".", "-32.") return resource_string('setuptools', launcher_fn) def load_launcher_manifest(name): manifest = pkg_resources.resource_string(__name__, 'launcher manifest.xml') if six.PY2: return manifest % vars() else: return manifest.decode('utf-8') % vars() def rmtree(path, ignore_errors=False, onerror=auto_chmod): return shutil.rmtree(path, ignore_errors, onerror) def current_umask(): tmp = os.umask(0o022) os.umask(tmp) return tmp def bootstrap(): # This function is called when setuptools*.egg is run using /bin/sh import setuptools argv0 = os.path.dirname(setuptools.__path__[0]) sys.argv[0] = argv0 sys.argv.append(argv0) main() def main(argv=None, **kw): from setuptools import setup from setuptools.dist import Distribution class DistributionWithoutHelpCommands(Distribution): common_usage = "" def _show_help(self, *args, **kw): with _patch_usage(): Distribution._show_help(self, *args, **kw) if argv is None: argv = sys.argv[1:] with _patch_usage(): setup( script_args=['-q', 'easy_install', '-v'] + argv, script_name=sys.argv[0] or 'easy_install', distclass=DistributionWithoutHelpCommands, **kw ) @contextlib.contextmanager def _patch_usage(): import distutils.core USAGE = textwrap.dedent(""" usage: %(script)s [options] requirement_or_url ... or: %(script)s --help """).lstrip() def gen_usage(script_name): return USAGE % dict( script=os.path.basename(script_name), ) saved = distutils.core.gen_usage distutils.core.gen_usage = gen_usage try: yield finally: distutils.core.gen_usage = saved build_clib.py000064400000017526147210141470007222 0ustar00"""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) install.py000064400000065207147210141470006577 0ustar00"""distutils.command.install Implements the Distutils 'install' command.""" import sys import os from distutils import log from distutils.core import Command from distutils.debug import DEBUG from distutils.sysconfig import get_config_vars 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 = True WINDOWS_SCHEME = { 'purelib': '$base/Lib/site-packages', 'platlib': '$base/Lib/site-packages', 'headers': '$base/Include/$dist_name', 'scripts': '$base/Scripts', 'data' : '$base', } INSTALL_SCHEMES = { 'unix_prefix': { 'purelib': '$base/lib/python$py_version_short/site-packages', 'platlib': '$platbase/lib64/python$py_version_short/site-packages', 'headers': '$base/include/python$py_version_short$abiflags/$dist_name', 'scripts': '$base/bin', 'data' : '$base', }, 'unix_home': { 'purelib': '$base/lib/python', 'platlib': '$base/lib64/python', 'headers': '$base/include/python/$dist_name', 'scripts': '$base/bin', 'data' : '$base', }, 'nt': WINDOWS_SCHEME, } # user site schemes 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', } # The keys to an installation scheme; if any new types of files are to be # installed, be sure to add an entry to every installation scheme above, # and to SCHEME_KEYS here. SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data') 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"), ] 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 # 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 self.install_userbase = USER_BASE self.install_usersite = USER_SITE 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 pliant slaves, 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, } if HAS_USER_SITE: self.config_vars['userbase'] = self.install_userbase self.config_vars['usersite'] = self.install_usersite 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', '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: if self.prefix is None: if self.exec_prefix is not None: raise DistutilsOptionError( "must not supply exec-prefix without prefix") # self.prefix is set to sys.prefix + /local/ # if neither RPM build nor virtual environment is # detected to make pip and distutils install packages # into the separate location. if (not (hasattr(sys, 'real_prefix') or sys.prefix != sys.base_prefix) and 'RPM_BUILD_ROOT' not in os.environ): addition = "/local" else: addition = "" self.prefix = os.path.normpath(sys.prefix) + addition self.exec_prefix = os.path.normpath(sys.exec_prefix) + addition else: if self.exec_prefix is None: self.exec_prefix = self.prefix self.install_base = self.prefix self.install_platbase = self.exec_prefix self.select_scheme("unix_prefix") 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), ] develop.py000064400000017556147210141470006573 0ustar00from distutils.util import convert_path from distutils import log from distutils.errors import DistutilsError, DistutilsOptionError import os import glob import io from setuptools.extern import six from pkg_resources import Distribution, PathMetadata, normalize_path from setuptools.command.easy_install import easy_install from setuptools import namespaces import setuptools class develop(namespaces.DevelopInstaller, easy_install): """Set up package for development""" description = "install package in 'development mode'" user_options = easy_install.user_options + [ ("uninstall", "u", "Uninstall this source package"), ("egg-path=", None, "Set the path to be used in the .egg-link file"), ] boolean_options = easy_install.boolean_options + ['uninstall'] command_consumes_arguments = False # override base def run(self): if self.uninstall: self.multi_version = True self.uninstall_link() self.uninstall_namespaces() else: self.install_for_development() self.warn_deprecated_options() def initialize_options(self): self.uninstall = None self.egg_path = None easy_install.initialize_options(self) self.setup_path = None self.always_copy_from = '.' # always copy eggs installed in curdir def finalize_options(self): ei = self.get_finalized_command("egg_info") if ei.broken_egg_info: template = "Please rename %r to %r before using 'develop'" args = ei.egg_info, ei.broken_egg_info raise DistutilsError(template % args) self.args = [ei.egg_name] easy_install.finalize_options(self) self.expand_basedirs() self.expand_dirs() # pick up setup-dir .egg files only: no .egg-info self.package_index.scan(glob.glob('*.egg')) egg_link_fn = ei.egg_name + '.egg-link' self.egg_link = os.path.join(self.install_dir, egg_link_fn) self.egg_base = ei.egg_base if self.egg_path is None: self.egg_path = os.path.abspath(ei.egg_base) target = normalize_path(self.egg_base) egg_path = normalize_path(os.path.join(self.install_dir, self.egg_path)) if egg_path != target: raise DistutilsOptionError( "--egg-path must be a relative path from the install" " directory to " + target ) # Make a distribution for the package's source self.dist = Distribution( target, PathMetadata(target, os.path.abspath(ei.egg_info)), project_name=ei.egg_name ) self.setup_path = self._resolve_setup_path( self.egg_base, self.install_dir, self.egg_path, ) @staticmethod def _resolve_setup_path(egg_base, install_dir, egg_path): """ Generate a path from egg_base back to '.' where the setup script resides and ensure that path points to the setup path from $install_dir/$egg_path. """ path_to_setup = egg_base.replace(os.sep, '/').rstrip('/') if path_to_setup != os.curdir: path_to_setup = '../' * (path_to_setup.count('/') + 1) resolved = normalize_path( os.path.join(install_dir, egg_path, path_to_setup) ) if resolved != normalize_path(os.curdir): raise DistutilsOptionError( "Can't get a consistent path to setup script from" " installation directory", resolved, normalize_path(os.curdir)) return path_to_setup def install_for_development(self): if six.PY3 and getattr(self.distribution, 'use_2to3', False): # If we run 2to3 we can not do this inplace: # Ensure metadata is up-to-date self.reinitialize_command('build_py', inplace=0) self.run_command('build_py') bpy_cmd = self.get_finalized_command("build_py") build_path = normalize_path(bpy_cmd.build_lib) # Build extensions self.reinitialize_command('egg_info', egg_base=build_path) self.run_command('egg_info') self.reinitialize_command('build_ext', inplace=0) self.run_command('build_ext') # Fixup egg-link and easy-install.pth ei_cmd = self.get_finalized_command("egg_info") self.egg_path = build_path self.dist.location = build_path # XXX self.dist._provider = PathMetadata(build_path, ei_cmd.egg_info) else: # Without 2to3 inplace works fine: self.run_command('egg_info') # Build extensions in-place self.reinitialize_command('build_ext', inplace=1) self.run_command('build_ext') self.install_site_py() # ensure that target dir is site-safe if setuptools.bootstrap_install_from: self.easy_install(setuptools.bootstrap_install_from) setuptools.bootstrap_install_from = None self.install_namespaces() # create an .egg-link in the installation dir, pointing to our egg log.info("Creating %s (link to %s)", self.egg_link, self.egg_base) if not self.dry_run: with open(self.egg_link, "w") as f: f.write(self.egg_path + "\n" + self.setup_path) # postprocess the installed distro, fixing up .pth, installing scripts, # and handling requirements self.process_distribution(None, self.dist, not self.no_deps) def uninstall_link(self): if os.path.exists(self.egg_link): log.info("Removing %s (link to %s)", self.egg_link, self.egg_base) egg_link_file = open(self.egg_link) contents = [line.rstrip() for line in egg_link_file] egg_link_file.close() if contents not in ([self.egg_path], [self.egg_path, self.setup_path]): log.warn("Link points to %s: uninstall aborted", contents) return if not self.dry_run: os.unlink(self.egg_link) if not self.dry_run: self.update_pth(self.dist) # remove any .pth link to us if self.distribution.scripts: # XXX should also check for entry point scripts! log.warn("Note: you must uninstall or replace scripts manually!") def install_egg_scripts(self, dist): if dist is not self.dist: # Installing a dependency, so fall back to normal behavior return easy_install.install_egg_scripts(self, dist) # create wrapper scripts in the script dir, pointing to dist.scripts # new-style... self.install_wrapper_scripts(dist) # ...and old-style for script_name in self.distribution.scripts or []: script_path = os.path.abspath(convert_path(script_name)) script_name = os.path.basename(script_path) with io.open(script_path) as strm: script_text = strm.read() self.install_script(dist, script_name, script_text, script_path) def install_wrapper_scripts(self, dist): dist = VersionlessRequirement(dist) return easy_install.install_wrapper_scripts(self, dist) class VersionlessRequirement(object): """ Adapt a pkg_resources.Distribution to simply return the project name as the 'requirement' so that scripts will work across multiple versions. >>> dist = Distribution(project_name='foo', version='1.0') >>> str(dist.as_requirement()) 'foo==1.0' >>> adapted_dist = VersionlessRequirement(dist) >>> str(adapted_dist.as_requirement()) 'foo' """ def __init__(self, dist): self.__dist = dist def __getattr__(self, name): return getattr(self.__dist, name) def as_requirement(self): return self.project_name sdist.py000064400000042642147210141470006255 0ustar00"""distutils.command.sdist Implements the Distutils 'sdist' command (create a source distribution).""" import os import sys from types import * from glob import glob from warnings import warn from distutils.core import Command from distutils import dir_util, dep_util, file_util, archive_util from distutils.text_file import TextFile from distutils.errors import * from distutils.filelist import FileList from distutils import log from distutils.util import convert_path 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)] 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. """ standards = [('README', 'README.txt'), self.distribution.script_name] for fn in standards: if isinstance(fn, tuple): alts = fn got_it = False for fn in alts: if os.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 os.path.exists(fn): self.filelist.append(fn) else: self.warn("standard file '%s' not found" % fn) optional = ['test/test*.py', 'setup.cfg'] for pattern in optional: files = filter(os.path.isfile, glob(pattern)) self.filelist.extend(files) # 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)) # 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) if self.distribution.has_ext_modules(): build_ext = self.get_finalized_command('build_ext') self.filelist.extend(build_ext.get_source_files()) if self.distribution.has_c_libraries(): build_clib = self.get_finalized_command('build_clib') self.filelist.extend(build_clib.get_source_files()) 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) manifest = open(self.manifest) for line in manifest: # ignore comments and blank lines line = line.strip() if line.startswith('#') or not line: continue self.filelist.append(line) manifest.close() 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 build_scripts.py000064400000014130147221452520007767 0ustar00"""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 check.py000064400000012570147221452520006204 0ustar00"""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 from io import StringIO 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. name, version, URL, (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' must be supplied too") elif metadata.maintainer: if not metadata.maintainer_email: self.warn("missing meta-data: if 'maintainer' supplied, " + "'maintainer_email' must be supplied too") else: self.warn("missing meta-data: either (author and author_email) " + "or (maintainer and maintainer_email) " + "must 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.""" source_path = StringIO() 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 clean.py000064400000005330147221452520006205 0ustar00"""distutils.command.clean Implements the Distutils 'clean' command.""" # contributed by Bastian Kleineidam , 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. 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 bdist.py000064400000012672147221452520006237 0ustar00"""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', 'wininst', '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"), 'wininst': ('bdist_wininst', "Windows executable installer"), '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./dumb", "build/bdist./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) __pycache__/config.cpython-36.opt-1.pyc000064400000024070147221452520013615 0ustar003 \3@sldZddlZddlZddlmZddlmZddlmZddl m Z ddd Z Gd d d eZ dd d Z dS)adistutils.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)czc++c @seZdZdZd>d?d@dAdBdCdDdEdFg ZddZddZddZd d!Zd"d#Z d$d%Z d&d'Z d(d)Z d*d+Z dGd-d.ZdHd/d0ZdId1d2ZdJd3d4ZdKd5d6ZdLd8d9Zdddgfd:d;ZdMd  r)LANG_EXTopenwriteclose)r&bodyheaderslangfilenamefileheaderr'r'r(_gen_temp_sourcefileks       zconfig._gen_temp_sourcefilecCs<|j|||}d}|jj||g|jj|||d||fS)Nz _configtest.i)r!)rDr%extendr Z preprocess)r&r>r?r!r@srcoutr'r'r( _preprocessxs zconfig._preprocesscCs\|j|||}|jr"t|d||jj|g\}|jj||g|jj|g|d||fS)Nzcompiling '%s':)r!)rDr$ dump_filer Zobject_filenamesr%rEcompile)r&r>r?r!r@rFobjr'r'r(_compileszconfig._compilec Csr|j||||\}}tjjtjj|d} |jj|g| |||d|jjdk r\| |jj} |jj | ||| fS)Nr)r"r#Z target_lang) rLr-pathsplitextbasenamer Zlink_executableZ exe_extensionr%append) r&r>r?r!r"r#r@rFrKprogr'r'r(_links    z config._linkc GsX|s|j}g|_tjddj|x0|D](}ytj|Wq(tk rNYq(Xq(WdS)Nz removing: %s )r%rinfojoinr-removeOSError)r& filenamesrAr'r'r(_cleans z config._cleanrc CsRddlm}|jd}y|j||||Wn|k rDd}YnX|j|S)aQConstruct 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)r5rZr6rHrY)r&r>r?r!r@rZokr'r'r(try_cpps  zconfig.try_cppc Csx|j|j||||\}}t|tr0tj|}t|}d} x&|j} | dkrPP|j| r>d} Pq>W|j |j | S)aConstruct 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) r6rHr*r+rerJr;readlinesearchr=rY) r&patternr>r?r!r@rFrGrBmatchliner'r'r( search_cpps    zconfig.search_cppc Csdddlm}|jy|j||||d}Wn|k rDd}YnXtj|rRdpTd|j|S)zwTry to compile a source file built from 'body' and 'headers'. Return true on success, false otherwise. r)rZTFzsuccess!zfailure.)r5rZr6rLrrTrY)r&r>r?r!r@rZr[r'r'r( try_compiles  zconfig.try_compilec Cspddlm}m}|jy|j||||||d} Wn||fk rPd} YnXtj| r^dp`d|j| S)zTry to compile and link a source file, built from 'body' and 'headers', to executable form. Return true on success, false otherwise. r)rZ LinkErrorTFzsuccess!zfailure.)r5rZrfr6rRrrTrY) r&r>r?r!r"r#r@rZrfr[r'r'r(try_links   zconfig.try_linkc Csddlm}m}|jy.|j||||||\} } } |j| gd} Wn||tfk rdd} YnXtj| rrdptd|j | S)zTry to compile, link to an executable, and run a program built from 'body' and 'headers'. Return true on success, false otherwise. r)rZrfTFzsuccess!zfailure.) r5rZrfr6rRZspawnrrrTrY) r&r>r?r!r"r#r@rZrfrFrKZexer[r'r'r(try_runs   zconfig.try_runrc Cst|jg}|r|jd||jd|r<|jd|n|jd||jddj|d}|j|||||S)aDetermine 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;}r8)r6rPrUrg) r&funcr?r!r"r#ZdeclZcallr>r'r'r( check_funcs   zconfig.check_funccCs |j|jd|||g||S)aDetermine 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. zint main (void) { })r6rg)r&Zlibraryr#r?r!Zother_librariesr'r'r( check_lib6s  zconfig.check_libcCs|jd|g|dS)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 */)r>r?r!)r\)r&rCr!r#r@r'r'r( check_headerDs zconfig.check_header)rNr )r Nr )r r r)rrr)rrr)rrr)rrr)rNr)rNr)NNNr)NNNr)NNr)NNNNr)NNNNr)NNNNrr)NNr)__name__ __module__ __qualname__ descriptionZ user_optionsr)r/r0r6rDrHrLrRrYr\rdrergrhrkrlrmr'r'r'r(rsT         rc CsJ|dkrtjd|n tj|t|}ztj|jWd|jXdS)zjDumps a file content into log.info. If head is not None, will be dumped before the file content. Nz%s)rrTr;readr=)rAheadrBr'r'r(rINs rI)N)__doc__r-r^Zdistutils.corerZdistutils.errorsrZdistutils.sysconfigrZ distutilsrr:rrIr'r'r'r( s     ;__pycache__/bdist_rpm.cpython-36.opt-2.pyc000064400000030615147221452520014336 0ustar003 \T@s|ddlZddlZddlZddlmZddlmZddlmZddl m Z ddl Tddl m Z ddlmZGd d d eZdS) N)Command)DEBUG) get_platform) write_file)*)get_python_version)logc+@seZdZdZdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddg)Zd4d9d=d2dUgZd4d9d=dXZdYdZZd[d\Zd]d^Z d_d`Z dadbZ dcddZ dedfZ dS) bdist_rpmzcreate an RPM distribution bdist-base=N/base directory for creating built distributions rpm-base=dbase directory for creating RPMs (defaults to "rpm" under --bdist-base; must be specified for RPM 2) dist-dir=dDdirectory to put final RPM files in (and .spec files if --spec-only)python=Mpath to Python interpreter to hard-code in the .spec file (default: "python") fix-pythonLhard-code the exact path to the current Python interpreter in the .spec file spec-onlyonly regenerate spec file source-onlyonly generate source RPM binary-onlyonly generate binary RPM use-bzip27use bzip2 instead of gzip to create source distributiondistribution-name=gname of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!)group=9package classification [default: "Development/Libraries"]release=RPM release numberserial=RPM serial numbervendor=aRPM "vendor" (eg. "Joe Blow ") [default: maintainer or author from setup script] packager=BRPM packager (eg. "Jane Doe ") [default: vendor] doc-files=6list of documentation files (space or comma-separated) changelog= RPM changelogicon=name of icon file provides=%capabilities provided by this package requires=%capabilities required by this package conflicts=-capabilities which conflict with this packagebuild-requires=+capabilities required to build this package obsoletes=*capabilities made obsolete by this package no-autoreq+do not automatically calculate dependencies keep-tempk"don't clean up RPM build directory no-keep-temp&clean up RPM build directory [default]use-rpm-opt-flags8compile with RPM_OPT_FLAGS when building from source RPMno-rpm-opt-flags&do not pass any RPM CFLAGS to compiler rpm3-mode"RPM 3 compatibility mode (default) rpm2-modeRPM 2 compatibility mode prep-script=3Specify a script for the PREP phase of RPM building build-script=4Specify a script for the BUILD phase of RPM building pre-install=:Specify a script for the pre-INSTALL phase of RPM buildinginstall-script=6Specify a script for the INSTALL phase of RPM building post-install=;Specify a script for the post-INSTALL phase of RPM buildingpre-uninstall=rnroREADME README.txtrk1rlrirprqrrrsrtrurvrwrxryrzr|r}r~rrr)rr)Z ensure_stringrZ get_contactZget_contact_emailZensure_string_list isinstancerolistrrexistsappend_format_changelogrpZensure_filename)rZreadmerrrrs>                         zbdist_rpm.finalize_package_datac Cstrsz-bdist_rpm._make_spec_file..zbrp-python-bytecompile \ z%brp-python-bytecompile %{__python} \ z2# Workaround for http://bugs.python.org/issue14443z%define __os_install_post z Name: %{name}zVersion: %{version}zRelease: %{release}z-Source0: %{name}-%{unmangled_version}.tar.bz2z,Source0: %{name}-%{unmangled_version}.tar.gzz License: zGroup: z>BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootzPrefix: %{_prefix}zBuildArch: noarchz BuildArch: %sVendorPackagerProvidesRequires Conflicts Obsoletesz%s: %s ZUNKNOWNzUrl: zDistribution: zBuildRequires: zIcon: z AutoReq: 0z %descriptionz%s %srz%s buildzenv CFLAGS="$RPM_OPT_FLAGS" z>%s install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILESr{rr&%setup -n %{name}-%{unmangled_version}ZbuildrsZinstallrtcleanrurm -rf $RPM_BUILD_ROOT verifyscriptrvprerwpostrxpreunrypostunrz%rz%files -f INSTALLED_FILESz%defattr(-,root,root)z%doc z %changelog)rrrrrr)r{rrr)rrur)rrvN)rrwN)rrxN)rryN)rrzN)'rrZ get_versionreplacerkZget_description subprocessZ getoutputr splitlinesrrrhZ get_licenserjrrgetattrlowerrrZget_urlrirrqrrrrZget_long_descriptionrcrargvropenreadrrorp)rZ spec_fileZ vendor_hookZproblemZfixedZ fixed_hookZfieldvalZdef_setup_callZ def_buildZ install_cmdZscript_optionsZrpm_optattrdefaultrrrrs                   zbdist_rpm._make_spec_filecCs|s|Sg}x`|jjdD]N}|j}|ddkrD|jd|gq|ddkr\|j|q|jd|qW|ds||d=|S)Nrrrrrz )rrrr)rrpZ new_changelogrrrrr3s   zbdist_rpm._format_changelog)r Nr )r Nr )rrr)rNr)rNr)rNr)rNr)rNr)rNr)rNr)rNr )r!Nr")r#Nr$)r%Nr&)r'Nr()r)Nr*)r+Nr,)r-Nr.)r/Nr0)r1Nr2)r3Nr4)r5Nr6)r7Nr8)r9Nr:)r;r<r=)r>Nr?)r@NrA)rBNrC)rDNrE)rFNrG)rHNrI)rJNrK)rLNrM)rNNrO)rPNrQ)rRNrS)rTNrU)rVNrW)rXNrY)rZNr[)r\r]r^)__name__ __module__ __qualname__Z descriptionZ user_optionsZboolean_optionsZ negative_optrrrrrrrrrrrr s--)r )rrrZdistutils.corerZdistutils.debugrZdistutils.utilrZdistutils.file_utilrZdistutils.errorsZdistutils.sysconfigrZ distutilsrr rrrrs      __pycache__/clean.cpython-36.pyc000064400000004161147221452520012472 0ustar003 \ @sDdZddlZddlmZddlmZddlmZGdddeZdS)zBdistutils.command.clean Implements the Distutils 'clean' command.N)Command) remove_tree)logc@s>eZdZdZddddddgZdgZddZddZddZdS)cleanz-clean up temporary files from 'build' command build-base=b2base build directory (default: 'build.build-base') build-lib=Ns    __pycache__/bdist.cpython-36.pyc000064400000007263147221452520012523 0ustar003 \@sHdZddlZddlmZddlTddlmZddZGdd d eZdS) zidistutils.command.bdist Implements the Distutils 'bdist' command (create a built [binary] distribution).N)Command)*) get_platformcCsTddlm}g}x,tjD]"}|jd|dtj|dfqW||}|jddS)zFPrint list of available formats (arguments to "--format" option). r) FancyGetoptzformats=Nz'List of available distribution formats:)Zdistutils.fancy_getoptrbdistformat_commandsappendformat_commandZ print_help)rformatsformatZpretty_printerr /usr/lib64/python3.6/bdist.py show_formats s   rc @seZdZdZd6dddefd7d8d9d:d;gZdgZdd defgZdd?d@dAdBdCdDdEd/ Z d0d1Z d2d3Zd4d5Zd S)Frz$create a built (binary) distribution bdist-base=b4temporary directory for creating built distributionsz plat-name=pz;platform name to embed in generated filenames (default: %s)formats=N/formats for distribution (comma-separated list) dist-dir=d=directory to put final built distributions in [default: dist] skip-build2skip rebuilding everything (for testing/debugging)owner=u@Owner name used when creating a tar file [default: current user]group=gAGroup name used when creating a tar file [default: current group]z help-formatsz$lists available distribution formats bdist_rpmgztarzip)posixntrpmbztarxztarztartarwininstmsiRPM distribution bdist_dumbgzip'ed tar filebzip2'ed tar filexz'ed tar filecompressed tar filetar file bdist_wininstWindows executable installerZIP file bdist_msiMicrosoft Installer) r&r"r'r(r)r*r+r#r,cCs.d|_d|_d|_d|_d|_d|_d|_dS)Nr) bdist_base plat_namer dist_dir skip_buildgroupowner)selfr r rinitialize_optionsQszbdist.initialize_optionsc Cs|jdkr(|jrt|_n|jdj|_|jdkrT|jdj}tjj|d|j|_|j d|j dkry|j tj g|_ Wn"t k rtdtj YnX|jdkrd|_dS)NZbuildzbdist.r z;don't know how to create built distributions on platform %sZdist)r:r<rZget_finalized_commandr9 build_baseospathjoinZensure_string_listr default_formatnameKeyErrorZDistutilsPlatformErrorr;)r?rAr r rfinalize_optionsZs$       zbdist.finalize_optionsc Csg}xH|jD]>}y|j|j|dWq tk rHtd|Yq Xq Wxztt|jD]h}||}|j|}||jkr|j||_ |dkr|j |_ |j |_ |||ddkrd|_ |j |q^WdS)Nrzinvalid format '%s'r.r)r r r rGZDistutilsOptionErrorrangelenZreinitialize_commandno_format_optionr r>r=Z keep_tempZ run_command)r?Zcommandsr iZcmd_nameZsub_cmdr r rrunvs"    z bdist.run)rrr)rNr)rrr)rNr)rrr)rrr )r!)r!r-)r.r/)r.r0)r.r1)r.r2)r.r3)r4r5)r.r6)r7r8)__name__ __module__ __qualname__ descriptionrZ user_optionsZboolean_optionsrZ help_optionsrKrErr r@rHrMr r r rrsJ    r) __doc__rBZdistutils.corerZdistutils.errorsZdistutils.utilrrrr r r rs    __pycache__/check.cpython-36.opt-2.pyc000064400000011061147221452520013422 0ustar003 \x @sddlmZddlmZyTddlmZddlmZddlm Z ddlm Z ddl m Z Gdd d eZ d ZWnek rd ZYnXGd d d eZdS))Command)DistutilsSetupError)Reporter)Parser)frontend)nodes)StringIOc@seZdZd ddZddZdS) SilentReporterNrasciireplacec Cs"g|_tj||||||||dS)N)messagesr__init__)selfsource report_level halt_levelstreamdebugencoding error_handlerr//usr/lib64/python3.6/distutils/command/check.pyr szSilentReporter.__init__cOs6|jj||||ftj|f|||j|d|S)N)leveltype)r appendrsystem_messageZlevels)rrmessageZchildrenkwargsrrrrszSilentReporter.system_message)Nrr r )__name__ __module__ __qualname__r rrrrrr s r TFc@s\eZdZdZdddgZdddgZd d Zd dZddZddZ ddZ ddZ ddZ dS)checkz"perform some checks on the packagemetadatamVerify meta-datarestructuredtextrEChecks if long string meta-data syntax are reStructuredText-compliantstricts(Will exit with an error if a check failscCsd|_d|_d|_d|_dS)Nr)r%r"r( _warnings)rrrrinitialize_options1szcheck.initialize_optionscCsdS)Nr)rrrrfinalize_options8szcheck.finalize_optionscCs|jd7_tj||S)Nr+)r,rwarn)rmsgrrrr/;sz check.warncCsL|jr|j|jr0tr"|jn|jr0td|jrH|jdkrHtddS)NzThe docutils package is needed.rzPlease correct your package.)r"check_metadatar% HAS_DOCUTILScheck_restructuredtextr(rr,)rrrrrun@s z check.runcCs|jj}g}x*d D]"}t||o(t||s|j|qW|rP|jddj||jrh|js|jdn"|j r|j s|jdn |jddS)Nnameversionurlzmissing required meta-data: %sz, z)missing meta-data: if 'author' supplied, z#'author_email' must be supplied tooz-missing meta-data: if 'maintainer' supplied, z''maintainer_email' must be supplied tooz4missing meta-data: either (author and author_email) z%or (maintainer and maintainer_email) zmust be supplied)r5r6r7zLmissing meta-data: if 'author' supplied, 'author_email' must be supplied toozTmissing meta-data: if 'maintainer' supplied, 'maintainer_email' must be supplied toozYmissing meta-data: either (author and author_email) or (maintainer and maintainer_email) zimissing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied) distributionr"hasattrgetattrrr/joinZauthorZ author_emailZ maintainerZmaintainer_email)rr"Zmissingattrrrrr1Ps$ zcheck.check_metadatacCs\|jj}xL|j|D]>}|djd}|dkr:|d}nd|d|f}|j|qWdS)Nr+linez %s (line %s))r8Zget_long_description_check_rst_datagetr/)rdataZwarningr=rrrr3ns  zcheck.check_restructuredtextcCst}t}tjtfdj}d|_d|_d|_t||j |j |j |j |j |jd}tj|||d}|j|dy|j||Wn:tk r}z|jjd d|difWYdd}~XnX|jS) N)Z components)rrrr)rr+z!Could not finish the parsing: %s.r>r>)rrrZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesr rrZwarning_streamrZerror_encodingZerror_encoding_error_handlerrdocumentZ note_sourceparseAttributeErrorr r)rrA source_pathparserZsettingsZreporterrDerrrr?ys*  $zcheck._check_rst_dataN)r"r#r$)r%r&r')r(r)r*) rrr Z descriptionZ user_optionsZboolean_optionsr-r.r/r4r1r3r?rrrrr!$s  r!N)Zdistutils.corerZdistutils.errorsrZdocutils.utilsrZdocutils.parsers.rstrZdocutilsrriorr r2 Exceptionr!rrrrs        __pycache__/bdist_dumb.cpython-36.pyc000064400000007215147221452520013527 0ustar003 \1@shdZddlZddlmZddlmZddlmZmZddl Tddl m Z ddl m Z Gd d d eZdS) 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_treeensure_relative)*)get_python_version)logc @s^eZdZdZd%dddefd&d(d)d*d+d,d-g Zd ddgZdddZdd Zd!d"Z d#d$Z dS). bdist_dumbz"create a "dumb" built distribution bdist-dir=d1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s)format=f>archive format to create (tar, gztar, bztar, xztar, ztar, zip) keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archive dist-dir=-directory to put final built distributions in skip-buildN2skip rebuilding everything (for testing/debugging)relative7build the archive using relative paths (default: false)owner=u@Owner name used when creating a tar file [default: current user]group=gAGroup name used when creating a tar file [default: current group]Zgztarzip)posixntcCs:d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) bdist_dir plat_nameformat keep_tempdist_dir skip_buildrownergroup)selfr+"/usr/lib64/python3.6/bdist_dumb.pyinitialize_options2szbdist_dumb.initialize_optionscCsz|jdkr&|jdj}tjj|d|_|jdkrfy|jtj|_Wn"t k rdt dtjYnX|j dddd dS) NZbdistZdumbz@don't know how to create dumb built distributions on platform %sr&r#r')r&r&)r#r#)r'r') r"Zget_finalized_command bdist_baseospathjoinr$default_formatnameKeyErrorDistutilsPlatformErrorZset_undefined_options)r*r.r+r+r,finalize_options=s   zbdist_dumb.finalize_optionscCs(|js|jd|jddd}|j|_|j|_d|_tjd|j|jdd|jj |j f}t j j |j|}|js~|j}nJ|jjr|j|jkrtdt|jt|jfnt j j |jt|j}|j||j||j|jd }|jjrt}nd }|jjjd ||f|js$t|j|jd dS) NZbuildinstall)Zreinit_subcommandsrzinstalling to %sz%s.%szScan't make a dumb built distribution where base and platbase are different (%s, %s))Zroot_dirr(r)anyr )dry_run) r'Z run_commandZreinitialize_commandr"rootZwarn_dirrinfoZ distributionZ get_fullnamer#r/r0r1r&rZhas_ext_modulesZ install_baseZinstall_platbaser5reprrZ make_archiver$r(r)rZ dist_filesappendr%rr:)r*r7Zarchive_basenameZpseudoinstall_rootZ archive_rootfilenameZ pyversionr+r+r,runOs>          zbdist_dumb.run)r r r )rrrPkeep the pseudo-installation tree around after creating the distribution archive)rrrA)rr r)rNr)rNr)rrr)rrr) __name__ __module__ __qualname__ descriptionrZ user_optionsZboolean_optionsr2r-r6r@r+r+r+r,r s6  r )__doc__r/Zdistutils.corerZdistutils.utilrZdistutils.dir_utilrrZdistutils.errorsZdistutils.sysconfigrZ distutilsrr r+r+r+r,s    __pycache__/install_data.cpython-36.opt-2.pyc000064400000004203147221452520015004 0ustar003 \ @s8ddlZddlmZddlmZmZGdddeZdS)N)Command) change_root convert_pathc@sHeZdZdZdddgZdgZd d Zd dZddZddZ ddZ dS) install_datazinstall data files install-dir=dIbase directory for installing data files (default: installation base dir)root=Ns __pycache__/install_headers.cpython-36.pyc000064400000003252147221452520014551 0ustar003 \@s$dZddlmZGdddeZdS)zdistutils.command.install_headers Implements the Distutils 'install_headers' command, to install C/C++ header files to the Python include directory.)Commandc@sFeZdZdZddgZdgZdd Zd d Zd d ZddZ ddZ dS)install_headerszinstall C/C++ header files install-dir=d$directory to install header files toforcef-force installation (overwrite existing files)cCsd|_d|_g|_dS)Nr) install_dirroutfiles)selfr '/usr/lib64/python3.6/install_headers.pyinitialize_optionssz"install_headers.initialize_optionscCs|jddddS)NZinstallrr r)rr )rr)Zset_undefined_options)r r r rfinalize_optionssz install_headers.finalize_optionscCsL|jj}|sdS|j|jx*|D]"}|j||j\}}|jj|q"WdS)N) distributionheadersZmkpathr Z copy_filer append)r rheaderout_r r rrun!s  zinstall_headers.runcCs |jjp gS)N)rr)r r r r get_inputs+szinstall_headers.get_inputscCs|jS)N)r )r r r r get_outputs.szinstall_headers.get_outputsN)rrr)rrr ) __name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsrrrrrr r r rr s rN)__doc__Zdistutils.corerrr r r rs __pycache__/install_headers.cpython-36.opt-2.pyc000064400000003026147221452520015510 0ustar003 \@s ddlmZGdddeZdS))Commandc@sFeZdZdZddgZdgZdd Zd d Zd d ZddZ ddZ dS)install_headerszinstall C/C++ header files install-dir=d$directory to install header files toforcef-force installation (overwrite existing files)cCsd|_d|_g|_dS)Nr) install_dirroutfiles)selfr 9/usr/lib64/python3.6/distutils/command/install_headers.pyinitialize_optionssz"install_headers.initialize_optionscCs|jddddS)NZinstallrr r)rr )rr)Zset_undefined_options)r r r rfinalize_optionssz install_headers.finalize_optionscCsL|jj}|sdS|j|jx*|D]"}|j||j\}}|jj|q"WdS)N) distributionheadersZmkpathr Z copy_filer append)r rheaderout_r r rrun!s  zinstall_headers.runcCs |jjp gS)N)rr)r r r r get_inputs+szinstall_headers.get_inputscCs|jS)N)r )r r r r get_outputs.szinstall_headers.get_outputsN)rrr)rrr ) __name__ __module__ __qualname__Z descriptionZ user_optionsZboolean_optionsrrrrrr r r rr s rN)Zdistutils.corerrr r r rs __pycache__/install_egg_info.cpython-36.opt-2.pyc000064400000004402147221452520015651 0ustar003 \+ @s`ddlmZddlmZmZddlZddlZddlZGdddeZddZ dd Z d d Z dS) )Command)logdir_utilNc@s6eZdZdZdgZddZddZd d Zd d Zd S)install_egg_infoz8Install package's PKG-INFO metadata as an .egg-info file install-dir=ddirectory to install tocCs d|_dS)N) install_dir)selfr :/usr/lib64/python3.6/distutils/command/install_egg_info.pyinitialize_optionssz#install_egg_info.initialize_optionscCsb|jdddtt|jjtt|jjftjdd}t j j |j ||_ |j g|_dS)NZ install_libr z%s-%s-py%d.%d.egg-info)r r )Zset_undefined_options to_filename safe_name distributionZget_name safe_versionZ get_versionsys version_infoospathjoinr targetoutputs)r basenamer r r finalize_optionss z!install_egg_info.finalize_optionsc Cs|j}tjj|r2tjj| r2tj||jdnNtjj|rX|j tj |jfd|n(tjj|j s|j tj |j fd|j t jd||jst|ddd}|jjj|WdQRXdS)N)dry_runz Removing z Creating z Writing %swzUTF-8)encoding)rrrisdirislinkrZ remove_treerexistsZexecuteunlinkr makedirsrinfoopenrZmetadataZwrite_pkg_file)r rfr r r run s   zinstall_egg_info.runcCs|jS)N)r)r r r r get_outputs.szinstall_egg_info.get_outputsN)rrr) __name__ __module__ __qualname__Z descriptionZ user_optionsr rr'r(r r r r r s  rcCstjdd|S)Nz[^A-Za-z0-9.]+-)resub)namer r r r6srcCs|jdd}tjdd|S)N .z[^A-Za-z0-9.]+r,)replacer-r.)versionr r r r>s rcCs |jddS)Nr,_)r2)r/r r r rHsr) Z distutils.cmdrZ distutilsrrrrr-rrrrr r r r s + __pycache__/bdist_msi.cpython-36.pyc000064400000046445147221452520013400 0ustar003 \@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZddlZdd lmZmZmZdd lmZmZmZmZGd d d eZGdddeZdS)z# Implements the bdist_msi command. N)Command) remove_tree)get_python_version) StrictVersion)DistutilsOptionError) get_platform)log)schemasequencetext) DirectoryFeatureDialogadd_datac@sFeZdZdZddZddZddd Zdd d ZdddZddZ dS)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.cOs>tj|f||jd}d|d}|jdd||jddS)zbDialog(database, name, x, y, w, h, attributes, title, first, default, cancel, bitmap=true)$iHZ BottomLinerN)r__init__hlinew)selfargskwZrulerZbmwidthr!/usr/lib64/python3.6/bdist_msi.pyrs  zPyDialog.__init__c Cs|jddddddd|dS) z,Set the title text of the dialog at the top.Title i@<iz{\VerdanaBold10}%sN)r )rtitlerrrr #szPyDialog.titleBackc Cs,|r d}nd}|j|d|jddd|||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 associatedr"8) pushbuttonr)rr nextnameactiveflagsrrrback*sz PyDialog.backCancelc Cs,|r d}nd}|j|d|jddd|||S)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"i0r%r&r')r(r)rr r)r*r+r,rrrcancel5szPyDialog.cancelNextc Cs,|r d}nd}|j|d|jddd|||S)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(r)rr r)r*r+r,rrrr)@sz PyDialog.nextc Cs,|j|t|j|d|jdddd||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 associatedr%r&r'r#)r(intrr)rr*r r)ZxposrrrxbuttonKszPyDialog.xbuttonN)r!r")r.r")r0r") __name__ __module__ __qualname____doc__rr r-r/r)r4rrrrrs  rc@seZdZdZdCdddefdEdGdHdIdJdKdLdMg ZddddgZddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1gZd2Zd3d4Z d5d6Z d7d8Z d9d:Z d;d<Z d=d>Zd?d@ZdAdBZdS)N bdist_msiz7create a Microsoft Installer (.msi) binary distribution bdist-dir=N1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s) keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archivetarget-version=z!require a specific python versionz on the target systemno-target-compilec/do not compile .py to .pyc on the target systemno-target-optimizeo;do not compile .py to .pyo (optimized) on the target system dist-dir=d-directory to put final built distributions in skip-build2skip rebuilding everything (for testing/debugging)install-script=Ubasename of installation script to be run after installation or before deinstallationpre-install-script={Fully qualified filename of a script to be run before any files are installed. This script need not be in the distributionz2.0z2.1z2.2z2.3z2.4z2.5z2.6z2.7z2.8z2.9z3.0z3.1z3.2z3.3z3.4z3.5z3.6z3.7z3.8z3.9XcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ dS)Nr) bdist_dir plat_name keep_tempZno_target_compileZno_target_optimizetarget_versiondist_dir skip_buildinstall_scriptpre_install_scriptversions)rrrrinitialize_options}szbdist_msi.initialize_optionscCs|jdd |jdkr2|jdj}tjj|d|_t}|j rP|j j rP||_|jr|jg|_ |j r|j j r|j|krt d|fn t|j|_ |jdd d |jrt d|jrx2|j jD]}|jtjj|krPqWt d|jd|_dS) NZbdistrUZmsizMtarget version can only be %s, or the '--skip-build' option must be specifiedrTrQz5the pre-install-script feature is not yet implementedz(install_script '%s' not found in scripts)rUrU)rTrT)rQrQ)Zset_undefined_optionsrPget_finalized_command bdist_baseospathjoinrrS distributionhas_ext_modulesrXrUrlist all_versionsrWrVscriptsbasenameinstall_script_key)rr[Z short_versionZscriptrrrfinalize_optionss:        zbdist_msi.finalize_optionscCs|js|jd|jddd}|j|_|j|_d|_|jd}d|_d|_|jj r|j }|s~|jslt ddt j dd }d |j|f}|jd}tjj|jd ||_tjd |j|jt jjdtjj|jd |jt jd=|j|j|jj}|j|}tjj|}tjj|r0tj ||jj!}|j"} | sJ|j#} | sTd} |j$} dt%| j&} |jj}|j rd|j |f} nd|} t'j(|t)| t'j*| | |_+t'j,|j+t-d| fg} |j.p|j/}|r| j0d|f|j1r| j0d|j1f| rt2|j+d| |j3|j4|j5|j6|j+j7t8|jdrld|j pXd|f}|jj9j0||j:st;|j|j| jd?d9d@d;dAd=dB| j d2d6d2dC} | j dDdEt|dF||||||d2d2d2 } | jdG| jd4d2dd5| jd6d7dd5| jd8d9d:d;dz [TARGETDIR]z [SourceDir])Zorderingz [TARGETDIR%s]z FEATURE_SELECTED AND &Python%s=3ZSpawnWaitDialogrjZFeaturesZ SelectionTreerZFEATUREZPathEditz[FEATURE_SELECTED]1z!FEATURE_SELECTED AND &Python%s<>3ZOtherz$Provide an alternate Python locationZEnableZShowZDisableZHiderrZ DiskCostDlgZOKz&{\DlgFontBold8}Disk Space RequirementszFThe disk space required for the installation of the selected features.5aThe 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).Z VolumeListZVolumeCostListdiz{120}{70}{70}{70}{70}g?Z AdminInstallzGSelect whether to install [ProductName] for all users of this computer.zInstall for all usersZJUSTMEzInstall just for mez [ALLUSERS]zWhichUsers="ALL"z({\DlgFontBold8}[Progress1] [ProductName]#AzYPlease wait while the Installer [Progress2] [ProductName]. This may take several minutes.Z StatusLabelzStatus:Z ProgressBariz Progress doneZ SetProgressZProgressz)Welcome to the [ProductName] Setup WizardZBodyText?z:Select whether you want to repair or remove [ProductName].ZRepairRadioGrouplrz&Repair [ProductName]ZRemoverzRe&move [ProductName]z [REINSTALL]zMaintenanceForm_Action="Repair"z [Progress1]Z Repairingz [Progress2]ZrepairsZ Reinstallz[REMOVE]zMaintenanceForm_Action="Remove" ZRemoving Zremoves z MaintenanceForm_Action<>"Change")rr)rr)rr)rr)rr)rr)rrrNr)rrrNr")rrrNr")rrrrr)rrr)rrr)rrr)rrr)rNr)rrr rrrr r-r/r)ZeventZcontrolrr(mappingr_ryrXrZ conditionr4Z radiogroupadd)rrxyrrr ZmodalZmodelessZtrack_disk_spaceZfatalrAZ user_exitZ exit_dialogZinuseerrorr/ZcostingZprepZseldlgorderrrZinstall_other_condZdont_install_other_condZcostZ whichusersgZprogressZmaintrrrrs                                                                zbdist_msi.add_uicCs<|jrd||j|jf}nd||jf}tjj|j|}|S)Nz%s.%s-py%s.msiz %s.%s.msi)rSrQr\r]r^rT)rrZ base_namerrrrrzs  z bdist_msi.get_installer_filename)r:Nr;Pkeep the pseudo-installation tree around after creating the distribution archive)r=r>r6require a specific python version on the target system)r?Nr)r@rArB)rCrDrE)rFrGrH)rINrJ)rKNrL)rMNrN)r5r6r7 descriptionrZ user_optionsZboolean_optionsrbrrYrfrxrrrrrzrrrrr9SsR    ([66&@r9)r8rtr\Zdistutils.corerZdistutils.dir_utilrZdistutils.sysconfigrZdistutils.versionrZdistutils.errorsrZdistutils.utilrZ distutilsrrr r r r r rrrr9rrrrs       >__pycache__/bdist_dumb.cpython-36.opt-2.pyc000064400000006727147221452520014476 0ustar003 \1@sdddlZddlmZddlmZddlmZmZddlTddl m Z ddl m Z Gdd d eZ dS) N)Command) get_platform) remove_treeensure_relative)*)get_python_version)logc @s^eZdZdZd%dddefd&d(d)d*d+d,d-g Zd ddgZdddZdd Zd!d"Z d#d$Z dS). bdist_dumbz"create a "dumb" built distribution bdist-dir=d1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s)format=f>archive format to create (tar, gztar, bztar, xztar, ztar, zip) keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archive dist-dir=-directory to put final built distributions in skip-buildN2skip rebuilding everything (for testing/debugging)relative7build the archive using relative paths (default: false)owner=u@Owner name used when creating a tar file [default: current user]group=gAGroup name used when creating a tar file [default: current group]Zgztarzip)posixntcCs:d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) bdist_dir plat_nameformat keep_tempdist_dir skip_buildrownergroup)selfr+4/usr/lib64/python3.6/distutils/command/bdist_dumb.pyinitialize_options2szbdist_dumb.initialize_optionscCsz|jdkr&|jdj}tjj|d|_|jdkrfy|jtj|_Wn"t k rdt dtjYnX|j dddd dS) NZbdistZdumbz@don't know how to create dumb built distributions on platform %sr&r#r')r&r&)r#r#)r'r') r"Zget_finalized_command bdist_baseospathjoinr$default_formatnameKeyErrorDistutilsPlatformErrorZset_undefined_options)r*r.r+r+r,finalize_options=s   zbdist_dumb.finalize_optionscCs(|js|jd|jddd}|j|_|j|_d|_tjd|j|jdd|jj |j f}t j j |j|}|js~|j}nJ|jjr|j|jkrtdt|jt|jfnt j j |jt|j}|j||j||j|jd }|jjrt}nd }|jjjd ||f|js$t|j|jd dS) NZbuildinstall)Zreinit_subcommandsrzinstalling to %sz%s.%szScan't make a dumb built distribution where base and platbase are different (%s, %s))Zroot_dirr(r)anyr )dry_run) r'Z run_commandZreinitialize_commandr"rootZwarn_dirrinfoZ distributionZ get_fullnamer#r/r0r1r&rZhas_ext_modulesZ install_baseZinstall_platbaser5reprrZ make_archiver$r(r)rZ dist_filesappendr%rr:)r*r7Zarchive_basenameZpseudoinstall_rootZ archive_rootfilenameZ pyversionr+r+r,runOs>          zbdist_dumb.run)r r r )rrrPkeep the pseudo-installation tree around after creating the distribution archive)rrrA)rr r)rNr)rNr)rrr)rrr) __name__ __module__ __qualname__Z descriptionrZ user_optionsZboolean_optionsr2r-r6r@r+r+r+r,r s6  r )r/Zdistutils.corerZdistutils.utilrZdistutils.dir_utilrrZdistutils.errorsZdistutils.sysconfigrZ distutilsrr r+r+r+r,s    __pycache__/bdist.cpython-36.opt-1.pyc000064400000007263147221452520013462 0ustar003 \@sHdZddlZddlmZddlTddlmZddZGdd d eZdS) zidistutils.command.bdist Implements the Distutils 'bdist' command (create a built [binary] distribution).N)Command)*) get_platformcCsTddlm}g}x,tjD]"}|jd|dtj|dfqW||}|jddS)zFPrint list of available formats (arguments to "--format" option). r) FancyGetoptzformats=Nz'List of available distribution formats:)Zdistutils.fancy_getoptrbdistformat_commandsappendformat_commandZ print_help)rformatsformatZpretty_printerr /usr/lib64/python3.6/bdist.py show_formats s   rc @seZdZdZd6dddefd7d8d9d:d;gZdgZdd defgZdd?d@dAdBdCdDdEd/ Z d0d1Z d2d3Zd4d5Zd S)Frz$create a built (binary) distribution bdist-base=b4temporary directory for creating built distributionsz plat-name=pz;platform name to embed in generated filenames (default: %s)formats=N/formats for distribution (comma-separated list) dist-dir=d=directory to put final built distributions in [default: dist] skip-build2skip rebuilding everything (for testing/debugging)owner=u@Owner name used when creating a tar file [default: current user]group=gAGroup name used when creating a tar file [default: current group]z help-formatsz$lists available distribution formats bdist_rpmgztarzip)posixntrpmbztarxztarztartarwininstmsiRPM distribution bdist_dumbgzip'ed tar filebzip2'ed tar filexz'ed tar filecompressed tar filetar file bdist_wininstWindows executable installerZIP file bdist_msiMicrosoft Installer) r&r"r'r(r)r*r+r#r,cCs.d|_d|_d|_d|_d|_d|_d|_dS)Nr) bdist_base plat_namer dist_dir skip_buildgroupowner)selfr r rinitialize_optionsQszbdist.initialize_optionsc Cs|jdkr(|jrt|_n|jdj|_|jdkrT|jdj}tjj|d|j|_|j d|j dkry|j tj g|_ Wn"t k rtdtj YnX|jdkrd|_dS)NZbuildzbdist.r z;don't know how to create built distributions on platform %sZdist)r:r<rZget_finalized_commandr9 build_baseospathjoinZensure_string_listr default_formatnameKeyErrorZDistutilsPlatformErrorr;)r?rAr r rfinalize_optionsZs$       zbdist.finalize_optionsc Csg}xH|jD]>}y|j|j|dWq tk rHtd|Yq Xq Wxztt|jD]h}||}|j|}||jkr|j||_ |dkr|j |_ |j |_ |||ddkrd|_ |j |q^WdS)Nrzinvalid format '%s'r.r)r r r rGZDistutilsOptionErrorrangelenZreinitialize_commandno_format_optionr r>r=Z keep_tempZ run_command)r?Zcommandsr iZcmd_nameZsub_cmdr r rrunvs"    z bdist.run)rrr)rNr)rrr)rNr)rrr)rrr )r!)r!r-)r.r/)r.r0)r.r1)r.r2)r.r3)r4r5)r.r6)r7r8)__name__ __module__ __qualname__ descriptionrZ user_optionsZboolean_optionsrZ help_optionsrKrErr r@rHrMr r r rrsJ    r) __doc__rBZdistutils.corerZdistutils.errorsZdistutils.utilrrrr r r rs    __pycache__/build_ext.cpython-36.opt-2.pyc000064400000034410147221452520014327 0ustar003 \z@sddlZddlZddlZddlZddlmZddlTddlmZm Z ddlm Z ddl m Z ddl mZddlmZdd lmZdd lmZejd Zd d ZGdddeZdS)N)Command)*)customize_compilerget_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]*)*$cCsddlm}|dS)Nr)show_compilers)distutils.ccompilerr )r r3/usr/lib64/python3.6/distutils/command/build_ext.pyr s r c@seZdZdZdejZd`dad d d efdcdddefdddedfdddefdgdhdidjdkdldmdndodpgZd d%d(d1d8gZ d:d2d;e fgZ dd?Z d@dAZdBdCZdDdEZdFdGZdHdIZdJdKZdLdMZejdNdOZdPdQZdRdSZdTdUZdVdWZdXdYZdZd[Zd\d]Zd^d_Zd2S)q build_extz8build C/C++ extensions (compile/link to build directory)z (separated by '%s') build-lib=b(directory for compiled extension modules build-temp=t1directory for temporary files (build by-products)z plat-name=pz>platform name to cross-compile for, if supported (default: %s)inplaceiz=ignore build-lib and put compiled extensions into the source z,directory alongside your pure Python modulesz include-dirs=Iz.list of directories to search for header filesdefine=DC preprocessor macros to defineundef=U!C preprocessor macros to undefine libraries=l!external C libraries to link withz library-dirs=Lz.directories to search for external C librariesrpath=R7directories to search for shared C libraries at runtime link-objects=O2extra explicit link objects to include in the linkdebugg'compile/link with debugging informationforcef2forcibly build everything (ignore file timestamps) compiler=cspecify the compiler type parallel=jnumber of parallel build jobsswig-cppN)make SWIG create C++ files (default is C) swig-opts=!list of SWIG command line optionsswig=path to the SWIG executableuser#add user include, library and rpathz help-compilerzlist available compilerscCsd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_d|_dS)Nr) extensions build_lib plat_name build_temprpackage include_dirsdefineundef libraries library_dirsrpath link_objectsr+r.compilerswigswig_cpp swig_optsr=parallel)selfrrrinitialize_optionsjs*zbuild_ext.initialize_optionsc Csddlm}|jdd'd(d)d*d+d,d-|jdkr8|jj|_|jj|_|j}|jd d }|j dkrn|jj pjg|_ t |j t r|j j t j|_ tjtjkr|j jt jjtjd |j j|||kr|j j||jd|jd|jdkrg|_|jdkrg|_nt |jt r&|jj t j|_|jdkr:g|_nt |jt rX|jj t j|_t jdkrT|jjt jjtjdtjtjkr|jjt jjtjd|jrt jj|jd|_nt jj|jd|_|j jt jjtttdd}|r|jj||j dkrd}n|j dd}t jjtjd}|rHt jj||}|jj|tj!dddks|tj!dddkrtj"j#t jjtjdr|jjt jjtjddt$dn |jjd|j%d r|j&s|jj|j%d!n |jjd|j'r|j'j d"}d#d$|D|_'|j(r4|j(j d"|_(|j)dkrHg|_)n|j)j d%|_)|j*rt jjt+d }t jjt+d} t jj,|r|j j|t jj,| r|jj| |jj| t |j-t ryt.|j-|_-Wnt/k rt0d&YnXdS).Nr) sysconfigZbuildr@rBrKr+r.rOrA)Z plat_specificincluderGrJntZlibsZDebugZRelease_homewin32ZPCbuildcygwinatheosbinlibpythonconfig.Py_ENABLE_SHAREDLIBDIR,cSsg|] }|dfqS)1r).0Zsymbolrrr sz.build_ext.finalize_options.. zparallel should be an integer)r@r@)rBrB)rKrK)r+r+)r.r.)rOrO)rArA)1 distutilsrRZset_undefined_optionsrC distributionZ ext_packageZ ext_modulesr?Zget_python_incrD isinstancestrsplitospathsepsys exec_prefixbase_exec_prefixappendpathjoinZensure_string_listrGrHrInameprefixr+rBdirnamergetattrrAplatform executable startswithrget_config_varZ python_buildrErFrNr=r isdirrOint ValueErrorZDistutilsOptionError) rPrRZ py_includeZplat_py_include _sys_homesuffixZnew_libZdefinesZ user_includeZuser_librrrfinalize_optionss                    (         zbuild_ext.finalize_optionscCstddlm}|jsdS|jjrL|jd}|jj|jp:g|j j |j ||j |j |j|jd|_ t|j tjdkr|jtkr|j j|j|jdk r|j j|j|jdk rx |jD]\}}|j j||qW|jdk rx|jD]}|j j|qW|jdk r|j j|j|j dk r4|j j|j |jdk rN|j j|j|j dk rh|j j!|j |j"dS)Nr) new_compiler build_clib)rKverbosedry_runr.rU)#r rr?riZhas_c_librariesget_finalized_commandrGextendZget_library_namesrHrrrrKrrr.rrmrurAr Z initializerDZset_include_dirsrEZ define_macrorFZundefine_macroZ set_librariesZset_library_dirsrIZset_runtime_library_dirsrJZset_link_objectsbuild_extensions)rPrrruvaluemacrorrrruns>             z build_ext.runc Cst|tstdxnt|D]`\}}t|tr4qt|t sLt|dkrTtd|\}}tjd|t|t ozt j |stdt|t stdt||d}x*dD]"}|j |}|dk rt|||qW|j d|_d|krtjd|j d}|rxg|_g|_xj|D]b} t| to,t| dks8tdt| dkrX|jj| dnt| dkr|jj| qW|||<qWdS)Nz:'ext_modules' option must be a list of Extension instanceszMeach 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)sourcesrDrHrG extra_objectsextra_compile_argsextra_link_argsrIZdef_filez9'def_file' element of build info dict no longer supportedmacrosrSz9'macros' element of build info dict must be 1- or 2-tupler)rDrHrGrrr)rSr)rjlistDistutilsSetupError enumeratertuplelenr warnrkextension_name_rematchdictgetsetattrruntime_library_dirs define_macros undef_macrosrr) rPr?rextext_nameZ build_infokeyvalrrrrrcheck_extensions_listUsT           zbuild_ext.check_extensions_listcCs0|j|jg}x|jD]}|j|jqW|S)N)rr?rr)rP filenamesrrrrget_source_filess   zbuild_ext.get_source_filescCs6|j|jg}x |jD]}|j|j|jqW|S)N)rr?rrget_ext_fullpathru)rPZoutputsrrrr get_outputss   zbuild_ext.get_outputscCs(|j|j|jr|jn|jdS)N)rr?rO_build_extensions_parallel_build_extensions_serial)rPrrrrs  zbuild_ext.build_extensionscsj}jdkrtj}yddlm}Wntk r@d}YnX|dkrVjdS||dTfddjD}x6tj|D]&\}}j ||j WdQRXqWWdQRXdS)NTr)ThreadPoolExecutor)Z max_workerscsg|]}jj|qSr)Zsubmitbuild_extension)rer)executorrPrrrfsz8build_ext._build_extensions_parallel..) rOrm cpu_countZconcurrent.futuresr ImportErrorrr?zip_filter_build_errorsresult)rPZworkersrZfuturesrZfutr)rrPrrs       z$build_ext._build_extensions_parallelc Cs4x.|jD]$}|j||j|WdQRXqWdS)N)r?rr)rPrrrrrs  z"build_ext._build_extensions_serialccsTy dVWnDtttfk rN}z"|js*|jd|j|fWYdd}~XnXdS)Nz"building extension "%s" failed: %s)ZCCompilerErrorZDistutilsErrorZ CompileErrorZoptionalrru)rPrerrrrs zbuild_ext._filter_build_errorsc CsX|j}|dkst|ttf r,td|jt|}|j|j}||j}|jpZt ||dsnt j d|jdSt j d|j|j ||}|jpg}|jdd}x|jD]}|j|fqW|jj||j||j|j ||jd}|dd|_|jr|j|j|jp g}|jp|jj|} |jj|||j||j|j||j ||j |j| d dS)Nzjin 'ext_modules' option (extension '%s'), 'sources' must be present and must be a list of source filenamesZnewerz$skipping '%s' extension (up-to-date)zbuilding '%s' extension)Z output_dirrrDr+extra_postargsdepends)rGrHrrexport_symbolsr+rBZ target_lang)!rrjrrrrurrr.rr r+info swig_sourcesrrrrrrKcompilerBrDZ_built_objectsrrrlanguageZdetect_languageZlink_shared_object get_librariesrHrget_export_symbols) rPrrext_pathrZ extra_argsrrFZobjectsrrrrrsN         zbuild_ext.build_extensioncCs2g}g}i}|jrtjd|js6d|jks6d|jkr        zbuild_ext.swig_sourcescCs`tjdkrdStjdkrNxBd D]&}tjjd|d}tjj|r|SqWdSntd tjdS) NposixrLrU1.31.21.1z c:\swig%szswig.exez>I don't know how to find (much less run) SWIG on platform '%s')rrr)rmrursrtisfileZDistutilsPlatformError)rPZversfnrrrrfs    zbuild_ext.find_swigcCs|j|}|jd}|j|d}|jsRtjj|dd|g}tjj|j|Sdj|dd}|jd}tjj |j |}tjj||S)Nr`rSrbuild_pyrrr) get_ext_fullnamerlget_ext_filenamerrmrsrtr@rabspathZget_package_dir)rPrfullnameZmodpathfilenamerCrZ package_dirrrrr~s   zbuild_ext.get_ext_fullpathcCs |jdkr|S|jd|SdS)Nr`)rC)rPrrrrrs zbuild_ext.get_ext_fullnamecCs.ddlm}|jd}|d}tjj||S)Nr)r|r` EXT_SUFFIX)distutils.sysconfigr|rlrmrsrt)rPrr|rZ ext_suffixrrrrs  zbuild_ext.get_ext_filenamecCs0d|jjdd}||jkr*|jj||jS)NZPyInit_r`rSr)rurlrrr)rPrZ initfunc_namerrrrs  zbuild_ext.get_export_symbolscCstjdkrfddlm}t|j|s\d}|jr4|d}|tjd?tjd?d@f}|j|gS|jSnRtjdd d krd }|tjd?tjd?d@f}|j|gStjdd d kr>dd l m }d }|tjd?tjd?d@f}g}xB|j dj D]0}|j dr|j|ddn |j|qW|j|dg|StjdkrP|jStjdddkrj|jSdd l m }|j drdjtjd?tjd?d@|j d}|j|gS|jSdS)NrWr) MSVCCompilerz python%d%dZ_drYrZz python%d.%dr[)rRSHLIBSz-lrmdarwinaixraz python{}.{}{}ABIFLAGS)roryZdistutils._msvccompilerrrjrKr+ hexversionrGrhrRr|rlr{rrformat)rPrrtemplateZ pythonlibrRZextrar]rrrrsJ             zbuild_ext.get_libraries)rrr)rrriignore build-lib and put compiled extensions into the source directory alongside your pure Python modules)rrr)rrr)rrr )r!r"r#)r%r&r')r(r)r*)r+r,r-)r.r/r0)r1r2r3)r4r5r6)r7Nr8)r9Nr:)r;Nr<)r=Nr>) __name__ __module__ __qualname__Z descriptionrmrnZsep_byr Z user_optionsZboolean_optionsr Z help_optionsrQrrrrrrrr contextlibcontextmanagerrrrrrrrrrrrrrr!s  @N  K6   r)rrmreroZdistutils.corerZdistutils.errorsrrrrZdistutils.dep_utilrZdistutils.extensionrZdistutils.utilr rhr Zsiter rrr rrrrrs        __pycache__/bdist_msi.cpython-36.opt-1.pyc000064400000046315147221452520014333 0ustar003 \@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZddlZdd lmZmZmZdd lmZmZmZmZGd d d eZGdddeZdS)z# Implements the bdist_msi command. N)Command) remove_tree)get_python_version) StrictVersion)DistutilsOptionError) get_platform)log)schemasequencetext) DirectoryFeatureDialogadd_datac@sFeZdZdZddZddZddd Zdd d ZdddZddZ dS)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.cOs>tj|f||jd}d|d}|jdd||jddS)zbDialog(database, name, x, y, w, h, attributes, title, first, default, cancel, bitmap=true)$iHZ BottomLinerN)r__init__hlinew)selfargskwZrulerZbmwidthr!/usr/lib64/python3.6/bdist_msi.pyrs  zPyDialog.__init__c Cs|jddddddd|dS) z,Set the title text of the dialog at the top.Title i@<iz{\VerdanaBold10}%sN)r )rtitlerrrr #szPyDialog.titleBackc Cs,|r d}nd}|j|d|jddd|||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 associatedr"8) pushbuttonr)rr nextnameactiveflagsrrrback*sz PyDialog.backCancelc Cs,|r d}nd}|j|d|jddd|||S)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"i0r%r&r')r(r)rr r)r*r+r,rrrcancel5szPyDialog.cancelNextc Cs,|r d}nd}|j|d|jddd|||S)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(r)rr r)r*r+r,rrrr)@sz PyDialog.nextc Cs,|j|t|j|d|jdddd||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 associatedr%r&r'r#)r(intrr)rr*r r)ZxposrrrxbuttonKszPyDialog.xbuttonN)r!r")r.r")r0r") __name__ __module__ __qualname____doc__rr r-r/r)r4rrrrrs  rc@seZdZdZdCdddefdEdGdHdIdJdKdLdMg ZddddgZddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1gZd2Zd3d4Z d5d6Z d7d8Z d9d:Z d;d<Z d=d>Zd?d@ZdAdBZdS)N bdist_msiz7create a Microsoft Installer (.msi) binary distribution bdist-dir=N1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s) keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archivetarget-version=z!require a specific python versionz on the target systemno-target-compilec/do not compile .py to .pyc on the target systemno-target-optimizeo;do not compile .py to .pyo (optimized) on the target system dist-dir=d-directory to put final built distributions in skip-build2skip rebuilding everything (for testing/debugging)install-script=Ubasename of installation script to be run after installation or before deinstallationpre-install-script={Fully qualified filename of a script to be run before any files are installed. This script need not be in the distributionz2.0z2.1z2.2z2.3z2.4z2.5z2.6z2.7z2.8z2.9z3.0z3.1z3.2z3.3z3.4z3.5z3.6z3.7z3.8z3.9XcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ dS)Nr) bdist_dir plat_name keep_tempZno_target_compileZno_target_optimizetarget_versiondist_dir skip_buildinstall_scriptpre_install_scriptversions)rrrrinitialize_options}szbdist_msi.initialize_optionscCs|jdd |jdkr2|jdj}tjj|d|_t}|j rP|j j rP||_|jr|jg|_ |j r|j j r|j|krt d|fn t|j|_ |jdd d |jrt d|jrx2|j jD]}|jtjj|krPqWt d|jd|_dS) NZbdistrUZmsizMtarget version can only be %s, or the '--skip-build' option must be specifiedrTrQz5the pre-install-script feature is not yet implementedz(install_script '%s' not found in scripts)rUrU)rTrT)rQrQ)Zset_undefined_optionsrPget_finalized_command bdist_baseospathjoinrrS distributionhas_ext_modulesrXrUrlist all_versionsrWrVscriptsbasenameinstall_script_key)rr[Z short_versionZscriptrrrfinalize_optionss:        zbdist_msi.finalize_optionscCsz|js|jd|jddd}|j|_|j|_d|_|jd}d|_d|_|jj r|j }|spdt j dd}d |j |f}|jd}tjj|jd ||_tjd |j|jt jjdtjj|jd |jt jd=|j|j|jj}|j|}tjj|}tjj|r"tj||jj }|j!} | s<|j"} | sFd } |j#} dt$| j%} |jj}|j r~d|j |f} nd|} t&j'|t(| t&j)| | |_*t&j+|j*t,d| fg} |j-p|j.}|r| j/d|f|j0r| j/d|j0f| rt1|j*d| |j2|j3|j4|j5|j*j6t7|jdr^d|j pJd|f}|jj8j/||j9svt:|j|j;ddS)Nbuildinstallr")Zreinit_subcommandsr install_libz%d.%dz.%s-%slibzinstalling to %sZPURELIBZUNKNOWNz%d.%d.%dz Python %s %sz Python %sZ DistVersionZ ARPCONTACTZARPURLINFOABOUTProperty dist_filesr9any)dry_run)| jd?d9d@d;dAd=dB| j d2d6d2dC} | j dDdEt|dF||||||d2d2d2 } | jdG| jd4d2dd5| jd6d7dd5| jd8d9d:d;dz [TARGETDIR]z [SourceDir])Zorderingz [TARGETDIR%s]z FEATURE_SELECTED AND &Python%s=3ZSpawnWaitDialogrjZFeaturesZ SelectionTreerZFEATUREZPathEditz[FEATURE_SELECTED]1z!FEATURE_SELECTED AND &Python%s<>3ZOtherz$Provide an alternate Python locationZEnableZShowZDisableZHiderrZ DiskCostDlgZOKz&{\DlgFontBold8}Disk Space RequirementszFThe disk space required for the installation of the selected features.5aThe 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).Z VolumeListZVolumeCostListdiz{120}{70}{70}{70}{70}g?Z AdminInstallzGSelect whether to install [ProductName] for all users of this computer.zInstall for all usersZJUSTMEzInstall just for mez [ALLUSERS]zWhichUsers="ALL"z({\DlgFontBold8}[Progress1] [ProductName]#AzYPlease wait while the Installer [Progress2] [ProductName]. This may take several minutes.Z StatusLabelzStatus:Z ProgressBariz Progress doneZ SetProgressZProgressz)Welcome to the [ProductName] Setup WizardZBodyText?z:Select whether you want to repair or remove [ProductName].ZRepairRadioGrouplrz&Repair [ProductName]ZRemoverzRe&move [ProductName]z [REINSTALL]zMaintenanceForm_Action="Repair"z [Progress1]Z Repairingz [Progress2]ZrepairsZ Reinstallz[REMOVE]zMaintenanceForm_Action="Remove" ZRemoving Zremoves z MaintenanceForm_Action<>"Change")rr)rr)rr)rr)rr)rr)rrrNr)rrrNr")rrrNr")rrrrr)rrr)rrr)rrr)rrr)rNr)rrr rrrr r-r/r)ZeventZcontrolrr(mappingr_rxrXrZ conditionr4Z radiogroupadd)rrxyrrr ZmodalZmodelessZtrack_disk_spaceZfatalrAZ user_exitZ exit_dialogZinuseerrorr/ZcostingZprepZseldlgorderrrZinstall_other_condZdont_install_other_condZcostZ whichusersgZprogressZmaintrrrrs                                                                zbdist_msi.add_uicCs<|jrd||j|jf}nd||jf}tjj|j|}|S)Nz%s.%s-py%s.msiz %s.%s.msi)rSrQr\r]r^rT)rrZ base_namerrrrrys  z bdist_msi.get_installer_filename)r:Nr;Pkeep the pseudo-installation tree around after creating the distribution archive)r=r>r6require a specific python version on the target system)r?Nr)r@rArB)rCrDrE)rFrGrH)rINrJ)rKNrL)rMNrN)r5r6r7 descriptionrZ user_optionsZboolean_optionsrbrrYrfrwrrrrryrrrrr9SsR    ([66&@r9)r8rsr\Zdistutils.corerZdistutils.dir_utilrZdistutils.sysconfigrZdistutils.versionrZdistutils.errorsrZdistutils.utilrZ distutilsrrr r r r r rrrr9rrrrs       >__pycache__/upload.cpython-36.opt-2.pyc000064400000012057147221452520013637 0ustar003 /f@sddlZddlZddlZddlZddlmZddlmZmZm Z ddl m Z ddl m Z mZddlmZddlmZddlmZGd d d eZdS) N)standard_b64encode)urlopenRequest HTTPError)urlparse)DistutilsErrorDistutilsOptionError) PyPIRCCommand)spawn)logc@sJeZdZdZejddgZejdgZdd Zd d Zd d Z ddZ dS)uploadzupload binary package to PyPIsignssign files to upload using gpg identity=iGPG identity used to sign filescCs,tj|d|_d|_d|_d|_d|_dS)NrF)r initialize_optionsusernamepassword show_responser identity)selfr0/usr/lib64/python3.6/distutils/command/upload.pyr s  zupload.initialize_optionscCsvtj||jr |j r td|j}|ikrX|d|_|d|_|d|_|d|_ |j rr|j jrr|j j|_dS)Nz.Must use --sign for --identity to have meaningrr repositoryrealm) r finalize_optionsrr rZ _read_pypircrrrr distribution)rconfigrrrr(s     zupload.finalize_optionscCs>|jjsd}t|x$|jjD]\}}}|j|||qWdS)NzHMust create and upload files in one command (e.g. setup.py sdist upload))rZ dist_filesr upload_file)rmsgcommand pyversionfilenamerrrrun:s z upload.runc&)Cs^t|j\}}}}}} |s"|s"| r0td|j|d2krDtd||jr|ddd|g} |jrnd|jg| d d <t| |jd t|d } z | j} Wd| j X|j j } d d | j | j tjj|| f||tj| jd| j| j| j| j| j| j| j| j| j| j| j| j| j d}ytj!| j}WnPt"k r}z2d|}|j#|t$j%ddl&m'}|s|WYdd}~Xn X||d<d}|dkrt(j)\}}}|rd||f}n|dkrdt(j(dd}||d<|jrtjj|dt|dd jf|d<|j*d|j+j,d}d t-|j.d}d!}d"|j,d}|d#}t/j0}x|j1D]\}}d$|}t2|t3s|g}xr|D]j}t4|t5kr|d%|d7}|d}nt6|j,d&}|j7||j7|j,d&|j7d'|j7|qWqjW|j7||j8}d(||jf}|j#|t$j%d)|t6t9||d*} t:|j|| d+}!yt;|!}"|"j<}#|"j=}$Wnft>k r}z|j?}#|j=}$WYdd}~Xn8t@k r}z|j#t6|t$jAWYdd}~XnX|#d,kr8|j#d-|#|$ft$j%|jBrZ|jC|"}%d.jDd/d0|%d/d0f}|j#|t$j%n"d1|#|$f}|j#|t$jAtE|dS)3NzIncompatible url %shttphttpszunsupported schema Zgpgz --detach-signz-az --local-user)dry_runrbZ file_upload1z1.0)z:actionZprotocol_versionnameversioncontentZfiletyper$Z sha256_digestZmetadata_versionZsummaryZ home_pageZauthorZ author_emaillicense descriptionkeywordsplatformZ classifiersZ download_urlZprovidesZrequiresZ obsoletesz#calculating md5 checksum failed: %sr) get_fips_modeZ md5_digestrZ bdist_rpmzbuilt for %s %sZ bdist_dumbz built for %s)Ztersecommentz.ascZ gpg_signature:asciizBasic z3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s --s-- z+ Content-Disposition: form-data; name="%s"z; filename="%s"zutf-8s zSubmitting %s to %sz multipart/form-data; boundary=%s)z Content-typezContent-lengthZ Authorization)dataheaderszServer response (%s): %s -KzUpload failed (%s): %s)r'r()FrrAssertionErrorr rr r*openreadcloserZmetadataZget_nameZ get_versionospathbasenamehashlibZsha256Z hexdigestZget_descriptionZget_urlZ get_contactZget_contact_emailZ get_licenceZget_long_descriptionZ get_keywordsZ get_platformsZget_classifiersZget_download_urlZ get_providesZ get_requiresZ get_obsoletesZmd5 ValueErrorZannouncer INFOZ_hashlibr4r3distrrencoderdecodeioBytesIOitems isinstancelisttypetuplestrwritegetvaluelenrrZgetcoder"rcodeOSErrorZERRORrZ_read_pypi_responsejoinr)&rr#r$r%ZschemaZnetlocZurlZparamsZqueryZ fragmentsZgpg_argsfr/metar9Zdigester"r4r6rIr.idZ user_passZauthboundaryZ sep_boundaryZ end_boundaryZbodykeyvaluetitler:ZrequestresultZstatusreasontextrrrr!Bs                       zupload.upload_fileN)r rr)rrr) __name__ __module__ __qualname__r1r Z user_optionsZboolean_optionsrrr&r!rrrrr s r )rCrLr3rFbase64rZurllib.requestrrrZ urllib.parserZdistutils.errorsrrZdistutils.corer Zdistutils.spawnr Z distutilsr r rrrrs     __pycache__/install_data.cpython-36.opt-1.pyc000064400000004402147221452520015004 0ustar003 \ @s<dZddlZddlmZddlmZmZGdddeZdS)zdistutils.command.install_data Implements the Distutils 'install_data' command, for installing platform-independent data files.N)Command) change_root convert_pathc@sHeZdZdZdddgZdgZd d Zd dZddZddZ ddZ dS) install_datazinstall data files install-dir=dIbase directory for installing data files (default: installation base dir)root=Ns __pycache__/build.cpython-36.opt-1.pyc000064400000007717147221452520013460 0ustar003 \t@sTdZddlZddlZddlmZddlmZddlmZddZ Gdd d eZ dS) zBdistutils.command.build Implements the Distutils 'build' command.N)Command)DistutilsOptionError) get_platformcCsddlm}|dS)Nr)show_compilers)Zdistutils.ccompilerr)rr/usr/lib64/python3.6/build.pyr s rc@seZdZdZd8d9d:ddddefd?d@dAdBdCg ZddgZd$dd%efgZd&d'Z d(d)Z d*d+Z d,d-Z d.d/Z d0d1Zd2d3Zd4e fd5e fd6efd7efgZdS)Dbuildz"build everything needed to install build-base=b base directory for build librarybuild-purelib=N2build directory for platform-neutral distributionsbuild-platlib=3build directory for platform-specific distributions build-lib=z9build directory for all distribution (defaults to either zbuild-purelib or build-platlibbuild-scripts=build directory for scripts build-temp=ttemporary build directoryz plat-name=pz6platform name to build for, if supported (default: %s) compiler=cspecify the compiler type parallel=jnumber of parallel build jobsdebugg;compile extensions and libraries with debugging informationforcef2forcibly build everything (ignore file timestamps) executable=e5specify final destination interpreter path (build.py)z help-compilerzlist available compilerscCsLd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ dS)Nrr) build_base build_purelib build_platlib build_lib build_temp build_scriptsZcompiler plat_namerr executableparallel)selfrrrinitialize_options8szbuild.initialize_optionsc CsZ|jdkrt|_ntjdkr&tdd|jftjdd}ttdrR|d7}|jdkrntj j |j d|_|j dkrtj j |j d||_ |j dkr|jjr|j |_ n|j|_ |jdkrtj j |j d||_|jdkrtj j |j d tjdd|_|jdkrtj jtj|_t|jtrVyt|j|_Wntk rTtd YnXdS) NntzW--plat-name only supported on Windows (try using './configure --help' on your platform)z .%s-%d.%dgettotalrefcountz-pydebuglibZtempz scripts-%d.%dzparallel should be an integer)r,rosnamersys version_infohasattrr'pathjoinr&r(r) distributionZ ext_modulesr*r+r-normpath isinstancer.strint ValueError)r/Zplat_specifierrrrfinalize_optionsHs<                zbuild.finalize_optionscCs x|jD]}|j|q WdS)N)Zget_sub_commandsZ run_command)r/Zcmd_namerrrrunsz build.runcCs |jjS)N)r<has_pure_modules)r/rrrrDszbuild.has_pure_modulescCs |jjS)N)r<has_c_libraries)r/rrrrEszbuild.has_c_librariescCs |jjS)N)r<has_ext_modules)r/rrrrFszbuild.has_ext_modulescCs |jjS)N)r< has_scripts)r/rrrrGszbuild.has_scriptsZbuild_pyZ build_clibZ build_extr+)r r r )r Nr )rNrWbuild directory for all distribution (defaults to either build-purelib or build-platlib)rNrH)rNr)rrr)rrr)rrr)rrr)r r!r")r#r$r%)__name__ __module__ __qualname__ descriptionrZ user_optionsZboolean_optionsrZ help_optionsr0rBrCrDrErFrGZ sub_commandsrrrrrsR 8 r) __doc__r7r5Zdistutils.corerZdistutils.errorsrZdistutils.utilrrrrrrrs    __pycache__/install.cpython-36.opt-2.pyc000064400000031574147221452520014026 0ustar003 /fj@sddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZmZmZdd lmZdd l mZdd lmZdd lmZd ZddddddZddddddddddddedZerdddddded<ddd d!dded"<d*ZGd(d)d)eZdS)+N)log)Command)DEBUG)get_config_vars)DistutilsPlatformError) write_file) convert_path subst_vars change_root) get_platform)DistutilsOptionError) USER_BASE) USER_SITETz$base/Lib/site-packagesz$base/Include/$dist_namez $base/Scriptsz$base)purelibplatlibheadersscriptsdataz/$base/lib/python$py_version_short/site-packagesz5$platbase/lib64/python$py_version_short/site-packagesz9$base/include/python$py_version_short$abiflags/$dist_namez $base/binz$base/lib/pythonz$base/lib64/pythonz$base/include/python/$dist_name) unix_prefix unix_homentz $usersitez4$userbase/Python$py_version_nodot/Include/$dist_namez)$userbase/Python$py_version_nodot/Scriptsz $userbasent_userz=$userbase/include/python$py_version_short$abiflags/$dist_namez $userbase/bin unix_userrrrrrc@s:eZdZdZd_d`dadbdddedfdgdidjdkdldmdndodpdqdrgZdd%d(gZer`ejd,dd-efejd,d diZ d.d/Z d0d1Z d2d3Z d4d5Z d6d7Zd8d9Zd:d;Zdd?Zd@dAZdBdCZdDdEZdFdGZdHdIZdJdKZdLdMZdNdOZdPdQZdRdSZdTdUZdVdWZdXefdYefdZefd[efd\d]d^fgZdS)sinstallz'install everything from build directoryprefix=Ninstallation prefix exec-prefix=.(Unix only) prefix for platform-specific fileshome=+(Unix only) home directory to install under install-base=;base installation directory (instead of --prefix or --home)install-platbase=z8base installation directory for platform-specific files z$(instead of --exec-prefix or --home)root=|jD]2}|j|}x"|jD]}||kr&|j|q&WqW|jrl|jrl|jtjj|j |jd|S)Nz.pth) rget_finalized_commandrappendrrQrhr}r~r|)rWrrcmdrrXrXrYrbs  zinstall.get_outputscCs2g}x(|jD]}|j|}|j|jqW|S)N)rrextend get_inputs)rWZinputsrrrXrXrYrss  zinstall.get_inputscCs|jjp|jjS)N)rrZhas_pure_modulesZhas_ext_modules)rWrXrXrYhas_libs zinstall.has_libcCs |jjS)N)rr has_headers)rWrXrXrYrszinstall.has_headerscCs |jjS)N)rr has_scripts)rWrXrXrYrszinstall.has_scriptscCs |jjS)N)rrZhas_data_files)rWrXrXrYhas_dataszinstall.has_datarJrIrKrLZinstall_egg_infocCsdS)NTrX)rWrXrXrYszinstall.)rNr)rNr)rNr)r Nr!\base installation directory for platform-specific files (instead of --exec-prefix or --home))r"Nr)r#Nr$)r%Nr&)r'Nr(ginstallation directory for all module distributions (overrides --install-purelib and --install-platlib))r)Nr)r*Nr+)r,Nr-)r.Nr/)r0r1r2)r3Nr4)r5r6r7)r8r9r:)r;Nr<)r=Nr>) __name__ __module__ __qualname__Z descriptionrZboolean_optionsrurrrrZrrkrlrmrrrvrxrzr{rryrrrrrrrrZ sub_commandsrXrXrXrYrIs   N3  " , r)rrrrr)rnrhZ distutilsrZdistutils.corerZdistutils.debugrZdistutils.sysconfigrZdistutils.errorsrZdistutils.file_utilrZdistutils.utilrr r r r Zsiter rruZWINDOWS_SCHEMErrrrXrXrXrYsT            __pycache__/bdist.cpython-36.opt-2.pyc000064400000007003147221452520013453 0ustar003 \@sDddlZddlmZddlTddlmZddZGdddeZdS) N)Command)*) get_platformcCsTddlm}g}x,tjD]"}|jd|dtj|dfqW||}|jddS)Nr) FancyGetoptzformats=z'List of available distribution formats:)Zdistutils.fancy_getoptrbdistformat_commandsappendformat_commandZ print_help)rformatsformatZpretty_printerr //usr/lib64/python3.6/distutils/command/bdist.py show_formats s   rc @seZdZdZd6dddefd7d8d9d:d;gZdgZdd defgZdd?d@dAdBdCdDdEd/ Z d0d1Z d2d3Zd4d5Zd S)Frz$create a built (binary) distribution bdist-base=b4temporary directory for creating built distributionsz plat-name=pz;platform name to embed in generated filenames (default: %s)formats=N/formats for distribution (comma-separated list) dist-dir=d=directory to put final built distributions in [default: dist] skip-build2skip rebuilding everything (for testing/debugging)owner=u@Owner name used when creating a tar file [default: current user]group=gAGroup name used when creating a tar file [default: current group]z help-formatsz$lists available distribution formats bdist_rpmgztarzip)posixntrpmbztarxztarztartarwininstmsiRPM distribution bdist_dumbgzip'ed tar filebzip2'ed tar filexz'ed tar filecompressed tar filetar file bdist_wininstWindows executable installerZIP file bdist_msiMicrosoft Installer) r&r"r'r(r)r*r+r#r,cCs.d|_d|_d|_d|_d|_d|_d|_dS)Nr) bdist_base plat_namer dist_dir skip_buildgroupowner)selfr r rinitialize_optionsQszbdist.initialize_optionsc Cs|jdkr(|jrt|_n|jdj|_|jdkrT|jdj}tjj|d|j|_|j d|j dkry|j tj g|_ Wn"t k rtdtj YnX|jdkrd|_dS)NZbuildzbdist.r z;don't know how to create built distributions on platform %sZdist)r:r<rZget_finalized_commandr9 build_baseospathjoinZensure_string_listr default_formatnameKeyErrorZDistutilsPlatformErrorr;)r?rAr r rfinalize_optionsZs$       zbdist.finalize_optionsc Csg}xH|jD]>}y|j|j|dWq tk rHtd|Yq Xq Wxztt|jD]h}||}|j|}||jkr|j||_ |dkr|j |_ |j |_ |||ddkrd|_ |j |q^WdS)Nrzinvalid format '%s'r.r)r r r rGZDistutilsOptionErrorrangelenZreinitialize_commandno_format_optionr r>r=Z keep_tempZ run_command)r?Zcommandsr iZcmd_nameZsub_cmdr r rrunvs"    z bdist.run)rrr)rNr)rrr)rNr)rrr)rrr )r!)r!r-)r.r/)r.r0)r.r1)r.r2)r.r3)r4r5)r.r6)r7r8)__name__ __module__ __qualname__Z descriptionrZ user_optionsZboolean_optionsrZ help_optionsrKrErr r@rHrMr r r rrsJ    r)rBZdistutils.corerZdistutils.errorsZdistutils.utilrrrr r r rs    __pycache__/install_headers.cpython-36.opt-1.pyc000064400000003252147221452520015510 0ustar003 \@s$dZddlmZGdddeZdS)zdistutils.command.install_headers Implements the Distutils 'install_headers' command, to install C/C++ header files to the Python include directory.)Commandc@sFeZdZdZddgZdgZdd Zd d Zd d ZddZ ddZ dS)install_headerszinstall C/C++ header files install-dir=d$directory to install header files toforcef-force installation (overwrite existing files)cCsd|_d|_g|_dS)Nr) install_dirroutfiles)selfr '/usr/lib64/python3.6/install_headers.pyinitialize_optionssz"install_headers.initialize_optionscCs|jddddS)NZinstallrr r)rr )rr)Zset_undefined_options)r r r rfinalize_optionssz install_headers.finalize_optionscCsL|jj}|sdS|j|jx*|D]"}|j||j\}}|jj|q"WdS)N) distributionheadersZmkpathr Z copy_filer append)r rheaderout_r r rrun!s  zinstall_headers.runcCs |jjp gS)N)rr)r r r r get_inputs+szinstall_headers.get_inputscCs|jS)N)r )r r r r get_outputs.szinstall_headers.get_outputsN)rrr)rrr ) __name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsrrrrrr r r rr s rN)__doc__Zdistutils.corerrr r r rs __pycache__/build_scripts.cpython-36.opt-1.pyc000064400000010334147221452520015214 0ustar003 \X@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z ddlmZddlZejd ZGd d d eZGd d d ee ZdS)zRdistutils.command.build_scripts Implements the Distutils 'build_scripts' command.N)ST_MODE) sysconfig)Command)newer) convert_path Mixin2to3)logs^#!.*python[0-9.]*([ ].*)?$c@sHeZdZdZdddgZdgZd d Zd dZddZddZ ddZ dS) build_scriptsz("build" scripts (copy and fixup #! line) build-dir=ddirectory to "build" (copy) toforcef1forcibly build everything (ignore file timestamps executable=e*specify final destination interpreter pathcCs"d|_d|_d|_d|_d|_dS)N) build_dirscriptsr executableoutfiles)selfr%/usr/lib64/python3.6/build_scripts.pyinitialize_optionss z build_scripts.initialize_optionscCs|jdddd|jj|_dS) NZbuildr rr r)r r)r r )rr)Zset_undefined_optionsZ distributionr)rrrrfinalize_options%s zbuild_scripts.finalize_optionscCs|jS)N)r)rrrrget_source_files,szbuild_scripts.get_source_filescCs|js dS|jdS)N)r copy_scripts)rrrrrun/szbuild_scripts.runc"Cs|j|jg}g}x,|jD] }d}t|}tjj|jtjj|}|j||j rtt || rtt j d|qyt |d}Wn tk r|jsd}YnXXtj|j\}}|jd|j} | s|jd|qtj| } | rd}| jdpd } |rt jd ||j|j||js tjs2|j} n(tjjtjd d tjd tjdf} tj| } d| | d} y| jdWn$tk rt dj!| YnXy| j|Wn&tk rt dj!| |YnXt |d}|j"| |j#|j$WdQRX|r@|j%q|r*|j%|j||j&||qWtj'dkrxh|D]`}|jrpt jd|nDtj(|t)d@}|dBd@}||krVt jd|||tj*||qVW||fS)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. Fznot copying %s (up-to-date)rbNrz%s is an empty file (skipping)Tzcopying and adjusting %s -> %sBINDIRz python%s%sVERSIONEXEs#! zutf-8z.The shebang ({!r}) is not decodable from utf-8zAThe shebang ({!r}) is not decodable from the script encoding ({})wbposixzchanging mode of %siimz!changing mode of %s from %o to %o)+Zmkpathrrrospathjoinbasenameappendr rrdebugopenOSErrordry_runtokenizedetect_encodingreadlineseekwarn first_line_rematchgroupinforZ python_buildrget_config_varfsencodedecodeUnicodeDecodeError ValueErrorformatwrite writelines readlinescloseZ copy_filenamestatrchmod)rr updated_filesZscriptZadjustZoutfilerencodinglinesZ first_liner7Z post_interprZshebangZoutffileZoldmodeZnewmoderrrr5s                  zbuild_scripts.copy_scriptsN)r r r )r rr)rrr) __name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsrrrrrrrrrr sr c@seZdZddZdS)build_scripts_2to3cCs&tj|\}}|js|j|||fS)N)r rr0Zrun_2to3)rrrGrrrrs zbuild_scripts_2to3.copy_scriptsN)rKrLrMrrrrrrOsrO)__doc__r(rerErZ distutilsrZdistutils.corerZdistutils.dep_utilrZdistutils.utilrrrr1compiler6r rOrrrrs       __pycache__/bdist_dumb.cpython-36.opt-1.pyc000064400000007215147221452520014466 0ustar003 \1@shdZddlZddlmZddlmZddlmZmZddl Tddl m Z ddl m Z Gd d d eZdS) 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_treeensure_relative)*)get_python_version)logc @s^eZdZdZd%dddefd&d(d)d*d+d,d-g Zd ddgZdddZdd Zd!d"Z d#d$Z dS). bdist_dumbz"create a "dumb" built distribution bdist-dir=d1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s)format=f>archive format to create (tar, gztar, bztar, xztar, ztar, zip) keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archive dist-dir=-directory to put final built distributions in skip-buildN2skip rebuilding everything (for testing/debugging)relative7build the archive using relative paths (default: false)owner=u@Owner name used when creating a tar file [default: current user]group=gAGroup name used when creating a tar file [default: current group]Zgztarzip)posixntcCs:d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) bdist_dir plat_nameformat keep_tempdist_dir skip_buildrownergroup)selfr+"/usr/lib64/python3.6/bdist_dumb.pyinitialize_options2szbdist_dumb.initialize_optionscCsz|jdkr&|jdj}tjj|d|_|jdkrfy|jtj|_Wn"t k rdt dtjYnX|j dddd dS) NZbdistZdumbz@don't know how to create dumb built distributions on platform %sr&r#r')r&r&)r#r#)r'r') r"Zget_finalized_command bdist_baseospathjoinr$default_formatnameKeyErrorDistutilsPlatformErrorZset_undefined_options)r*r.r+r+r,finalize_options=s   zbdist_dumb.finalize_optionscCs(|js|jd|jddd}|j|_|j|_d|_tjd|j|jdd|jj |j f}t j j |j|}|js~|j}nJ|jjr|j|jkrtdt|jt|jfnt j j |jt|j}|j||j||j|jd }|jjrt}nd }|jjjd ||f|js$t|j|jd dS) NZbuildinstall)Zreinit_subcommandsrzinstalling to %sz%s.%szScan't make a dumb built distribution where base and platbase are different (%s, %s))Zroot_dirr(r)anyr )dry_run) r'Z run_commandZreinitialize_commandr"rootZwarn_dirrinfoZ distributionZ get_fullnamer#r/r0r1r&rZhas_ext_modulesZ install_baseZinstall_platbaser5reprrZ make_archiver$r(r)rZ dist_filesappendr%rr:)r*r7Zarchive_basenameZpseudoinstall_rootZ archive_rootfilenameZ pyversionr+r+r,runOs>          zbdist_dumb.run)r r r )rrrPkeep the pseudo-installation tree around after creating the distribution archive)rrrA)rr r)rNr)rNr)rrr)rrr) __name__ __module__ __qualname__ descriptionrZ user_optionsZboolean_optionsr2r-r6r@r+r+r+r,r s6  r )__doc__r/Zdistutils.corerZdistutils.utilrZdistutils.dir_utilrrZdistutils.errorsZdistutils.sysconfigrZ distutilsrr r+r+r+r,s    __pycache__/build_py.cpython-36.opt-2.pyc000064400000022042147221452520014155 0ustar003 \ C@szddlZddlZddlZddlmZddlmZddlTddlm Z m Z ddl m Z GdddeZ Gd d d e e ZdS) N)glob)Command)*) convert_path Mixin2to3)logc@seZdZdZd8d9d:d;dbuild_pyz5"build" pure Python modules (copy to build directory) build-lib=ddirectory to "build" (copy) tocompileccompile .py to .pyc no-compileN!don't compile .py files [default] optimize=Olalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]forcef2forcibly build everything (ignore file timestamps)cCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) build_lib py_modulespackage package_data package_dirr optimizer)selfr2/usr/lib64/python3.6/distutils/command/build_py.pyinitialize_options szbuild_py.initialize_optionsc Cs|jddd|jj|_|jj|_|jj|_i|_|jjrbx&|jjjD]\}}t||j|<qHW|j|_ t |j t syt |j |_ Wn t tfk rtdYnXdS)NZbuildrrzoptimize must be 0, 1, or 2)rr)rr)Zset_undefined_options distributionpackagesrrritemsrget_data_files data_files isinstancerint ValueErrorAssertionErrorZDistutilsOptionError)rnamepathrrrfinalize_options*s"      zbuild_py.finalize_optionscCs:|jr|j|jr$|j|j|j|jdddS)Nr)include_bytecode)r build_modulesr"build_packagesbuild_package_data byte_compile get_outputs)rrrrrunCs z build_py.runcsg}|js|Sxr|jD]h}|j|}tjj|jg|jd}d|rRt|dfdd|j||D}|j ||||fqW|S)N.rcsg|]}|dqS)Nr).0file)plenrr tsz+build_py.get_data_files..) r"get_package_dirosr+joinrsplitlenfind_data_filesappend)rdatarsrc_dir build_dir filenamesr)r8rr$as   zbuild_py.get_data_filescs`|jjdg|jj|g}gx:|D]2}ttjj|t|}jfdd|Dq&WS)Ncs$g|]}|krtjj|r|qSr)r;r+isfile)r6fn)filesrrr9s z,build_py.find_data_files..)rgetrr;r+r<rextend)rrrBZglobspatternZfilelistr)rHrr?ys  zbuild_py.find_data_filescCshd}x^|jD]T\}}}}xF|D]>}tjj||}|jtjj||jtjj|||ddqWq WdS)NF) preserve_mode)r%r;r+r<mkpathdirname copy_file)rZlastdirrrBrCrDfilenametargetrrrr0s zbuild_py.build_package_datac Cs|jd}|js&|r tjj|SdSng}x|ry|jdj|}Wn*tk rn|jd|d|d=Yq,X|jd|tjj|Sq,W|jjd}|dk r|jd||rtjj|SdSdS)Nr4rErr5rR)r=rr;r+r<KeyErrorinsertrI)rrr+tailZpdirrrrr:s(       zbuild_py.get_package_dircCsj|dkr8tjj|s td|tjj|s8td||rftjj|d}tjj|rZ|Stjd|dS)NrEz%package directory '%s' does not existz>supposed package directory '%s' exists, but is not a directoryz __init__.pyz!package init file '%s' not found z(or not a regular file)z8package init file '%s' not found (or not a regular file)) r;r+existsZDistutilsFileErrorisdirr<rFrwarn)rrrinit_pyrrr check_packages    zbuild_py.check_packagecCs&tjj|stjd||dSdSdS)Nz!file %s (for module %s) not foundFT)r;r+rFrrX)rmodule module_filerrr check_modules zbuild_py.check_modulec Cs|j||ttjj|d}g}tjj|jj}xX|D]P}tjj|}||krztjjtjj |d}|j |||fq8|j d|q8W|S)Nz*.pyrz excluding %s) rZrr;r+r<abspathr!Z script_namesplitextbasenamer@Z debug_print) rrrZ module_filesmodulesZ setup_scriptrZabs_fr[rrrfind_package_moduless   zbuild_py.find_package_modulesc Csi}g}x|jD]}|jd}dj|dd}|d}y||\}}Wn"tk rj|j|}d}YnX|s|j||} |df||<| r|j|d| ftjj||d} |j || sq|j||| fqW|S)Nr4rr5__init__z.pyrRrR) rr=r<rSr:rZr@r;r+r]) rr"rar[r+rZ module_baserZcheckedrYr\rrr find_moduless*       zbuild_py.find_modulescCsRg}|jr|j|j|jrNx.|jD]$}|j|}|j||}|j|q&W|S)N)rrJrdr"r:rb)rrarrmrrrfind_all_moduless   zbuild_py.find_all_modulescCsdd|jDS)NcSsg|] }|dqS)r5rRr)r6r[rrrr9-sz-build_py.get_source_files..)rf)rrrrget_source_files,szbuild_py.get_source_filescCs$|gt||dg}tjj|S)Nz.py)listr;r+r<)rrCrr[Z outfile_pathrrrget_module_outfile/szbuild_py.get_module_outfiler5cCs|j}g}xx|D]p\}}}|jd}|j|j||}|j||r|jr`|jtjj|dd|j dkr|jtjj||j dqW|dd|j D7}|S)Nr4rE) optimizationrcSs,g|]$\}}}}|D]}tjj||qqSr)r;r+r<)r6rrBrCrDrPrrrr9Cs z(build_py.get_outputs..) rfr=rirr@r importlibutilcache_from_sourcerr%)rr-raZoutputsrr[r\rPrrrr23s"       zbuild_py.get_outputscCsbt|tr|jd}nt|ttfs,td|j|j||}tj j |}|j ||j ||ddS)Nr4z:'package' must be a string (dot-separated), list, or tupler)rL) r&strr=rhtuple TypeErrorrirr;r+rNrMrO)rr[r\rZoutfiledirrrr build_moduleJs    zbuild_py.build_modulecCs.|j}x |D]\}}}|j|||qWdS)N)rdrr)rrarr[r\rrrr.Yszbuild_py.build_modulescCsLxF|jD]<}|j|}|j||}x |D]\}}}|j|||q(WqWdS)N)r"r:rbrr)rrrraZpackage_r[r\rrrr/bs   zbuild_py.build_packagescCstjr|jddSddlm}|j}|dtjkr>|tj}|jrZ||d|j ||j d|j dkr||||j |j ||j ddS)Nz%byte-compiling is disabled, skipping.r)r1r5)rrprefixdry_runrR) sysdont_write_bytecoderXdistutils.utilr1rr;sepr rrtr)rrHr1rsrrrr1vs    zbuild_py.byte_compile)r r r )r r r)rNr)rrr)rrr)r5)__name__ __module__ __qualname__Z descriptionZ user_optionsZboolean_optionsZ negative_optr r,r3r$r?r0r:rZr]rbrdrfrgrir2rrr.r/r1rrrrrs8   '4  rc@seZdZddZddZdS) build_py_2to3cCsLg|_|jr|j|jr*|j|j|j|j|j|jdddS)Nr)r-) updated_filesrr.r"r/r0Zrun_2to3r1r2)rrrrr3s zbuild_py_2to3.runcCs,tj||||}|dr(|jj|d|S)Nr5r)rrrr}r@)rr[r\rresrrrrrszbuild_py_2to3.build_moduleN)ryrzr{r3rrrrrrr|sr|)r;importlib.utilrkrurZdistutils.corerZdistutils.errorsrwrrZ distutilsrrr|rrrrs   }__pycache__/build_scripts.cpython-36.pyc000064400000010334147221452520014255 0ustar003 \X@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z ddlmZddlZejd ZGd d d eZGd d d ee ZdS)zRdistutils.command.build_scripts Implements the Distutils 'build_scripts' command.N)ST_MODE) sysconfig)Command)newer) convert_path Mixin2to3)logs^#!.*python[0-9.]*([ ].*)?$c@sHeZdZdZdddgZdgZd d Zd dZddZddZ ddZ dS) build_scriptsz("build" scripts (copy and fixup #! line) build-dir=ddirectory to "build" (copy) toforcef1forcibly build everything (ignore file timestamps executable=e*specify final destination interpreter pathcCs"d|_d|_d|_d|_d|_dS)N) build_dirscriptsr executableoutfiles)selfr%/usr/lib64/python3.6/build_scripts.pyinitialize_optionss z build_scripts.initialize_optionscCs|jdddd|jj|_dS) NZbuildr rr r)r r)r r )rr)Zset_undefined_optionsZ distributionr)rrrrfinalize_options%s zbuild_scripts.finalize_optionscCs|jS)N)r)rrrrget_source_files,szbuild_scripts.get_source_filescCs|js dS|jdS)N)r copy_scripts)rrrrrun/szbuild_scripts.runc"Cs|j|jg}g}x,|jD] }d}t|}tjj|jtjj|}|j||j rtt || rtt j d|qyt |d}Wn tk r|jsd}YnXXtj|j\}}|jd|j} | s|jd|qtj| } | rd}| jdpd } |rt jd ||j|j||js tjs2|j} n(tjjtjd d tjd tjdf} tj| } d| | d} y| jdWn$tk rt dj!| YnXy| j|Wn&tk rt dj!| |YnXt |d}|j"| |j#|j$WdQRX|r@|j%q|r*|j%|j||j&||qWtj'dkrxh|D]`}|jrpt jd|nDtj(|t)d@}|dBd@}||krVt jd|||tj*||qVW||fS)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. Fznot copying %s (up-to-date)rbNrz%s is an empty file (skipping)Tzcopying and adjusting %s -> %sBINDIRz python%s%sVERSIONEXEs#! zutf-8z.The shebang ({!r}) is not decodable from utf-8zAThe shebang ({!r}) is not decodable from the script encoding ({})wbposixzchanging mode of %siimz!changing mode of %s from %o to %o)+Zmkpathrrrospathjoinbasenameappendr rrdebugopenOSErrordry_runtokenizedetect_encodingreadlineseekwarn first_line_rematchgroupinforZ python_buildrget_config_varfsencodedecodeUnicodeDecodeError ValueErrorformatwrite writelines readlinescloseZ copy_filenamestatrchmod)rr updated_filesZscriptZadjustZoutfilerencodinglinesZ first_liner7Z post_interprZshebangZoutffileZoldmodeZnewmoderrrr5s                  zbuild_scripts.copy_scriptsN)r r r )r rr)rrr) __name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsrrrrrrrrrr sr c@seZdZddZdS)build_scripts_2to3cCs&tj|\}}|js|j|||fS)N)r rr0Zrun_2to3)rrrGrrrrs zbuild_scripts_2to3.copy_scriptsN)rKrLrMrrrrrrOsrO)__doc__r(rerErZ distutilsrZdistutils.corerZdistutils.dep_utilrZdistutils.utilrrrr1compiler6r rOrrrrs       __pycache__/build_scripts.cpython-36.opt-2.pyc000064400000007544147221452520015226 0ustar003 \X@sddlZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddlm Z ddlZejdZGd d d eZGd d d ee ZdS) N)ST_MODE) sysconfig)Command)newer) convert_path Mixin2to3)logs^#!.*python[0-9.]*([ ].*)?$c@sHeZdZdZdddgZdgZd d Zd dZddZddZ ddZ dS) build_scriptsz("build" scripts (copy and fixup #! line) build-dir=ddirectory to "build" (copy) toforcef1forcibly build everything (ignore file timestamps executable=e*specify final destination interpreter pathcCs"d|_d|_d|_d|_d|_dS)N) build_dirscriptsr executableoutfiles)selfr7/usr/lib64/python3.6/distutils/command/build_scripts.pyinitialize_optionss z build_scripts.initialize_optionscCs|jdddd|jj|_dS) NZbuildr rr r)r r)r r )rr)Zset_undefined_optionsZ distributionr)rrrrfinalize_options%s zbuild_scripts.finalize_optionscCs|jS)N)r)rrrrget_source_files,szbuild_scripts.get_source_filescCs|js dS|jdS)N)r copy_scripts)rrrrrun/szbuild_scripts.runc"Cs|j|jg}g}x,|jD] }d}t|}tjj|jtjj|}|j||j rtt || rtt j d|qyt |d}Wn tk r|jsd}YnXXtj|j\}}|jd|j} | s|jd|qtj| } | rd}| jdpd} |rt jd ||j|j||js tjs2|j} n(tjjtjd d tjd tjd f} tj| } d| | d} y| jdWn$tk rt dj!| YnXy| j|Wn&tk rt dj!| |YnXt |d}|j"| |j#|j$WdQRX|r@|j%q|r*|j%|j||j&||qWtj'dkrxh|D]`}|jrpt jd|nDtj(|t)d@}|dBd@}||krVt jd|||tj*||qVW||fS)NFznot copying %s (up-to-date)rbrz%s is an empty file (skipping)Tzcopying and adjusting %s -> %sBINDIRz python%s%sVERSIONEXEs#! zutf-8z.The shebang ({!r}) is not decodable from utf-8zAThe shebang ({!r}) is not decodable from the script encoding ({})wbposixzchanging mode of %siimz!changing mode of %s from %o to %o)+Zmkpathrrrospathjoinbasenameappendr rrdebugopenOSErrordry_runtokenizedetect_encodingreadlineseekwarn first_line_rematchgroupinforZ python_buildrget_config_varfsencodedecodeUnicodeDecodeError ValueErrorformatwrite writelines readlinescloseZ copy_filenamestatrchmod)rr updated_filesZscriptZadjustZoutfilerencodinglinesZ first_liner7Z post_interprZshebangZoutffileZoldmodeZnewmoderrrr5s                  zbuild_scripts.copy_scriptsN)r r r )r rr)rrr) __name__ __module__ __qualname__Z descriptionZ user_optionsZboolean_optionsrrrrrrrrrr sr c@seZdZddZdS)build_scripts_2to3cCs&tj|\}}|js|j|||fS)N)r rr0Zrun_2to3)rrrGrrrrs zbuild_scripts_2to3.copy_scriptsN)rKrLrMrrrrrrNsrN)r(rerErZ distutilsrZdistutils.corerZdistutils.dep_utilrZdistutils.utilrrrr1compiler6r rNrrrrs       __pycache__/install_lib.cpython-36.opt-2.pyc000064400000010773147221452520014652 0ustar003 \ @sHddlZddlZddlZddlmZddlmZdZGdddeZ dS)N)Command)DistutilsOptionErrorz.pyc @seZdZdZd*d+d,d-d.d/d0gZdd dgZdd iZddZddZddZ ddZ ddZ d d!Z d"d#Z d$d%Zd&d'Zd(d)ZdS)1 install_libz7install all Python modules (extensions and pure Python) install-dir=ddirectory to install to build-dir=b'build directory (where to install from)forcef-force installation (overwrite existing files)compileccompile .py to .pyc [default] no-compileNdon't compile .py files optimize=Olalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0] skip-buildskip the build stepscCs(d|_d|_d|_d|_d|_d|_dS)Nr) install_dir build_dirr roptimize skip_build)selfr5/usr/lib64/python3.6/distutils/command/install_lib.pyinitialize_options3s zinstall_lib.initialize_optionsc Cs|jddddddd|jdkr&d |_|jdkr6d |_t|jtsyt|j|_|jdkr^tWn ttfk rtdYnXdS)Ninstall build_librrrr rrrTFrzoptimize must be 0, 1, or 2)r!r)rr)r r )rr)rr)rr)rr"r#)Zset_undefined_optionsrr isinstanceintAssertionError ValueErrorr)rrrrfinalize_options<s$     zinstall_lib.finalize_optionscCs0|j|j}|dk r,|jjr,|j|dS)N)buildr distributionhas_pure_modules byte_compile)routfilesrrrrunVszinstall_lib.runcCs2|js.|jjr|jd|jjr.|jddS)Nbuild_py build_ext)rr*r+Z run_commandhas_ext_modules)rrrrr)fs    zinstall_lib.buildcCs8tjj|jr |j|j|j}n|jd|jdS|S)Nz3'%s' does not exist -- no Python modules to install)ospathisdirrZ copy_treerwarn)rr-rrrr ms  zinstall_lib.installcCsrtjr|jddSddlm}|jdj}|jrH||d|j||j d|j dkrn|||j |j||j |j ddS)Nz%byte-compiling is disabled, skipping.r)r,r )rr prefixdry_run)rr r6verboser7) sysdont_write_bytecoder5Zdistutils.utilr,get_finalized_commandrootrr r7rr8)rfilesr,Z install_rootrrrr,vs     zinstall_lib.byte_compilec Csh|sgS|j|}|j}t||}t|ttj}g}x(|D] } |jtjj|| |dq@W|S)N) r; get_outputsgetattrlenr2sepappendr3join) rZhas_anyZ build_cmdZ cmd_optionZ output_dirZ build_filesrZ prefix_lenZoutputsfilerrr_mutate_outputss    zinstall_lib._mutate_outputscCsvg}xl|D]d}tjjtjj|d}|tkr0q |jrL|jtjj |dd|j dkr |jtjj ||j dq W|S)Nr") optimizationr) r2r3splitextnormcasePYTHON_SOURCE_EXTENSIONrrB importlibutilcache_from_sourcer)rZ py_filenamesZbytecode_filesZpy_fileZextrrr_bytecode_filenamess     zinstall_lib._bytecode_filenamescCsR|j|jjdd|j}|jr*|j|}ng}|j|jjdd|j}|||S)Nr/r!r0)rEr*r+rrrNr1)rZ pure_outputsZbytecode_outputsZ ext_outputsrrrr>s   zinstall_lib.get_outputscCsLg}|jjr&|jd}|j|j|jjrH|jd}|j|j|S)Nr/r0)r*r+r;extendr>r1)rZinputsr/r0rrr get_inputss    zinstall_lib.get_inputs)rrr)rr r )r r r )rrr)rNr)rrr)rNr)__name__ __module__ __qualname__Z descriptionZ user_optionsZboolean_optionsZ negative_optrr(r.r)r r,rErNr>rPrrrrrs*   r) r2importlib.utilrKr9Zdistutils.corerZdistutils.errorsrrJrrrrrs   __pycache__/config.cpython-36.opt-2.pyc000064400000015526147221452520013624 0ustar003 \3@shddlZddlZddlmZddlmZddlmZddlm Z dddZ Gd d d eZ d d d Z dS)N)Command)DistutilsExecError)customize_compiler)logz.cz.cxx)czc++c @seZdZdZd>d?d@dAdBdCdDdEdFg ZddZddZddZd d!Zd"d#Z d$d%Z d&d'Z d(d)Z d*d+Z dGd-d.ZdHd/d0ZdId1d2ZdJd3d4ZdKd5d6ZdLd8d9Zdddgfd:d;ZdMd  r)LANG_EXTopenwriteclose)r&bodyheaderslangfilenamefileheaderr'r'r(_gen_temp_sourcefileks       zconfig._gen_temp_sourcefilecCs<|j|||}d}|jj||g|jj|||d||fS)Nz _configtest.i)r!)rCr%extendr Z preprocess)r&r=r>r!r?srcoutr'r'r( _preprocessxs zconfig._preprocesscCs\|j|||}|jr"t|d||jj|g\}|jj||g|jj|g|d||fS)Nzcompiling '%s':)r!)rCr$ dump_filer Zobject_filenamesr%rDcompile)r&r=r>r!r?rEobjr'r'r(_compileszconfig._compilec Csr|j||||\}}tjjtjj|d} |jj|g| |||d|jjdk r\| |jj} |jj | ||| fS)Nr)r"r#Z target_lang) rKr-pathsplitextbasenamer Zlink_executableZ exe_extensionr%append) r&r=r>r!r"r#r?rErJprogr'r'r(_links    z config._linkc GsX|s|j}g|_tjddj|x0|D](}ytj|Wq(tk rNYq(Xq(WdS)Nz removing: %s )r%rinfojoinr-removeOSError)r& filenamesr@r'r'r(_cleans z config._cleanrc CsRddlm}|jd}y|j||||Wn|k rDd}YnX|j|S)Nr) CompileErrorTF)r4rYr5rGrX)r&r=r>r!r?rYokr'r'r(try_cpps  zconfig.try_cppc Csx|j|j||||\}}t|tr0tj|}t|}d} x&|j} | dkrPP|j| r>d} Pq>W|j |j | S)NFT) r5rGr*r+rerIr:readlinesearchr<rX) r&patternr=r>r!r?rErFrAmatchliner'r'r( search_cpps    zconfig.search_cppc Csdddlm}|jy|j||||d}Wn|k rDd}YnXtj|rRdpTd|j|S)Nr)rYTFzsuccess!zfailure.)r4rYr5rKrrSrX)r&r=r>r!r?rYrZr'r'r( try_compiles  zconfig.try_compilec Cspddlm}m}|jy|j||||||d} Wn||fk rPd} YnXtj| r^dp`d|j| S)Nr)rY LinkErrorTFzsuccess!zfailure.)r4rYrer5rQrrSrX) r&r=r>r!r"r#r?rYrerZr'r'r(try_links   zconfig.try_linkc Csddlm}m}|jy.|j||||||\} } } |j| gd} Wn||tfk rdd} YnXtj| rrdptd|j | S)Nr)rYreTFzsuccess!zfailure.) r4rYrer5rQZspawnrrrSrX) r&r=r>r!r"r#r?rYrerErJZexerZr'r'r(try_runs   zconfig.try_runrc Cst|jg}|r|jd||jd|r<|jd|n|jd||jddj|d}|j|||||S)Nz int %s ();z int main () {z %s();z %s;}r7)r5rOrTrf) r&funcr>r!r"r#ZdeclZcallr=r'r'r( check_funcs   zconfig.check_funccCs |j|jd|||g||S)Nzint main (void) { })r5rf)r&Zlibraryr#r>r!Zother_librariesr'r'r( check_lib6s  zconfig.check_libcCs|jd|g|dS)Nz /* No body */)r=r>r!)r[)r&rBr!r#r?r'r'r( check_headerDs zconfig.check_header)rNr )r Nr )r r r)rrr)rrr)rrr)rrr)rNr)rNr)NNNr)NNNr)NNr)NNNNr)NNNNr)NNNNrr)NNr)__name__ __module__ __qualname__Z descriptionZ user_optionsr)r/r0r5rCrGrKrQrXr[rcrdrfrgrjrkrlr'r'r'r(rsT         rc CsJ|dkrtjd|n tj|t|}ztj|jWd|jXdS)Nz%s)rrSr:readr<)r@headrAr'r'r(rHNs rH)N) r-r]Zdistutils.corerZdistutils.errorsrZdistutils.sysconfigrZ distutilsrr9rrHr'r'r'r( s     ;__pycache__/install_scripts.cpython-36.opt-2.pyc000064400000004010147221452520015556 0ustar003 \@s@ddlZddlmZddlmZddlmZGdddeZdS)N)Command)log)ST_MODEc@sLeZdZdZddddgZdd gZddZddZddZddZ ddZ d S)install_scriptsz%install scripts (Python or otherwise) install-dir=ddirectory to install scripts to build-dir=b'build directory (where to install from)forcef-force installation (overwrite existing files) skip-buildNskip the build stepscCsd|_d|_d|_d|_dS)Nr) install_dirr build_dir skip_build)selfr9/usr/lib64/python3.6/distutils/command/install_scripts.pyinitialize_optionssz"install_scripts.initialize_optionscCs |jdd |jdd d d dS) NZbuild build_scriptsrZinstallrrr r)rr)rr)r r )rr)Zset_undefined_options)rrrrfinalize_options!s  z install_scripts.finalize_optionscCs|js|jd|j|j|j|_tjdkrxT|jD]H}|j rNt j d|q6tj |t dBd@}t j d||tj||q6WdS)Nrposixzchanging mode of %simizchanging mode of %s to %o)rZ run_commandZ copy_treerroutfilesosname get_outputsZdry_runrinfostatrchmod)rfilemoderrrrun)s  zinstall_scripts.runcCs |jjp gS)N)Z distributionscripts)rrrr get_inputs8szinstall_scripts.get_inputscCs |jpgS)N)r)rrrrr;szinstall_scripts.get_outputs)rrr)r r r )r r r)rNr) __name__ __module__ __qualname__Z descriptionZ user_optionsZboolean_optionsrrr$r&rrrrrrsr)rZdistutils.corerZ distutilsrr rrrrrrs   __pycache__/clean.cpython-36.opt-2.pyc000064400000004060147221452520013430 0ustar003 \ @s@ddlZddlmZddlmZddlmZGdddeZdS)N)Command) remove_tree)logc@s>eZdZdZddddddgZdgZddZddZddZdS)cleanz-clean up temporary files from 'build' command build-base=b2base build directory (default: 'build.build-base') build-lib=Ns   __pycache__/build.cpython-36.opt-2.pyc000064400000007616147221452520013457 0ustar003 \t@sPddlZddlZddlmZddlmZddlmZddZGdddeZ dS) N)Command)DistutilsOptionError) get_platformcCsddlm}|dS)Nr)show_compilers)Zdistutils.ccompilerr)rr//usr/lib64/python3.6/distutils/command/build.pyr s rc@seZdZdZd8d9d:ddddefd?d@dAdBdCg ZddgZd$dd%efgZd&d'Z d(d)Z d*d+Z d,d-Z d.d/Z d0d1Zd2d3Zd4e fd5e fd6efd7efgZdS)Dbuildz"build everything needed to install build-base=b base directory for build librarybuild-purelib=N2build directory for platform-neutral distributionsbuild-platlib=3build directory for platform-specific distributions build-lib=z9build directory for all distribution (defaults to either zbuild-purelib or build-platlibbuild-scripts=build directory for scripts build-temp=ttemporary build directoryz plat-name=pz6platform name to build for, if supported (default: %s) compiler=cspecify the compiler type parallel=jnumber of parallel build jobsdebugg;compile extensions and libraries with debugging informationforcef2forcibly build everything (ignore file timestamps) executable=e5specify final destination interpreter path (build.py)z help-compilerzlist available compilerscCsLd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ dS)Nrr) build_base build_purelib build_platlib build_lib build_temp build_scriptsZcompiler plat_namerr executableparallel)selfrrrinitialize_options8szbuild.initialize_optionsc CsZ|jdkrt|_ntjdkr&tdd|jftjdd}ttdrR|d7}|jdkrntj j |j d|_|j dkrtj j |j d||_ |j dkr|jjr|j |_ n|j|_ |jdkrtj j |j d||_|jdkrtj j |j d tjdd|_|jdkrtj jtj|_t|jtrVyt|j|_Wntk rTtd YnXdS) NntzW--plat-name only supported on Windows (try using './configure --help' on your platform)z .%s-%d.%dgettotalrefcountz-pydebuglibZtempz scripts-%d.%dzparallel should be an integer)r,rosnamersys version_infohasattrr'pathjoinr&r(r) distributionZ ext_modulesr*r+r-normpath isinstancer.strint ValueError)r/Zplat_specifierrrrfinalize_optionsHs<                zbuild.finalize_optionscCs x|jD]}|j|q WdS)N)Zget_sub_commandsZ run_command)r/Zcmd_namerrrrunsz build.runcCs |jjS)N)r<has_pure_modules)r/rrrrDszbuild.has_pure_modulescCs |jjS)N)r<has_c_libraries)r/rrrrEszbuild.has_c_librariescCs |jjS)N)r<has_ext_modules)r/rrrrFszbuild.has_ext_modulescCs |jjS)N)r< has_scripts)r/rrrrGszbuild.has_scriptsZbuild_pyZ build_clibZ build_extr+)r r r )r Nr )rNrWbuild directory for all distribution (defaults to either build-purelib or build-platlib)rNrH)rNr)rrr)rrr)rrr)rrr)r r!r")r#r$r%)__name__ __module__ __qualname__Z descriptionrZ user_optionsZboolean_optionsrZ help_optionsr0rBrCrDrErFrGZ sub_commandsrrrrrsR 8 r) r7r5Zdistutils.corerZdistutils.errorsrZdistutils.utilrrrrrrrs    __pycache__/bdist_msi.cpython-36.opt-2.pyc000064400000043332147221452520014330 0ustar003 \@sddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZddlZdd lmZmZmZdd lmZmZmZmZGd d d eZGd ddeZdS)N)Command) remove_tree)get_python_version) StrictVersion)DistutilsOptionError) get_platform)log)schemasequencetext) DirectoryFeatureDialogadd_datac@sBeZdZddZddZdddZdd d Zdd dZddZdS)PyDialogcOs>tj|f||jd}d|d}|jdd||jddS)N$iHZ BottomLiner)r__init__hlinew)selfargskwZrulerZbmwidthr3/usr/lib64/python3.6/distutils/command/bdist_msi.pyrs  zPyDialog.__init__c Cs|jddddddd|dS)NTitle i@<iz{\VerdanaBold10}%s)r )rtitlerrrr #szPyDialog.titleBackc Cs,|r d}nd}|j|d|jddd|||S)Nr"8) pushbuttonr)rr nextnameactiveflagsrrrback*sz PyDialog.backCancelc Cs,|r d}nd}|j|d|jddd|||S)Nr#r"i0r%r&r')r(r)rr r)r*r+r,rrrcancel5szPyDialog.cancelNextc Cs,|r d}nd}|j|d|jddd|||S)Nr#r"r%r&r')r(r)rr r)r*r+r,rrrr)@sz PyDialog.nextc Cs,|j|t|j|d|jdddd||S)Nr%r&r'r#)r(intrr)rr*r r)ZxposrrrxbuttonKszPyDialog.xbuttonN)r!r")r.r")r0r") __name__ __module__ __qualname__rr r-r/r)r4rrrrrs   rc@seZdZdZdCdddefdEdGdHdIdJdKdLdMg ZddddgZddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1gZd2Zd3d4Z d5d6Z d7d8Z d9d:Z d;d<Z d=d>Zd?d@ZdAdBZdS)N bdist_msiz7create a Microsoft Installer (.msi) binary distribution bdist-dir=N1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s) keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archivetarget-version=z!require a specific python versionz on the target systemno-target-compilec/do not compile .py to .pyc on the target systemno-target-optimizeo;do not compile .py to .pyo (optimized) on the target system dist-dir=d-directory to put final built distributions in skip-build2skip rebuilding everything (for testing/debugging)install-script=Ubasename of installation script to be run after installation or before deinstallationpre-install-script={Fully qualified filename of a script to be run before any files are installed. This script need not be in the distributionz2.0z2.1z2.2z2.3z2.4z2.5z2.6z2.7z2.8z2.9z3.0z3.1z3.2z3.3z3.4z3.5z3.6z3.7z3.8z3.9XcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ dS)Nr) bdist_dir plat_name keep_tempZno_target_compileZno_target_optimizetarget_versiondist_dir skip_buildinstall_scriptpre_install_scriptversions)rrrrinitialize_options}szbdist_msi.initialize_optionscCs|jdd |jdkr2|jdj}tjj|d|_t}|j rP|j j rP||_|jr|jg|_ |j r|j j r|j|krt d|fn t|j|_ |jdd d |jrt d|jrx2|j jD]}|jtjj|krPqWt d|jd|_dS) NZbdistrTZmsizMtarget version can only be %s, or the '--skip-build' option must be specifiedrSrPz5the pre-install-script feature is not yet implementedz(install_script '%s' not found in scripts)rTrT)rSrS)rPrP)Zset_undefined_optionsrOget_finalized_command bdist_baseospathjoinrrR distributionhas_ext_modulesrWrTrlist all_versionsrVrUscriptsbasenameinstall_script_key)rrZZ short_versionZscriptrrrfinalize_optionss:        zbdist_msi.finalize_optionscCsz|js|jd|jddd}|j|_|j|_d|_|jd}d|_d|_|jj r|j }|spdt j dd}d |j |f}|jd}tjj|jd ||_tjd |j|jt jjdtjj|jd |jt jd=|j|j|jj}|j|}tjj|}tjj|r"tj||jj }|j!} | s<|j"} | sFd } |j#} dt$| j%} |jj}|j r~d|j |f} nd|} t&j'|t(| t&j)| | |_*t&j+|j*t,d| fg} |j-p|j.}|r| j/d|f|j0r| j/d|j0f| rt1|j*d| |j2|j3|j4|j5|j*j6t7|jdr^d|j pJd|f}|jj8j/||j9svt:|j|j;ddS)Nbuildinstallr")Zreinit_subcommandsr install_libz%d.%dz.%s-%slibzinstalling to %sZPURELIBZUNKNOWNz%d.%d.%dz Python %s %sz Python %sZ DistVersionZ ARPCONTACTZARPURLINFOABOUTProperty dist_filesr8any)dry_run)| jd?d9d@d;dAd=dB| j d2d6d2dC} | j dDdEt|dF||||||d2d2d2 } | jdG| jd4d2dd5| jd6d7dd5| jd8d9d:d;dz [TARGETDIR]z [SourceDir])Zorderingz [TARGETDIR%s]z FEATURE_SELECTED AND &Python%s=3ZSpawnWaitDialogriZFeaturesZ SelectionTreerZFEATUREZPathEditz[FEATURE_SELECTED]1z!FEATURE_SELECTED AND &Python%s<>3ZOtherz$Provide an alternate Python locationZEnableZShowZDisableZHiderrZ DiskCostDlgZOKz&{\DlgFontBold8}Disk Space RequirementszFThe disk space required for the installation of the selected features.5aThe 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).Z VolumeListZVolumeCostListdiz{120}{70}{70}{70}{70}g?Z AdminInstallzGSelect whether to install [ProductName] for all users of this computer.zInstall for all usersZJUSTMEzInstall just for mez [ALLUSERS]zWhichUsers="ALL"z({\DlgFontBold8}[Progress1] [ProductName]#AzYPlease wait while the Installer [Progress2] [ProductName]. This may take several minutes.Z StatusLabelzStatus:Z ProgressBariz Progress doneZ SetProgressZProgressz)Welcome to the [ProductName] Setup WizardZBodyText?z:Select whether you want to repair or remove [ProductName].ZRepairRadioGrouplrz&Repair [ProductName]ZRemoverzRe&move [ProductName]z [REINSTALL]zMaintenanceForm_Action="Repair"z [Progress1]Z Repairingz [Progress2]ZrepairsZ Reinstallz[REMOVE]zMaintenanceForm_Action="Remove" ZRemoving Zremoves z MaintenanceForm_Action<>"Change")rr)rr)rr)rr)rr)rr)rrrNr)rrrNr")rrrNr")rrrrr)rrr)rrr)rrr)rrr)rNr)rrr rrrr r-r/r)ZeventZcontrolrr(mappingr^rwrWrZ conditionr4Z radiogroupadd)rrxyrrr ZmodalZmodelessZtrack_disk_spaceZfatalr@Z user_exitZ exit_dialogZinuseerrorr/ZcostingZprepZseldlgorderr~rZinstall_other_condZdont_install_other_condZcostZ whichusersgZprogressZmaintrrrrs                                                                zbdist_msi.add_uicCs<|jrd||j|jf}nd||jf}tjj|j|}|S)Nz%s.%s-py%s.msiz %s.%s.msi)rRrPr[r\r]rS)rrZ base_namerrrrrxs  z bdist_msi.get_installer_filename)r9Nr:Pkeep the pseudo-installation tree around after creating the distribution archive)r<r=r6require a specific python version on the target system)r>Nr)r?r@rA)rBrCrD)rErFrG)rHNrI)rJNrK)rLNrM)r5r6r7Z descriptionrZ user_optionsZboolean_optionsrarrXrervrrrrrxrrrrr8SsR    ([66&@r8)rrr[Zdistutils.corerZdistutils.dir_utilrZdistutils.sysconfigrZdistutils.versionrZdistutils.errorsrZdistutils.utilrZ distutilsrrr r r r r rrrr8rrrr s       >__pycache__/build.cpython-36.pyc000064400000007717147221452520012521 0ustar003 \t@sTdZddlZddlZddlmZddlmZddlmZddZ Gdd d eZ dS) zBdistutils.command.build Implements the Distutils 'build' command.N)Command)DistutilsOptionError) get_platformcCsddlm}|dS)Nr)show_compilers)Zdistutils.ccompilerr)rr/usr/lib64/python3.6/build.pyr s rc@seZdZdZd8d9d:ddddefd?d@dAdBdCg ZddgZd$dd%efgZd&d'Z d(d)Z d*d+Z d,d-Z d.d/Z d0d1Zd2d3Zd4e fd5e fd6efd7efgZdS)Dbuildz"build everything needed to install build-base=b base directory for build librarybuild-purelib=N2build directory for platform-neutral distributionsbuild-platlib=3build directory for platform-specific distributions build-lib=z9build directory for all distribution (defaults to either zbuild-purelib or build-platlibbuild-scripts=build directory for scripts build-temp=ttemporary build directoryz plat-name=pz6platform name to build for, if supported (default: %s) compiler=cspecify the compiler type parallel=jnumber of parallel build jobsdebugg;compile extensions and libraries with debugging informationforcef2forcibly build everything (ignore file timestamps) executable=e5specify final destination interpreter path (build.py)z help-compilerzlist available compilerscCsLd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ dS)Nrr) build_base build_purelib build_platlib build_lib build_temp build_scriptsZcompiler plat_namerr executableparallel)selfrrrinitialize_options8szbuild.initialize_optionsc CsZ|jdkrt|_ntjdkr&tdd|jftjdd}ttdrR|d7}|jdkrntj j |j d|_|j dkrtj j |j d||_ |j dkr|jjr|j |_ n|j|_ |jdkrtj j |j d||_|jdkrtj j |j d tjdd|_|jdkrtj jtj|_t|jtrVyt|j|_Wntk rTtd YnXdS) NntzW--plat-name only supported on Windows (try using './configure --help' on your platform)z .%s-%d.%dgettotalrefcountz-pydebuglibZtempz scripts-%d.%dzparallel should be an integer)r,rosnamersys version_infohasattrr'pathjoinr&r(r) distributionZ ext_modulesr*r+r-normpath isinstancer.strint ValueError)r/Zplat_specifierrrrfinalize_optionsHs<                zbuild.finalize_optionscCs x|jD]}|j|q WdS)N)Zget_sub_commandsZ run_command)r/Zcmd_namerrrrunsz build.runcCs |jjS)N)r<has_pure_modules)r/rrrrDszbuild.has_pure_modulescCs |jjS)N)r<has_c_libraries)r/rrrrEszbuild.has_c_librariescCs |jjS)N)r<has_ext_modules)r/rrrrFszbuild.has_ext_modulescCs |jjS)N)r< has_scripts)r/rrrrGszbuild.has_scriptsZbuild_pyZ build_clibZ build_extr+)r r r )r Nr )rNrWbuild directory for all distribution (defaults to either build-purelib or build-platlib)rNrH)rNr)rrr)rrr)rrr)rrr)r r!r")r#r$r%)__name__ __module__ __qualname__ descriptionrZ user_optionsZboolean_optionsrZ help_optionsr0rBrCrDrErFrGZ sub_commandsrrrrrsR 8 r) __doc__r7r5Zdistutils.corerZdistutils.errorsrZdistutils.utilrrrrrrrs    __pycache__/check.cpython-36.pyc000064400000012127147221452520012466 0ustar003 \x @sdZddlmZddlmZyTddlmZddlmZddl m Z ddl m Z ddl m Z Gd d d eZd ZWnek rd ZYnXGd ddeZdS)zCdistutils.command.check Implements the Distutils 'check' command. )Command)DistutilsSetupError)Reporter)Parser)frontend)nodes)StringIOc@seZdZd ddZddZdS) SilentReporterNrasciireplacec Cs"g|_tj||||||||dS)N)messagesr__init__)selfsource report_level halt_levelstreamdebugencoding error_handlerr/usr/lib64/python3.6/check.pyr szSilentReporter.__init__cOs6|jj||||ftj|f|||j|d|S)N)leveltype)r appendrsystem_messageZlevels)rrmessageZchildrenkwargsrrrrszSilentReporter.system_message)Nrr r )__name__ __module__ __qualname__r rrrrrr s r TFc@s`eZdZdZdZdddgZddd gZd d ZddZddZ ddZ ddZ ddZ ddZ dS)checkz6This command checks the meta-data of the package. z"perform some checks on the packagemetadatamVerify meta-datarestructuredtextrEChecks if long string meta-data syntax are reStructuredText-compliantstricts(Will exit with an error if a check failscCsd|_d|_d|_d|_dS)z Sets default values for options.rN)r%r"r( _warnings)rrrrinitialize_options1szcheck.initialize_optionscCsdS)Nr)rrrrfinalize_options8szcheck.finalize_optionscCs|jd7_tj||S)z*Counts the number of warnings that occurs.r+)r,rwarn)rmsgrrrr/;sz check.warncCsL|jr|j|jr0tr"|jn|jr0td|jrH|jdkrHtddS)zRuns the command.zThe docutils package is needed.rzPlease correct your package.N)r"check_metadatar% HAS_DOCUTILScheck_restructuredtextr(rr,)rrrrrun@s z check.runcCs|jj}g}x*dD]"}t||o(t||s|j|qW|rP|jddj||jrh|js|jdn"|j r|j s|jdn |jdd S)zEnsures that all required elements of meta-data are supplied. name, version, URL, (author and author_email) or (maintainer and maintainer_email)). Warns if any are missing. nameversionurlzmissing required meta-data: %sz, z)missing meta-data: if 'author' supplied, z#'author_email' must be supplied tooz-missing meta-data: if 'maintainer' supplied, z''maintainer_email' must be supplied tooz4missing meta-data: either (author and author_email) z%or (maintainer and maintainer_email) zmust be suppliedN)r5r6r7zLmissing meta-data: if 'author' supplied, 'author_email' must be supplied toozTmissing meta-data: if 'maintainer' supplied, 'maintainer_email' must be supplied toozYmissing meta-data: either (author and author_email) or (maintainer and maintainer_email) zimissing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied) distributionr"hasattrgetattrrr/joinZauthorZ author_emailZ maintainerZmaintainer_email)rr"Zmissingattrrrrr1Ps$ zcheck.check_metadatacCs\|jj}xL|j|D]>}|djd}|dkr:|d}nd|d|f}|j|qWdS)z4Checks if the long string fields are reST-compliant.r+lineNz %s (line %s))r8Zget_long_description_check_rst_datagetr/)rdataZwarningr=rrrr3ns  zcheck.check_restructuredtextcCst}t}tjtfdj}d|_d|_d|_t||j |j |j |j |j |jd}tj|||d}|j|d y|j||Wn:tk r}z|jjd d|difWYdd}~XnX|jS) z8Returns warnings when the provided data doesn't compile.)Z componentsN)rrrr)rr+z!Could not finish the parsing: %s.r>r>)rrrZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesr rrZwarning_streamrZerror_encodingZerror_encoding_error_handlerrdocumentZ note_sourceparseAttributeErrorr r)rrA source_pathparserZsettingsZreporterrDerrrr?ys*  $zcheck._check_rst_dataN)r"r#r$)r%r&r')r(r)r*)rrr __doc__ descriptionZ user_optionsZboolean_optionsr-r.r/r4r1r3r?rrrrr!$s  r!N)rJZdistutils.corerZdistutils.errorsrZdocutils.utilsrZdocutils.parsers.rstrZdocutilsrriorr r2 Exceptionr!rrrrs        __pycache__/bdist_wininst.cpython-36.opt-2.pyc000064400000017720147221452520015235 0ustar003 /f<@slddlZddlZddlmZddlmZddlmZmZddl Tddl m Z ddl m Z Gdd d eZdS) N)Command) get_platform) create_tree remove_tree)*)get_python_version)logc@seZdZdZdZd5dddefd7d9d:d;dd?d@dAdBg Zd dddgZd'd(Zd)d*Z d+d,Z d-d.Z dCd/d0Z d1d2Z d3d4ZdS)D bdist_wininstTz-create an executable installer for MS Windows bdist-dir=N1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s) keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archivetarget-version=z!require a specific python versionz on the target systemno-target-compilec/do not compile .py to .pyc on the target systemno-target-optimizeo;do not compile .py to .pyo (optimized) on the target system dist-dir=d-directory to put final built distributions inbitmap=b>bitmap to use for the installer instead of python-powered logotitle=t?title to display on the installer background instead of default skip-build2skip rebuilding everything (for testing/debugging)install-script=Ubasename of installation script to be run after installation or before deinstallationpre-install-script={Fully qualified filename of a script to be run before any files are installed. This script need not be in the distributionuser-access-control=specify Vista's UAC handling - 'none'/default=no handling, 'auto'=use UAC if target Python installed for all users, 'force'=always use UACcCsRd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ dS)Nr) bdist_dir plat_name keep_tempno_target_compileno_target_optimizetarget_versiondist_dirbitmaptitle skip_buildinstall_scriptpre_install_scriptuser_access_control)selfr57/usr/lib64/python3.6/distutils/command/bdist_wininst.pyinitialize_options<sz bdist_wininst.initialize_optionscCs|jdd |jdkrR|jr6|jr6|jjd}|j|_|jdj}tj j |d|_|j s^d|_ |j r|jj rt }|j r|j |krtd|f||_ |jdd d |jrx2|jjD]}|jtj j|krPqWtd|jdS) Nbdistr0ZwininstzMtarget version can only be %s, or the '--skip-build' option must be specifiedr-r(z(install_script '%s' not found in scripts)r0r0)r-r-)r(r()Zset_undefined_optionsr'r0r( distributionZget_command_objget_finalized_command bdist_baseospathjoinr,has_ext_modulesrZDistutilsOptionErrorr1scriptsbasename)r4r8r<Z short_versionscriptr5r5r6finalize_optionsLs4      zbdist_wininst.finalize_optionsc Cstjdkr&|jjs|jjr&td|js6|jd|jddd}|j |_ |j|_d|_ |j |_ |jd}d|_ d|_|jjr|j}|sd tjdd }d |j |f}|jd}tjj|jd ||_x4dD],}|j}|dkr|d}t|d||qWtjd|j |jtjjdtjj|j d|jtjd=ddlm}|} |jj } |j!| d|j d} |j"| | |j#|jjrt$} nd} |jj%j&d| |j'| ftj(d| tj)| |j*st+|j |j,ddS)Nwin32z^distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platformbuildinstall)Zreinit_subcommandsr install_libz%d.%dz.%s-%slibpurelibplatlibheadersrAdataz/Include/$dist_nameZinstall_zinstalling to %sZPURELIB)mktempzip)Zroot_diranyr zremoving temporary file '%s')dry_run)rLrMrNrArO)-sysplatformr:r@Zhas_c_librariesZDistutilsPlatformErrorr0Z run_commandZreinitialize_commandr'rootZwarn_dirr(compileoptimizer, version_infor;r=r>r?Z build_baseZ build_libuppersetattrrinfoZensure_finalizedinsertrunZtempfilerP get_fullnameZ make_archive create_exer.rZ dist_filesappendget_installer_filenamedebugremover)rrS) r4rGrIr,Zplat_specifierrFkeyvaluerPZarchive_basenamefullnamearcnameZ pyversionr5r5r6r^rsd                  zbdist_wininst.runc Cs`g}|jj}|jd|jpdd}dd}xJdD]B}t||d}|r2|d|j||f}|jd|||fq2W|jd|jr|jd|j|jd|||jd|j |jd|j |j r|jd|j |j r|jd|j |j p |jj }|jd||ddl }ddl} d|j|j | jf} |jd| dj|S)Nz [metadata]r9 cSs |jddS)Nriz\n)replace)sr5r5r6escapesz)bdist_wininst.get_inidata..escapeauthor author_email description maintainermaintainer_emailnameurlversionz %s: %sz%s=%sz [Setup]zinstall_script=%szinfo=%sztarget_compile=%dztarget_optimize=%dztarget_version=%szuser_access_control=%sztitle=%srzBuilt %s with distutils-%sz build_info=%s)rmrnrorprqrrrsrt)r:metadataraZlong_descriptiongetattr capitalizer1r*r+r,r3r/r_time distutilsZctime __version__r?) r4linesrur\rlrrrOr/rxryZ build_infor5r5r6 get_inidatas<   zbdist_wininst.get_inidatac Csddl}|j|j|j}|j|}|jd||rPt|dj}t|}nd}t|d} | j |j |rz| j |t |t r|j d}|d}|jrt|jddd } | jj d} WdQRX|| d }n|d}| j ||jd d t||} | j | | j t|djdS) Nrz creating %srbwbmbcsrzlatin-1)encodings zr?r-r()r4rgrr5r5r6rb&s  z$bdist_wininst.get_installer_filenamec Cs t}|jrl|j|krl|jdkr&d}q|jdkr6d}q|jdkrFd}q|jdkrVd}q|jdkrfd }qd }n@yd d lm}Wntk rd }YnX|jd d }|d}tjjt }|j dkr|j dddkr|j dd}nd}tjj |d||f}t |d}z|j S|jXdS)Nz2.4z6.0z7.1z2.5z8.0z3.2z9.0z3.4z10.0z14.0r)CRT_ASSEMBLY_VERSION.z.0rEwinr9zwininst-%s%s.exer})rr,Zmsvcrtr ImportError partitionr=r>dirname__file__r(r?rrclose) r4Z cur_versionZbvrmajorZ directoryZsfixfilenamefr5r5r6r3s8         zbdist_wininst.get_exe_bytes)r Nr Pkeep the pseudo-installation tree around after creating the distribution archive)r rr6require a specific python version on the target system)rNr)rrr)rrr)rrr)rrr)rrr)rNr )r!Nr")r#Nr$)r%Nr&)N)__name__ __module__ __qualname__Z _unsupportedrorZ user_optionsZboolean_optionsr7rDr^r|r`rbrr5r5r5r6r sP&Q. 5 r )rTr=Zdistutils.corerZdistutils.utilrZdistutils.dir_utilrrZdistutils.errorsZdistutils.sysconfigrryrr r5r5r5r6s    __pycache__/install_data.cpython-36.pyc000064400000004402147221452520014045 0ustar003 \ @s<dZddlZddlmZddlmZmZGdddeZdS)zdistutils.command.install_data Implements the Distutils 'install_data' command, for installing platform-independent data files.N)Command) change_root convert_pathc@sHeZdZdZdddgZdgZd d Zd dZddZddZ ddZ dS) install_datazinstall data files install-dir=dIbase directory for installing data files (default: installation base dir)root=Ns __pycache__/clean.cpython-36.opt-1.pyc000064400000004161147221452520013431 0ustar003 \ @sDdZddlZddlmZddlmZddlmZGdddeZdS)zBdistutils.command.clean Implements the Distutils 'clean' command.N)Command) remove_tree)logc@s>eZdZdZddddddgZdgZddZddZddZdS)cleanz-clean up temporary files from 'build' command build-base=b2base build directory (default: 'build.build-base') build-lib=Ns    __pycache__/__init__.cpython-36.opt-2.pyc000064400000000652147221452520014110 0ustar003 \@s.dddddddddd d d d d dddddgZdS)ZbuildZbuild_pyZ build_extZ build_clibZ build_scriptsZcleanZinstallZ install_libZinstall_headersZinstall_scriptsZ install_dataZsdistregisterZbdistZ bdist_dumbZ bdist_rpmZ bdist_wininstZcheckZuploadN)__all__rr2/usr/lib64/python3.6/distutils/command/__init__.pys$__pycache__/register.cpython-36.opt-2.pyc000064400000015753147221452520014205 0ustar003 \-@s`ddlZddlZddlZddlZddlmZddlmZddl Tddl m Z GdddeZ dS)N)warn) PyPIRCCommand)*)logc@seZdZdZejdd gZejdddgZdd d fgZd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZd!ddZdS)"registerz7register the distribution with the Python package indexlist-classifiersN list the valid Trove classifiersstrictBWill stop the registering if the meta-data are not fully compliantverifycheckcCsdS)NT)selfr r 2/usr/lib64/python3.6/distutils/command/register.pyszregister.cCstj|d|_d|_dS)Nr)rinitialize_optionslist_classifiersr )rr r rrs zregister.initialize_optionscCs*tj|d|jfdd}||jjd<dS)Nr)r restructuredtextr )rr)rfinalize_optionsr distributionZcommand_options)rZ check_optionsr r rr$s zregister.finalize_optionscCsX|j|jx|jD]}|j|qW|jr<|jn|jrL|jn|jdS)N) r _set_configZget_sub_commandsZ run_commandZdry_runverify_metadatar classifiers send_metadata)rZcmd_namer r rrun+s  z register.runcCs8tdt|jjd}|j|j|_d|_|jdS)Nzddistutils.command.register.check_metadata is deprecated, use the check command insteadr r)rPendingDeprecationWarningrZget_command_objZensure_finalizedr rr)rr r r rcheck_metadata:s zregister.check_metadatacCsz|j}|ikr@|d|_|d|_|d|_|d|_d|_n6|jd|jfkr^td|j|jdkrp|j|_d|_dS) Nusernamepassword repositoryrealmTZpypiz%s not found in .pypircF)Z _read_pypircrrr r! has_configZDEFAULT_REPOSITORY ValueError)rconfigr r rrDs     zregister._set_configcCs*|jd}tjj|}tj|j|dS)Nz?:action=list_classifiers)r urllibrequestZurlopenrinfo_read_pypi_response)rZurlZresponser r rrUs  zregister.classifierscCs&|j|jd\}}tjd||dS)Nr zServer response (%s): %s)post_to_serverbuild_post_datarr')rcoderesultr r rr\szregister.verify_metadatac Cs|jrd}|j}|j}n d}d}}dj}x:||krf|jdtjt}|sTd}q.||kr.tdq.W|dkr|x|std}qtWx|st j d}qWt j j }t j j|jd }|j|j||||j|jd |\}}|jd ||ftj|d kr|jr||j_nj|jd tj|jd|jtjd}x&|jdkr\td}|s8d}q8W|jdkr|j||n|dkrddi} d| d<| d<| d<d| d<x| dstd| d<qWx| d| dkrNx| dst j d| d<qWx| dst j d| d<qW| d| dkrd| d<d| d<tdqWx| dsltd| d<qRW|j| \}}|d krtjd ||ntjdtjdnT|d krdd!i} d| d<x| dstd"| d<qW|j| \}}tjd ||dS)#N1xz1 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: rZsubmitzServer response (%s): %szAI can store your PyPI login so future submissions will be faster.z (the login will be stored in %s)XZynzSave your login (y/N)?ny2z:actionusernamerZemailZconfirmz 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.3Zpassword_resetzYour email address: )r"rrsplitannouncerINFOinputprintgetpassr%r&ZHTTPPasswordMgrparseZurlparser Z add_passwordr!r)r*rZ _get_rc_filelowerZ _store_pypircr') rZchoicerrchoicesauthhostr+r,datar r rrcs                     zregister.send_metadatacCs|jj}|d|j|j|j|j|j|j|j|j |j |j |j |j |j|j|jd}|ds|ds|drd|d<|S)Nz1.0)z:actionmetadata_versionr6versionZsummaryZ home_pageZauthorZ author_emaillicense descriptionkeywordsplatformrZ download_urlprovidesrequires obsoletesrJrKrLz1.1rD)rZmetadataZget_nameZ get_versionZget_descriptionZget_urlZ get_contactZget_contact_emailZ get_licenceZget_long_descriptionZ get_keywordsZ get_platformsZget_classifiersZget_download_urlZ get_providesZ get_requiresZ get_obsoletes)ractionmetarCr r rr*s* zregister.build_post_datacCsd|kr$|jd|d|jftjd}d|}|d}tj}x|jD]\}}t|tgtffkrp|g}xZ|D]R}t|}|j ||j d||j d|j ||rv|dd krv|j d qvWqJW|j ||j d |j j d }d |tt |d } t jj|j|| } t jjt jj|d} d}y| j| } Wnxt jjk r} z$|jrl| jj}| j| jf} WYdd} ~ XnJt jjk r} zdt| f} WYdd} ~ XnX|jr|j| }d} |jrd jdd|ddf}|j|tj| S)Nr6zRegistering %s to %sz3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254z --z--z* Content-Disposition: form-data; name="%s"z r  zutf-8z/multipart/form-data; boundary=%s; charset=utf-8)z Content-typezContent-length)Z password_mgrr/ir0OK-K)r0rQ)r9r rr:ioStringIOitemstypestrwritegetvalueencodelenr%r&ZRequestZ build_openerZHTTPBasicAuthHandleropenerrorZ HTTPErrorZ show_responsefpreadr+msgZURLErrorr(join)rrCrAboundaryZ sep_boundaryZ end_boundaryZbodykeyvalueZheadersZreqopenerr,erbr r rr)sV         zregister.post_to_server)rNr)r Nr )N)__name__ __module__ __qualname__rGrZ user_optionsZboolean_optionsZ sub_commandsrrrrrrrrr*r)r r r rrs&  zr) r=rUZ urllib.parser%Zurllib.requestwarningsrZdistutils.corerZdistutils.errorsZ distutilsrrr r r rs   __pycache__/config.cpython-36.pyc000064400000024070147221452520012656 0ustar003 \3@sldZddlZddlZddlmZddlmZddlmZddl m Z ddd Z Gd d d eZ dd d Z dS)adistutils.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)czc++c @seZdZdZd>d?d@dAdBdCdDdEdFg ZddZddZddZd d!Zd"d#Z d$d%Z d&d'Z d(d)Z d*d+Z dGd-d.ZdHd/d0ZdId1d2ZdJd3d4ZdKd5d6ZdLd8d9Zdddgfd:d;ZdMd  r)LANG_EXTopenwriteclose)r&bodyheaderslangfilenamefileheaderr'r'r(_gen_temp_sourcefileks       zconfig._gen_temp_sourcefilecCs<|j|||}d}|jj||g|jj|||d||fS)Nz _configtest.i)r!)rDr%extendr Z preprocess)r&r>r?r!r@srcoutr'r'r( _preprocessxs zconfig._preprocesscCs\|j|||}|jr"t|d||jj|g\}|jj||g|jj|g|d||fS)Nzcompiling '%s':)r!)rDr$ dump_filer Zobject_filenamesr%rEcompile)r&r>r?r!r@rFobjr'r'r(_compileszconfig._compilec Csr|j||||\}}tjjtjj|d} |jj|g| |||d|jjdk r\| |jj} |jj | ||| fS)Nr)r"r#Z target_lang) rLr-pathsplitextbasenamer Zlink_executableZ exe_extensionr%append) r&r>r?r!r"r#r@rFrKprogr'r'r(_links    z config._linkc GsX|s|j}g|_tjddj|x0|D](}ytj|Wq(tk rNYq(Xq(WdS)Nz removing: %s )r%rinfojoinr-removeOSError)r& filenamesrAr'r'r(_cleans z config._cleanrc CsRddlm}|jd}y|j||||Wn|k rDd}YnX|j|S)aQConstruct 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)r5rZr6rHrY)r&r>r?r!r@rZokr'r'r(try_cpps  zconfig.try_cppc Csx|j|j||||\}}t|tr0tj|}t|}d} x&|j} | dkrPP|j| r>d} Pq>W|j |j | S)aConstruct 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) r6rHr*r+rerJr;readlinesearchr=rY) r&patternr>r?r!r@rFrGrBmatchliner'r'r( search_cpps    zconfig.search_cppc Csdddlm}|jy|j||||d}Wn|k rDd}YnXtj|rRdpTd|j|S)zwTry to compile a source file built from 'body' and 'headers'. Return true on success, false otherwise. r)rZTFzsuccess!zfailure.)r5rZr6rLrrTrY)r&r>r?r!r@rZr[r'r'r( try_compiles  zconfig.try_compilec Cspddlm}m}|jy|j||||||d} Wn||fk rPd} YnXtj| r^dp`d|j| S)zTry to compile and link a source file, built from 'body' and 'headers', to executable form. Return true on success, false otherwise. r)rZ LinkErrorTFzsuccess!zfailure.)r5rZrfr6rRrrTrY) r&r>r?r!r"r#r@rZrfr[r'r'r(try_links   zconfig.try_linkc Csddlm}m}|jy.|j||||||\} } } |j| gd} Wn||tfk rdd} YnXtj| rrdptd|j | S)zTry to compile, link to an executable, and run a program built from 'body' and 'headers'. Return true on success, false otherwise. r)rZrfTFzsuccess!zfailure.) r5rZrfr6rRZspawnrrrTrY) r&r>r?r!r"r#r@rZrfrFrKZexer[r'r'r(try_runs   zconfig.try_runrc Cst|jg}|r|jd||jd|r<|jd|n|jd||jddj|d}|j|||||S)aDetermine 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;}r8)r6rPrUrg) r&funcr?r!r"r#ZdeclZcallr>r'r'r( check_funcs   zconfig.check_funccCs |j|jd|||g||S)aDetermine 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. zint main (void) { })r6rg)r&Zlibraryr#r?r!Zother_librariesr'r'r( check_lib6s  zconfig.check_libcCs|jd|g|dS)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 */)r>r?r!)r\)r&rCr!r#r@r'r'r( check_headerDs zconfig.check_header)rNr )r Nr )r r r)rrr)rrr)rrr)rrr)rNr)rNr)NNNr)NNNr)NNr)NNNNr)NNNNr)NNNNrr)NNr)__name__ __module__ __qualname__ descriptionZ user_optionsr)r/r0r6rDrHrLrRrYr\rdrergrhrkrlrmr'r'r'r(rsT         rc CsJ|dkrtjd|n tj|t|}ztj|jWd|jXdS)zjDumps a file content into log.info. If head is not None, will be dumped before the file content. Nz%s)rrTr;readr=)rAheadrBr'r'r(rINs rI)N)__doc__r-r^Zdistutils.corerZdistutils.errorsrZdistutils.sysconfigrZ distutilsrr:rrIr'r'r'r( s     ;__pycache__/build_clib.cpython-36.opt-2.pyc000064400000010501147221452520014433 0ustar003 \V@sPddlZddlmZddlTddlmZddlmZddZGdd d eZ dS) N)Command)*)customize_compiler)logcCsddlm}|dS)Nr)show_compilers)distutils.ccompilerr)rr4/usr/lib64/python3.6/distutils/command/build_clib.pyrs rc@sleZdZdZd"d#d$d%d&gZdd gZdddefgZddZddZ ddZ ddZ ddZ ddZ d d!ZdS)' build_clibz/build C/C++ libraries used by Python extensions build-clib=b%directory to build C/C++ libraries to build-temp=t,directory to put temporary build by-productsdebugg"compile with debugging informationforcef2forcibly build everything (ignore file timestamps) compiler=cspecify the compiler typez help-compilerNzlist available compilerscCs:d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) r build_temp libraries include_dirsdefineundefrrcompiler)selfrrr initialize_options4szbuild_clib.initialize_optionscCsh|jdddd d d |jj|_|jr0|j|j|jdkrH|jjpDg|_t|jtrd|jjtj |_dS) NZbuildrr rrr)rr )rr)rr)rr)rr) Zset_undefined_optionsZ distributionrcheck_library_listr isinstancestrsplitospathsep)r rrr finalize_optionsDs    zbuild_clib.finalize_optionscCs|js dSddlm}||j|j|jd|_t|j|jdk rN|jj|j|j dk rzx |j D]\}}|jj ||q`W|j dk rx|j D]}|jj |qW|j |jdS)Nr) new_compiler)rdry_runr)rrr)rr*rrrZset_include_dirsrZ define_macrorZundefine_macrobuild_libraries)r r)namevalueZmacrorrr run^s        zbuild_clib.runcCst|tstdx|D]|}t|t rs    __pycache__/check.cpython-36.opt-1.pyc000064400000012127147221452520013425 0ustar003 \x @sdZddlmZddlmZyTddlmZddlmZddl m Z ddl m Z ddl m Z Gd d d eZd ZWnek rd ZYnXGd ddeZdS)zCdistutils.command.check Implements the Distutils 'check' command. )Command)DistutilsSetupError)Reporter)Parser)frontend)nodes)StringIOc@seZdZd ddZddZdS) SilentReporterNrasciireplacec Cs"g|_tj||||||||dS)N)messagesr__init__)selfsource report_level halt_levelstreamdebugencoding error_handlerr/usr/lib64/python3.6/check.pyr szSilentReporter.__init__cOs6|jj||||ftj|f|||j|d|S)N)leveltype)r appendrsystem_messageZlevels)rrmessageZchildrenkwargsrrrrszSilentReporter.system_message)Nrr r )__name__ __module__ __qualname__r rrrrrr s r TFc@s`eZdZdZdZdddgZddd gZd d ZddZddZ ddZ ddZ ddZ ddZ dS)checkz6This command checks the meta-data of the package. z"perform some checks on the packagemetadatamVerify meta-datarestructuredtextrEChecks if long string meta-data syntax are reStructuredText-compliantstricts(Will exit with an error if a check failscCsd|_d|_d|_d|_dS)z Sets default values for options.rN)r%r"r( _warnings)rrrrinitialize_options1szcheck.initialize_optionscCsdS)Nr)rrrrfinalize_options8szcheck.finalize_optionscCs|jd7_tj||S)z*Counts the number of warnings that occurs.r+)r,rwarn)rmsgrrrr/;sz check.warncCsL|jr|j|jr0tr"|jn|jr0td|jrH|jdkrHtddS)zRuns the command.zThe docutils package is needed.rzPlease correct your package.N)r"check_metadatar% HAS_DOCUTILScheck_restructuredtextr(rr,)rrrrrun@s z check.runcCs|jj}g}x*dD]"}t||o(t||s|j|qW|rP|jddj||jrh|js|jdn"|j r|j s|jdn |jdd S)zEnsures that all required elements of meta-data are supplied. name, version, URL, (author and author_email) or (maintainer and maintainer_email)). Warns if any are missing. nameversionurlzmissing required meta-data: %sz, z)missing meta-data: if 'author' supplied, z#'author_email' must be supplied tooz-missing meta-data: if 'maintainer' supplied, z''maintainer_email' must be supplied tooz4missing meta-data: either (author and author_email) z%or (maintainer and maintainer_email) zmust be suppliedN)r5r6r7zLmissing meta-data: if 'author' supplied, 'author_email' must be supplied toozTmissing meta-data: if 'maintainer' supplied, 'maintainer_email' must be supplied toozYmissing meta-data: either (author and author_email) or (maintainer and maintainer_email) zimissing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied) distributionr"hasattrgetattrrr/joinZauthorZ author_emailZ maintainerZmaintainer_email)rr"Zmissingattrrrrr1Ps$ zcheck.check_metadatacCs\|jj}xL|j|D]>}|djd}|dkr:|d}nd|d|f}|j|qWdS)z4Checks if the long string fields are reST-compliant.r+lineNz %s (line %s))r8Zget_long_description_check_rst_datagetr/)rdataZwarningr=rrrr3ns  zcheck.check_restructuredtextcCst}t}tjtfdj}d|_d|_d|_t||j |j |j |j |j |jd}tj|||d}|j|d y|j||Wn:tk r}z|jjd d|difWYdd}~XnX|jS) z8Returns warnings when the provided data doesn't compile.)Z componentsN)rrrr)rr+z!Could not finish the parsing: %s.r>r>)rrrZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesr rrZwarning_streamrZerror_encodingZerror_encoding_error_handlerrdocumentZ note_sourceparseAttributeErrorr r)rrA source_pathparserZsettingsZreporterrDerrrr?ys*  $zcheck._check_rst_dataN)r"r#r$)r%r&r')r(r)r*)rrr __doc__ descriptionZ user_optionsZboolean_optionsr-r.r/r4r1r3r?rrrrr!$s  r!N)rJZdistutils.corerZdistutils.errorsrZdocutils.utilsrZdocutils.parsers.rstrZdocutilsrriorr r2 Exceptionr!rrrrs        __pycache__/sdist.cpython-36.opt-2.pyc000064400000023302147221452520013474 0ustar003 \E@sddlZddlZddlTddlmZddlmZddlmZddlm Z m Z m Z m Z ddl mZddlTddlmZdd lmZdd lmZd d ZGd ddeZdS)N)*)glob)warn)Command)dir_utildep_util file_util archive_util)TextFile)FileList)log) convert_pathcCsdddlm}ddlm}g}x,|jD] }|jd|d||dfq&W|j||jddS)Nr) FancyGetopt)ARCHIVE_FORMATSzformats=z.List of available source distribution formats:)Zdistutils.fancy_getoptrZdistutils.archive_utilrkeysappendsortZ print_help)rrformatsformatr//usr/lib64/python3.6/distutils/command/sdist.py show_formatss   rc@seZdZdZddZdJdKdLdMdNdOdPdQdRdTdUdVdWdXgZd ddddd"gZd*d d+efgZd dd,Z d-efgZ d.d/Z d0d1Z d2d3Z d4d5Zd6d7Zd8d9Zd:d;Zdd?Zd@dAZdBdCZdDdEZdFdGZdHdIZd S)Ysdistz6create a source distribution (tarball, zip file, etc.)cCs|jS)N)metadata_check)selfrrrchecking_metadata%szsdist.checking_metadata template=t5name of manifest template file [default: MANIFEST.in] manifest=m)name of manifest file [default: MANIFEST] use-defaultsNRinclude the default file set in the manifest [default; disable with --no-defaults] no-defaults"don't include the default file setprunespecifically exclude files/directories that should not be distributed (build tree, RCS/CVS dirs, etc.) [default; disable with --no-prune]no-prune$don't automatically exclude anything manifest-onlyoEjust regenerate the manifest and then stop (implies --force-manifest)force-manifestfkforcibly regenerate the manifest and carry on as usual. Deprecated: now the manifest is always regenerated.formats=6formats for source distribution (comma-separated list) keep-tempkz1keep the distribution tree around after creating zarchive file(s) dist-dir=dFdirectory to put the source distribution archive(s) in [default: dist]metadata-check[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=gAGroup name used when creating a tar file [default: current group]z help-formatsz#list available distribution formats)z no-defaultszno-prunecheckcCsTd|_d|_d|_d|_d|_d|_dg|_d|_d|_d|_ d|_ d|_ d|_ dS)NrZgztar) templatemanifest use_defaultsr' manifest_onlyZforce_manifestr keep_tempdist_dir archive_filesrownergroup)rrrrinitialize_options`szsdist.initialize_optionscCsZ|jdkrd|_|jdkr d|_|jdtj|j}|rFtd||jdkrVd|_dS)NZMANIFESTz MANIFEST.inrzunknown archive format '%s'Zdist)rCrBZensure_string_listr Zcheck_archive_formatsrZDistutilsOptionErrorrG)rZ bad_formatrrrfinalize_optionsws      zsdist.finalize_optionscCsBt|_x|jD]}|j|qW|j|jr6dS|jdS)N)r filelistZget_sub_commandsZ run_command get_file_listrEmake_distribution)rZcmd_namerrrrunsz sdist.runcCs*tdt|jjd}|j|jdS)Nzadistutils.command.sdist.check_metadata is deprecated, use the check command insteadr@)rPendingDeprecationWarning distributionZget_command_objZensure_finalizedrP)rr@rrrcheck_metadatas  zsdist.check_metadatacCstjj|j}| r<|jr<|j|jj|jjdS|sP|j d|j|jj |j rh|j |rt|j |jr|j|jj|jj|jdS)Nz&manifest template '%s' does not exist z(using default file list)z?manifest template '%s' does not exist (using default file list))ospathisfilerB_manifest_is_not_generated read_manifestrMrZremove_duplicatesrfindallrD add_defaults read_templater'prune_file_listwrite_manifest)rZtemplate_existsrrrrNs(      zsdist.get_file_listcCs2d|jjg}x|D]}t|trn|}d}x*|D]"}tjj|r.d}|jj|Pq.W|s|j ddj |qtjj|r|jj|q|j d|qWdd g}x*|D]"}t tjj t |}|jj|qW|jd }|jjr|jj|jx>|jD]4\} } } } x$| D]} |jjtjj | | q WqW|jjrx||jjD]p}t|tr|t|}tjj |r|jj|n:|\}} x0| D](}t|}tjj |r|jj|qWqHW|jjr|jd }|jj|j|jjr|jd }|jj|j|jjr.|jd }|jj|jdS)NREADME README.txtFTz,standard file not found: should have one of z, zstandard file '%s' not foundz test/test*.pyz setup.cfgbuild_py build_ext build_clib build_scripts)r^r_)rRZ script_name isinstancetuplerTrUexistsrMrrjoinfilterrVrextendget_finalized_commandZhas_pure_modulesZget_source_filesZ data_filesZhas_data_filesstrr Zhas_ext_modulesZhas_c_librariesZ has_scripts)rZ standardsfnZaltsZgot_itZoptionalpatternfilesr`ZpkgZsrc_dirZ build_dir filenamesfilenameitemdirnamer/rarbrcrrrrZs\           "         zsdist.add_defaultscCstjd|jt|jddddddd}zlxf|j}|dkrr?)__name__ __module__ __qualname__Z descriptionrZ user_optionsZboolean_optionsrZ help_optionsZ negative_optZ sub_commandsrKrLrPrSrNrZr[r\r]rWrXrrOrrrrrr!sj  (P *r)rTr~typesrwarningsrZdistutils.corerZ distutilsrrrr Zdistutils.text_filer Zdistutils.errorsZdistutils.filelistr r Zdistutils.utilr rrrrrrs       build.py000064400000013164147221452520006226 0ustar00"""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.' 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." 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: 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), ] install_headers.py000064400000002422147221452520010263 0ustar00"""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 bdist_msi.py000064400000104641147221452520007105 0ustar00# Copyright (C) 2005, 2006 Martin von Löwis # Licensed to PSF under a Contributor Agreement. # The bdist_wininst command proper # based on bdist_wininst """ Implements the bdist_msi command. """ import sys, os 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 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") f = open(scriptfn, "w") # 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 # """ # f.write('rem ="""\n%1 %0\nexit\n"""\n') f.write(open(self.pre_install_script).read()) f.close() 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 install_data.py000064400000005406147221452520007566 0ustar00"""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 bdist_dumb.py000064400000011461147221452520007241 0ustar00"""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) command_template000064400000001171147221452520010004 0ustar00"""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): config.py000064400000031436147221452520006376 0ustar00"""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] file = open(filename, "w") 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") file.close() 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) file = open(out) match = False while True: line = file.readline() if line == '': break if pattern.search(line): match = True break file.close() 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()