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

[python] fix platform specific wheel to be spec compliant #23703

Merged
merged 2 commits into from
Nov 22, 2022
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
21 changes: 10 additions & 11 deletions src/controller/python/build-chip-wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from __future__ import absolute_import
from datetime import datetime
from setuptools import setup
from setuptools import setup, Distribution
from wheel.bdist_wheel import bdist_wheel

import argparse
Expand Down Expand Up @@ -56,6 +56,14 @@ def __init__(self, name):
self.name = name
self.installName = os.path.splitext(name)[0]

# Make sure wheel is not considered pure and avoid shared libraries in purelib
# folder.


class BinaryDistribution(Distribution):
def has_ext_modules(foo):
return True


packageName = args.package_name
libName = args.lib_name
Expand Down Expand Up @@ -103,13 +111,6 @@ def __init__(self, name):
os.rename(os.path.join(tmpDir, script.name),
os.path.join(tmpDir, script.installName))

# Define a custom version of the bdist_wheel command that configures the
# resultant wheel as platform-specific (i.e. not "pure").
class bdist_wheel_override(bdist_wheel):
def finalize_options(self):
bdist_wheel.finalize_options(self)
self.root_is_pure = False

requiredPackages = manifest['package_reqs']

#
Expand Down Expand Up @@ -164,9 +165,7 @@ def finalize_options(self):
'egg_base': tmpDir
}
},
cmdclass={
'bdist_wheel': bdist_wheel_override
} if libName else {},
distclass=BinaryDistribution if libName else None,
script_args=['clean', '--all', 'bdist_wheel']
)

Expand Down