提交 f16087e0 编写于 作者: P pangyoki 提交者: jzhang533

Cherry-pick PR42187, add LICENSE in wheel dist-info package (#42187)

上级 0c68ae0c
...@@ -13,6 +13,7 @@ from contextlib import contextmanager ...@@ -13,6 +13,7 @@ from contextlib import contextmanager
from setuptools import Command from setuptools import Command
from setuptools import setup, Distribution, Extension from setuptools import setup, Distribution, Extension
from setuptools.command.install import install as InstallCommandBase from setuptools.command.install import install as InstallCommandBase
from setuptools.command.egg_info import egg_info
class BinaryDistribution(Distribution): class BinaryDistribution(Distribution):
...@@ -678,6 +679,17 @@ class InstallHeaders(Command): ...@@ -678,6 +679,17 @@ class InstallHeaders(Command):
def get_outputs(self): def get_outputs(self):
return self.outfiles return self.outfiles
class EggInfo(egg_info):
"""Copy license file into `.dist-info` folder."""
def run(self):
# don't duplicate license into `.dist-info` when building a distribution
if not self.distribution.have_run.get('install', True):
self.mkpath(self.egg_info)
self.copy_file("@PADDLE_SOURCE_DIR@/LICENSE", self.egg_info)
egg_info.run(self)
# we redirect setuptools log for non-windows # we redirect setuptools log for non-windows
if sys.platform != 'win32': if sys.platform != 'win32':
@contextmanager @contextmanager
...@@ -733,6 +745,7 @@ with redirect_stdout(): ...@@ -733,6 +745,7 @@ with redirect_stdout():
cmdclass={ cmdclass={
'install_headers': InstallHeaders, 'install_headers': InstallHeaders,
'install': InstallCommand, 'install': InstallCommand,
'egg_info': EggInfo,
}, },
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册