#!/usr/bin/env pythonimport osimport sysimport textwrapimport setuptoolsfrom setuptools.command.install import installhere = os.path.dirname(__file__)package_data = dict(setuptools=['script (dev).tmpl', 'script.tmpl', 'site-patch.py'],)force_windows_specific_files = (os.environ.get("SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES", "1").lower()not in ("", "0", "false", "no"))include_windows_files = sys.platform == 'win32' or force_windows_specific_filesif include_windows_files:package_data.setdefault('setuptools', []).extend(['*.exe'])package_data.setdefault('setuptools.command', []).extend(['*.xml'])def pypi_link(pkg_filename):"""Given the filename, including md5 fragment, construct thedependency link for PyPI."""root = 'https://files.pythonhosted.org/packages/source'name, sep, rest = pkg_filename.partition('-')parts = root, name[0], name, pkg_filenamereturn '/'.join(parts)class install_with_pth(install):"""Custom install command to install a .pth file for distutils patching.This hack is necessary because there's no standard way to install behavioron startup (and it's debatable if there should be one). This hack (ab)usesthe `extra_path` behavior in Setuptools to install a `.pth` file withimplicit behavior on startup to give higher precedence to the local versionof `distutils` over the version from the standard library.Please do not replicate this behavior."""_pth_name = 'distutils-precedence'_pth_contents = textwrap.dedent("""import osvar = 'SETUPTOOLS_USE_DISTUTILS'enabled = os.environ.get(var, 'local') == 'local'enabled and __import__('_distutils_hack').add_shim()""").lstrip().replace('\n', '; ')def initialize_options(self):install.initialize_options(self)self.extra_path = self._pth_name, self._pth_contentsdef finalize_options(self):install.finalize_options(self)self._restore_install_lib()def _restore_install_lib(self):"""Undo secondary effect of `extra_path` adding to `install_lib`"""suffix = os.path.relpath(self.install_lib, self.install_libbase)if suffix.strip() == self._pth_contents.strip():self.install_lib = self.install_libbasesetup_params = dict(cmdclass={'install': install_with_pth},package_data=package_data,)if __name__ == '__main__':# allow setup.py to run from another directoryhere and os.chdir(here)dist = setuptools.setup(**setup_params)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。