Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add LICENSE in wheel dist-info package #42187

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ from contextlib import contextmanager
from setuptools import Command
from setuptools import setup, Distribution, Extension
from setuptools.command.install import install as InstallCommandBase
from setuptools.command.egg_info import egg_info


class BinaryDistribution(Distribution):
Expand Down Expand Up @@ -678,6 +679,17 @@ class InstallHeaders(Command):
def get_outputs(self):
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
if sys.platform != 'win32':
@contextmanager
Expand Down Expand Up @@ -733,6 +745,7 @@ with redirect_stdout():
cmdclass={
'install_headers': InstallHeaders,
'install': InstallCommand,
'egg_info': EggInfo,
},
entry_points={
'console_scripts': [
Expand Down