同步操作将从 PaddlePaddle/Paddle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import subprocessimport osimport os.pathimport errnoimport reimport shutilimport sysimport fnmatchimport errnoimport platformfrom contextlib import contextmanagerfrom setuptools import Commandfrom setuptools import setup, Distribution, Extensionfrom setuptools.command.install import install as InstallCommandBaseclass BinaryDistribution(Distribution):def has_ext_modules(foo):return TrueRC = 0ext_name = '.dll' if os.name == 'nt' else ('.dylib' if sys.platform == 'darwin' else '.so')def git_commit():try:cmd = ['git', 'rev-parse', 'HEAD']git_commit = subprocess.Popen(cmd, stdout = subprocess.PIPE,cwd="@PADDLE_SOURCE_DIR@").communicate()[0].strip()except:git_commit = 'Unknown'git_commit = git_commit.decode()return str(git_commit)def _get_version_detail(idx):assert idx < 3, "vesion info consists of %(major)d.%(minor)d.%(patch)d, \so detail index must less than 3"if re.match('@TAG_VERSION_REGEX@', '@PADDLE_VERSION@'):version_details = '@PADDLE_VERSION@'.split('.')if len(version_details) >= 3:return version_details[idx]return 0def get_major():return int(_get_version_detail(0))def get_minor():return int(_get_version_detail(1))def get_patch():return str(_get_version_detail(2))def get_cuda_version():if '@WITH_GPU@' == 'ON':return '@CUDA_VERSION@'else:return 'False'def get_cudnn_version():if '@WITH_GPU@' == 'ON':temp_cudnn_version = ''if '@CUDNN_MAJOR_VERSION@':temp_cudnn_version += '@CUDNN_MAJOR_VERSION@'if '@CUDNN_MINOR_VERSION@':temp_cudnn_version += '.@CUDNN_MINOR_VERSION@'if '@CUDNN_PATCHLEVEL_VERSION@':temp_cudnn_version += '.@CUDNN_PATCHLEVEL_VERSION@'return temp_cudnn_versionelse:return 'False'def is_taged():try:cmd = ['git', 'describe', '--exact-match', '--tags', 'HEAD', '2>/dev/null']git_tag = subprocess.Popen(cmd, stdout = subprocess.PIPE, cwd="@PADDLE_SOURCE_DIR@").communicate()[0].strip()git_tag = git_tag.decode()except:return Falseif str(git_tag).replace('v', '') == '@PADDLE_VERSION@':return Trueelse:return Falsedef write_version_py(filename='paddle/version/__init__.py'):cnt = '''# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY#full_version = '%(major)d.%(minor)d.%(patch)s'major = '%(major)d'minor = '%(minor)d'patch = '%(patch)s'rc = '%(rc)d'cuda_version = '%(cuda)s'cudnn_version = '%(cudnn)s'istaged = %(istaged)scommit = '%(commit)s'with_mkl = '%(with_mkl)s'__all__ = ['cuda', 'cudnn', 'show']def show():"""Get the version of paddle if `paddle` package if tagged. Otherwise, output the corresponding commit id.Returns:If paddle package is not tagged, the commit-id of paddle will be output.Otherwise, the following information will be output.full_version: version of paddlemajor: the major version of paddleminor: the minor version of paddlepatch: the patch level version of paddlerc: whether it's rc versioncuda: the cuda version of package. It will return `False` if CPU version paddle package is installedcudnn: the cudnn version of package. It will return `False` if CPU version paddle package is installedExamples:.. code-block:: pythonimport paddle# Case 1: paddle is tagged with 2.2.0paddle.version.show()# full_version: 2.2.0# major: 2# minor: 2# patch: 0# rc: 0# cuda: '10.2'# cudnn: '7.6.5'# Case 2: paddle is not taggedpaddle.version.show()# commit: cfa357e984bfd2ffa16820e354020529df434f7d# cuda: '10.2'# cudnn: '7.6.5'"""if istaged:print('full_version:', full_version)print('major:', major)print('minor:', minor)print('patch:', patch)print('rc:', rc)else:print('commit:', commit)print('cuda:', cuda_version)print('cudnn:', cudnn_version)def mkl():return with_mkldef cuda():"""Get cuda version of paddle package.Returns:string: Return the version information of cuda. If paddle package is CPU version, it will return False.Examples:.. code-block:: pythonimport paddlepaddle.version.cuda()# '10.2'"""return cuda_versiondef cudnn():"""Get cudnn version of paddle package.Returns:string: Return the version information of cudnn. If paddle package is CPU version, it will return False.Examples:.. code-block:: pythonimport paddlepaddle.version.cudnn()# '7.6.5'"""return cudnn_version'''commit = git_commit()dirname = os.path.dirname(filename)try:os.makedirs(dirname)except OSError as e:if e.errno != errno.EEXIST:raisewith open(filename, 'w') as f:f.write(cnt % {'major': get_major(),'minor': get_minor(),'patch': get_patch(),'rc': RC,'version': '${PADDLE_VERSION}','cuda': get_cuda_version(),'cudnn': get_cudnn_version(),'commit': commit,'istaged': is_taged(),'with_mkl': '@WITH_MKL@'})write_version_py(filename='@PADDLE_BINARY_DIR@/python/paddle/version/__init__.py')def write_cuda_env_config_py(filename='paddle/cuda_env.py'):cnt = ""if '${JIT_RELEASE_WHL}' == 'ON':cnt = '''# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY#import osos.environ['CUDA_CACHE_MAXSIZE'] = '805306368''''with open(filename, 'w') as f:f.write(cnt)write_cuda_env_config_py(filename='@PADDLE_BINARY_DIR@/python/paddle/cuda_env.py')def write_distributed_training_mode_py(filename='paddle/fluid/incubate/fleet/parameter_server/version.py'):cnt = '''from __future__ import print_function# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PYfrom paddle.fluid.incubate.fleet.base.mode import ModeBUILD_MODE=Mode.%(mode)sdef is_transpiler():return Mode.TRANSPILER == BUILD_MODE'''dirname = os.path.dirname(filename)try:os.makedirs(dirname)except OSError as e:if e.errno != errno.EEXIST:raisewith open(filename, 'w') as f:f.write(cnt % {'mode': 'PSLIB' if '${WITH_PSLIB}' == 'ON' else 'TRANSPILER'})write_distributed_training_mode_py(filename='@PADDLE_BINARY_DIR@/python/paddle/fluid/incubate/fleet/parameter_server/version.py')packages=['paddle','paddle.libs','paddle.utils','paddle.utils.gast','paddle.utils.cpp_extension','paddle.dataset','paddle.reader','paddle.distributed','paddle.distributed.metric','paddle.distributed.ps','paddle.distributed.ps.utils','paddle.incubate','paddle.incubate.autograd','paddle.incubate.optimizer','paddle.incubate.checkpoint','paddle.incubate.operators','paddle.incubate.tensor','paddle.incubate.multiprocessing','paddle.incubate.nn','paddle.incubate.passes','paddle.distribution','paddle.distributed.sharding','paddle.distributed.fleet','paddle.distributed.launch','paddle.distributed.launch.context','paddle.distributed.launch.controllers','paddle.distributed.launch.job','paddle.distributed.launch.plugins','paddle.distributed.launch.utils','paddle.distributed.fleet.base','paddle.distributed.fleet.elastic','paddle.distributed.fleet.meta_optimizers','paddle.distributed.fleet.meta_optimizers.sharding','paddle.distributed.fleet.meta_optimizers.ascend','paddle.distributed.fleet.meta_optimizers.dygraph_optimizer','paddle.distributed.fleet.runtime','paddle.distributed.fleet.dataset','paddle.distributed.fleet.data_generator','paddle.distributed.fleet.metrics','paddle.distributed.fleet.proto','paddle.distributed.fleet.utils','paddle.distributed.fleet.meta_parallel','paddle.distributed.fleet.meta_parallel.pp_utils','paddle.distributed.fleet.meta_parallel.sharding','paddle.distributed.fleet.meta_parallel.parallel_layers','paddle.distributed.auto_parallel','paddle.distributed.auto_parallel.operators','paddle.distributed.auto_parallel.tuner','paddle.distributed.auto_parallel.cost','paddle.distributed.passes','paddle.framework','paddle.jit','paddle.jit.dy2static','paddle.inference','paddle.inference.contrib','paddle.inference.contrib.utils','paddle.fluid','paddle.fluid.inference','paddle.fluid.dygraph','paddle.fluid.dygraph.dygraph_to_static','paddle.fluid.dygraph.amp','paddle.fluid.proto','paddle.fluid.proto.profiler','paddle.fluid.distributed','paddle.fluid.layers','paddle.fluid.dataloader','paddle.fluid.contrib','paddle.fluid.contrib.decoder','paddle.fluid.contrib.quantize','paddle.fluid.contrib.slim','paddle.fluid.contrib.slim.quantization','paddle.fluid.contrib.slim.quantization.imperative','paddle.fluid.contrib.extend_optimizer','paddle.fluid.contrib.mixed_precision','paddle.fluid.contrib.mixed_precision.bf16','paddle.fluid.contrib.layers','paddle.fluid.contrib.sparsity','paddle.fluid.transpiler','paddle.fluid.transpiler.details','paddle.fluid.incubate','paddle.fluid.incubate.data_generator','paddle.fluid.incubate.fleet','paddle.fluid.incubate.checkpoint','paddle.fluid.incubate.fleet.base','paddle.fluid.incubate.fleet.parameter_server','paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler','paddle.fluid.incubate.fleet.parameter_server.pslib','paddle.fluid.incubate.fleet.parameter_server.ir','paddle.fluid.incubate.fleet.collective','paddle.fluid.incubate.fleet.utils','paddle.amp','paddle.cost_model','paddle.hapi','paddle.vision','paddle.vision.models','paddle.vision.transforms','paddle.vision.datasets','paddle.text','paddle.text.datasets','paddle.incubate','paddle.incubate.nn','paddle.incubate.nn.functional','paddle.incubate.nn.layer','paddle.incubate.optimizer.functional','paddle.io','paddle.optimizer','paddle.nn','paddle.nn.functional','paddle.nn.layer','paddle.nn.quant','paddle.nn.initializer','paddle.nn.utils','paddle.metric','paddle.static','paddle.static.nn','paddle.static.amp','paddle.static.sparsity','paddle.tensor','paddle.onnx','paddle.autograd','paddle.device','paddle.device.cuda','paddle.version','paddle.profiler','paddle.sparse','paddle.sparse.layer','paddle.sparse.functional',]with open('@PADDLE_SOURCE_DIR@/python/requirements.txt') as f:setup_requires = f.read().splitlines()# Note(wangzhongpu):# When compiling paddle under python36, the dependencies belonging to python2.7 will be imported, resulting in errors when installing paddleif sys.version_info >= (3,6) and sys.version_info < (3,7):setup_requires_tmp = []for setup_requires_i in setup_requires:if "<\"3.6\"" in setup_requires_i or "<\"3.5\"" in setup_requires_i or "<=\"3.5\"" in setup_requires_i:continuesetup_requires_tmp+=[setup_requires_i]setup_requires = setup_requires_tmpif sys.version_info >= (3,5) and sys.version_info < (3,6):setup_requires_tmp = []for setup_requires_i in setup_requires:if "<\"3.5\"" in setup_requires_i:continuesetup_requires_tmp+=[setup_requires_i]setup_requires = setup_requires_tmpif sys.version_info >= (3,7):setup_requires_tmp = []for setup_requires_i in setup_requires:if "<\"3.6\"" in setup_requires_i or "<=\"3.6\"" in setup_requires_i or "<\"3.5\"" in setup_requires_i or "<=\"3.5\"" in setup_requires_i or "<\"3.7\"" in setup_requires_i:continuesetup_requires_tmp+=[setup_requires_i]setup_requires = setup_requires_tmp# the prefix is sys.prefix which should always be usrpaddle_bins = ''if not '${WIN32}':paddle_bins = ['${PADDLE_BINARY_DIR}/paddle/scripts/paddle']if os.name != 'nt':package_data={'paddle.fluid': ['${FLUID_CORE_NAME}' + '.so']}else:package_data={'paddle.fluid': ['${FLUID_CORE_NAME}' + '.pyd', '${FLUID_CORE_NAME}' + '.lib']}package_data['paddle.fluid'] += ['${PADDLE_BINARY_DIR}/python/paddle/cost_model/static_op_benchmark.json']if '${HAS_NOAVX_CORE}' == 'ON':package_data['paddle.fluid'] += ['core_noavx' + ('.so' if os.name != 'nt' else '.pyd')]package_dir={'': '${PADDLE_BINARY_DIR}/python',# The paddle.fluid.proto will be generated while compiling.# So that package points to other directory.'paddle.fluid.proto.profiler': '${PADDLE_BINARY_DIR}/paddle/fluid/platform','paddle.fluid.proto': '${PADDLE_BINARY_DIR}/paddle/fluid/framework','paddle.fluid': '${PADDLE_BINARY_DIR}/python/paddle/fluid',}# put all thirdparty libraries in paddle.libslibs_path='${PADDLE_BINARY_DIR}/python/paddle/libs'package_data['paddle.libs']= []package_data['paddle.libs']=[('libwarpctc' if os.name != 'nt' else 'warpctc') + ext_name]shutil.copy('${WARPCTC_LIBRARIES}', libs_path)package_data['paddle.libs']+=[os.path.basename('${LAPACK_LIB}'),os.path.basename('${BLAS_LIB}'),os.path.basename('${GFORTRAN_LIB}'),os.path.basename('${GNU_RT_LIB_1}')]shutil.copy('${BLAS_LIB}', libs_path)shutil.copy('${LAPACK_LIB}', libs_path)shutil.copy('${GFORTRAN_LIB}', libs_path)shutil.copy('${GNU_RT_LIB_1}', libs_path)if not sys.platform.startswith("linux"):package_data['paddle.libs']+=[os.path.basename('${GNU_RT_LIB_2}')]shutil.copy('${GNU_RT_LIB_2}', libs_path)if '${WITH_MKL}' == 'ON':shutil.copy('${MKLML_SHARED_LIB}', libs_path)shutil.copy('${MKLML_SHARED_IOMP_LIB}', libs_path)package_data['paddle.libs']+=[('libmklml_intel' if os.name != 'nt' else 'mklml') + ext_name, ('libiomp5' if os.name != 'nt' else 'libiomp5md') + ext_name]else:if os.name == 'nt':# copy the openblas.dllshutil.copy('${OPENBLAS_SHARED_LIB}', libs_path)package_data['paddle.libs'] += ['openblas' + ext_name]elif os.name == 'posix' and platform.machine() == 'aarch64' and '${OPENBLAS_LIB}'.endswith('so'):# copy the libopenblas.so on linux+aarch64# special: core_noavx.so depends on 'libopenblas.so.0', not 'libopenblas.so'if os.path.exists('${OPENBLAS_LIB}' + '.0'):shutil.copy('${OPENBLAS_LIB}' + '.0', libs_path)package_data['paddle.libs'] += ['libopenblas.so.0']if '${WITH_LITE}' == 'ON':shutil.copy('${LITE_SHARED_LIB}', libs_path)package_data['paddle.libs']+=['libpaddle_full_api_shared' + ext_name]if '${LITE_WITH_NNADAPTER}' == 'ON':shutil.copy('${LITE_NNADAPTER_LIB}', libs_path)package_data['paddle.libs']+=['libnnadapter' + ext_name]if '${NNADAPTER_WITH_HUAWEI_ASCEND_NPU}' == 'ON':shutil.copy('${LITE_NNADAPTER_NPU_LIB}', libs_path)package_data['paddle.libs']+=['libnnadapter_driver_huawei_ascend_npu' + ext_name]if '${WITH_CINN}' == 'ON':shutil.copy('${CINN_LIB_LOCATION}/${CINN_LIB_NAME}', libs_path)shutil.copy('${CINN_INCLUDE_DIR}/cinn/runtime/cuda/cinn_cuda_runtime_source.cuh', libs_path)package_data['paddle.libs']+=['libcinnapi.so']package_data['paddle.libs']+=['cinn_cuda_runtime_source.cuh']if '${WITH_PSLIB}' == 'ON':shutil.copy('${PSLIB_LIB}', libs_path)if os.path.exists('${PSLIB_VERSION_PY}'):shutil.copy('${PSLIB_VERSION_PY}', '${PADDLE_BINARY_DIR}/python/paddle/fluid/incubate/fleet/parameter_server/pslib/')package_data['paddle.libs'] += ['libps' + ext_name]if '${WITH_MKLDNN}' == 'ON':if '${CMAKE_BUILD_TYPE}' == 'Release' and os.name != 'nt':# only change rpath in Release mode.# TODO(typhoonzero): use install_name_tool to patch mkl libs once# we can support mkl on mac.## change rpath of libdnnl.so.1, add $ORIGIN/ to it.# The reason is that all thirdparty libraries in the same directory,# thus, libdnnl.so.1 will find libmklml_intel.so and libiomp5.so.command = "patchelf --set-rpath '$ORIGIN/' ${MKLDNN_SHARED_LIB}"if os.system(command) != 0:raise Exception("patch libdnnl.so failed, command: %s" % command)shutil.copy('${MKLDNN_SHARED_LIB}', libs_path)if os.name != 'nt':shutil.copy('${MKLDNN_SHARED_LIB_1}', libs_path)shutil.copy('${MKLDNN_SHARED_LIB_2}', libs_path)package_data['paddle.libs']+=['libmkldnn.so.0', 'libdnnl.so.1', 'libdnnl.so.2']else:package_data['paddle.libs']+=['mkldnn.dll']if '${WITH_ONNXRUNTIME}' == 'ON':shutil.copy('${ONNXRUNTIME_SHARED_LIB}', libs_path)if os.name == 'nt':shutil.copy('${PADDLE2ONNX_SHARED_LIB}', libs_path)package_data['paddle.libs']+=['paddle2onnx.dll', 'onnxruntime.dll']else:shutil.copy('${PADDLE2ONNX_LIB}', libs_path)if sys.platform == 'darwin':package_data['paddle.libs']+=['libpaddle2onnx.dylib', 'libonnxruntime.1.10.0.dylib']else:package_data['paddle.libs']+=['libpaddle2onnx.so', 'libonnxruntime.so.1.10.0']if '${WITH_XPU}' == 'ON':# only change rpath in Release mode,if '${CMAKE_BUILD_TYPE}' == 'Release':if os.name != 'nt':if "@APPLE@" == "1":command = "install_name_tool -id \"@loader_path/\" ${XPU_API_LIB}"else:command = "patchelf --set-rpath '$ORIGIN/' ${XPU_API_LIB}"if os.system(command) != 0:raise Exception("patch ${XPU_API_LIB} failed, command: %s" % command)shutil.copy('${XPU_API_LIB}', libs_path)shutil.copy('${XPU_RT_LIB}', libs_path)package_data['paddle.libs']+=['${XPU_API_LIB_NAME}','${XPU_RT_LIB_NAME}']if '${WITH_XPU_BKCL}' == 'ON':shutil.copy('${XPU_BKCL_LIB}', libs_path)package_data['paddle.libs']+=['${XPU_BKCL_LIB_NAME}']# remove unused paddle/libs/__init__.pyif os.path.isfile(libs_path+'/__init__.py'):os.remove(libs_path+'/__init__.py')package_dir['paddle.libs']=libs_path# change rpath of ${FLUID_CORE_NAME}.ext, add $ORIGIN/../libs/ to it.# The reason is that libwarpctc.ext, libiomp5.ext etc are in paddle.libs, and# ${FLUID_CORE_NAME}.ext is in paddle.fluid, thus paddle/fluid/../libs will pointer to above libraries.# This operation will fix https://github.com/PaddlePaddle/Paddle/issues/3213if '${CMAKE_BUILD_TYPE}' == 'Release':if os.name != 'nt':# only change rpath in Release mode, since in Debug mode, ${FLUID_CORE_NAME}.xx is too large to be changed.if "@APPLE@" == "1":commands = ["install_name_tool -id '@loader_path/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so']commands.append("install_name_tool -add_rpath '@loader_path/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so')else:commands = ["patchelf --set-rpath '$ORIGIN/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so']# The sw_64 not suppot patchelf, so we just disable that.if platform.machine() != 'sw_64' and platform.machine() != 'mips64':for command in commands:if os.system(command) != 0:raise Exception("patch ${FLUID_CORE_NAME}.%s failed, command: %s" % (ext_name, command))ext_modules = [Extension('_foo', ['stub.cc'])]if os.name == 'nt':# fix the path separator under windowsfix_package_dir = {}for k, v in package_dir.items():fix_package_dir[k] = v.replace('/', '\\')package_dir = fix_package_dirext_modules = []elif sys.platform == 'darwin':ext_modules = []def find_files(pattern, root, recursive=False):for dirpath, _, files in os.walk(root):for filename in fnmatch.filter(files, pattern):yield os.path.join(dirpath, filename)if not recursive:breakheaders = (# paddle level api headerslist(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle')) +list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/api')) + # phi unify api headerlist(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/api/ext')) + # custom op apilist(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/api/include')) + # phi apilist(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/common')) + # phi common headers# phi level api headers (low level api)list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi')) + # phi extension headerlist(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/include', recursive=True)) + # phi include headerslist(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends', recursive=True)) + # phi backends headerslist(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/core', recursive=True)) + # phi core headerslist(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/infermeta', recursive=True)) + # phi infermeta headerslist(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/kernels', recursive=True)) + # phi kernels headers# utila api headerslist(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/utils', recursive=True))) # paddle utils headersif '${WITH_MKLDNN}' == 'ON':headers += list(find_files('*', '${MKLDNN_INSTALL_DIR}/include')) # mkldnnif '${WITH_GPU}' == 'ON' or '${WITH_ROCM}' == 'ON':# externalErrorMsg.pb for External Error messageheaders += list(find_files('*.pb', '${externalError_INCLUDE_DIR}'))class InstallCommand(InstallCommandBase):def finalize_options(self):ret = InstallCommandBase.finalize_options(self)self.install_lib = self.install_platlibself.install_headers = os.path.join(self.install_platlib, 'paddle', 'include')return retclass InstallHeaders(Command):"""Override how headers are copied."""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 = Noneself.force = 0self.outfiles = []def finalize_options(self):self.set_undefined_options('install',('install_headers', 'install_dir'),('force', 'force'))def mkdir_and_copy_file(self, header):if 'pb.h' in header:install_dir = re.sub('${PADDLE_BINARY_DIR}/', '', header)elif 'third_party' not in header:# paddle headersinstall_dir = re.sub('@PADDLE_SOURCE_DIR@/', '', header)else:# third_partyinstall_dir = re.sub('${THIRD_PARTY_PATH}', 'third_party', header)patterns = ['install/mkldnn/include']for pattern in patterns:install_dir = re.sub(pattern, '', install_dir)install_dir = os.path.join(self.install_dir, os.path.dirname(install_dir))if not os.path.exists(install_dir):self.mkpath(install_dir)return self.copy_file(header, install_dir)def run(self):hdrs = self.distribution.headersif not hdrs:returnself.mkpath(self.install_dir)for header in hdrs:(out, _) = self.mkdir_and_copy_file(header)self.outfiles.append(out)def get_inputs(self):return self.distribution.headers or []def get_outputs(self):return self.outfiles# we redirect setuptools log for non-windowsif sys.platform != 'win32':@contextmanagerdef redirect_stdout():f_log = open('${SETUP_LOG_FILE}', 'w')origin_stdout = sys.stdoutsys.stdout = f_logyieldf_log = sys.stdoutsys.stdout = origin_stdoutf_log.close()else:@contextmanagerdef redirect_stdout():yield# Log for PYPIif sys.version_info > (3,0):with open("@PADDLE_BINARY_DIR@/python/paddle/README.rst", "r", encoding='UTF-8') as f:long_description = f.read()else:with open("@PADDLE_BINARY_DIR@/python/paddle/README.rst", "r")as f:long_description = unicode(f.read(), 'UTF-8')# strip *.so to reduce package sizeif '${WITH_STRIP}' == 'ON':command = 'find ${PADDLE_BINARY_DIR}/python/paddle -name "*.so" | xargs -i strip {}'if os.system(command) != 0:raise Exception("strip *.so failed, command: %s" % command)with redirect_stdout():setup(name='${PACKAGE_NAME}',version='${PADDLE_VERSION}',description='Parallel Distributed Deep Learning',long_description=long_description,long_description_content_type="text/markdown",author_email="Paddle-better@baidu.com",maintainer="PaddlePaddle",maintainer_email="Paddle-better@baidu.com",project_urls = {'Homepage': 'https://www.paddlepaddle.org.cn/','Downloads': 'https://github.com/paddlepaddle/paddle'},license='Apache Software License',packages=packages,install_requires=setup_requires,ext_modules=ext_modules,package_data=package_data,package_dir=package_dir,scripts=paddle_bins,distclass=BinaryDistribution,headers=headers,cmdclass={'install_headers': InstallHeaders,'install': InstallCommand,},entry_points={'console_scripts': ['fleetrun = paddle.distributed.launch.main:launch']},classifiers=['Development Status :: 5 - Production/Stable','Operating System :: OS Independent','Intended Audience :: Developers','Intended Audience :: Education','Intended Audience :: Science/Research','License :: OSI Approved :: Apache Software License','Programming Language :: C++','Programming Language :: Python :: 2.7','Programming Language :: Python :: 3.5','Programming Language :: Python :: 3.6','Programming Language :: Python :: 3.7','Programming Language :: Python :: 3.8',],)# As there are a lot of files in purelib which causes many logs,# we don't print them on the screen, and you can open `setup.py.log`# for the full logs.if os.path.exists('${SETUP_LOG_FILE}'):os.system('grep -v "purelib" ${SETUP_LOG_FILE}')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。