|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
import subprocess
|
|
|
|
|
import os
|
|
|
|
|
import os.path
|
|
|
|
|
import re
|
|
|
|
|
import shutil
|
|
|
|
|
import sys
|
|
|
|
|
import fnmatch
|
|
|
|
|
|
|
|
|
|
from contextlib import contextmanager
|
|
|
|
|
from setuptools import Command
|
|
|
|
|
from setuptools import setup, Distribution, Extension
|
|
|
|
|
from setuptools.command.install import install as InstallCommandBase
|
|
|
|
@ -358,36 +360,40 @@ class InstallHeaders(Command):
|
|
|
|
|
def get_outputs(self):
|
|
|
|
|
return self.outfiles
|
|
|
|
|
|
|
|
|
|
# Saving the installation log generated from setup.py to log_file.
|
|
|
|
|
# The log_file is ${PADDLE_BINARY_DIR}/python/setup.py.log.
|
|
|
|
|
stdout = sys.stdout
|
|
|
|
|
stderr = sys.stderr
|
|
|
|
|
log_file = open('setup.py.log', 'w')
|
|
|
|
|
sys.stdout = log_file
|
|
|
|
|
sys.stderr = log_file
|
|
|
|
|
|
|
|
|
|
setup(name='${PACKAGE_NAME}',
|
|
|
|
|
version='${PADDLE_VERSION}',
|
|
|
|
|
description='Parallel Distributed Deep Learning',
|
|
|
|
|
install_requires=setup_requires,
|
|
|
|
|
packages=packages,
|
|
|
|
|
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,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
log_file.close()
|
|
|
|
|
# Revert back the stdout/stderr to their default references.
|
|
|
|
|
sys.stdout = stdout
|
|
|
|
|
sys.stderr = stderr
|
|
|
|
|
# we redirect setuptools log for non-windows
|
|
|
|
|
if sys.platform != 'win32':
|
|
|
|
|
@contextmanager
|
|
|
|
|
def redirect_stdout():
|
|
|
|
|
with open('${SETUP_LOG_FILE}', 'w') as f:
|
|
|
|
|
origin_stdout = sys.stdout
|
|
|
|
|
sys.stdout = f
|
|
|
|
|
yield
|
|
|
|
|
sys.stdout = origin_stdout
|
|
|
|
|
else:
|
|
|
|
|
@contextmanager
|
|
|
|
|
def redirect_stdout():
|
|
|
|
|
yield
|
|
|
|
|
|
|
|
|
|
with redirect_stdout():
|
|
|
|
|
setup(name='${PACKAGE_NAME}',
|
|
|
|
|
version='${PADDLE_VERSION}',
|
|
|
|
|
description='Parallel Distributed Deep Learning',
|
|
|
|
|
install_requires=setup_requires,
|
|
|
|
|
packages=packages,
|
|
|
|
|
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,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
os.system('grep -v "purelib" setup.py.log')
|
|
|
|
|
if os.path.exists('${SETUP_LOG_FILE}'):
|
|
|
|
|
os.system('grep -v "purelib" ${SETUP_LOG_FILE}')
|
|
|
|
|