summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2016-11-18 11:42:16 +0100
committerMartin Basti <mbasti@redhat.com>2016-11-24 11:40:48 +0100
commit526bcea705d04895aa6b09bce996ac340783d1d0 (patch)
tree6f78c7884ee161825bb27135828c82d728f111d5
parent29947fe1a304ff6f913e5d94d56d8108a7c94087 (diff)
downloadfreeipa-526bcea705d04895aa6b09bce996ac340783d1d0.tar.gz
freeipa-526bcea705d04895aa6b09bce996ac340783d1d0.tar.xz
freeipa-526bcea705d04895aa6b09bce996ac340783d1d0.zip
Don't ship install subpackages with wheels
The install subpackages of ipaclient, ipalib and ipapython contain helper code for installers such as ipa-client-install. They also depend on external modules that are not available on PyPI, e.g. SSSDConfig. Since PyPI wheel packages do not support client installation, the install subpackages contain dead and unsupported code. The custom build_py plugin removes the subpackages from bdist_wheel builds. It's not enough to just remove 'ipaclient.install' from the 'packages' list. Surplus files have to be removed from build/lib, too. https://fedorahosted.org/freeipa/ticket/6468 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
-rw-r--r--ipasetup.py.in36
1 files changed, 36 insertions, 0 deletions
diff --git a/ipasetup.py.in b/ipasetup.py.in
index 53309560d..fac4b252e 100644
--- a/ipasetup.py.in
+++ b/ipasetup.py.in
@@ -14,8 +14,41 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+from distutils import log
import os
import sys
+from setuptools.command.build_py import build_py as setuptools_build_py
+
+
+class build_py(setuptools_build_py):
+ """Exclude NAME.install subpackage from wheels
+ """
+ def initialize_options(self):
+ setuptools_build_py.initialize_options(self)
+ self.skip_package = None
+
+ def finalize_options(self):
+ setuptools_build_py.finalize_options(self)
+ if 'bdist_wheel' in self.distribution.commands:
+ distname = self.distribution.metadata.name
+ self.skip_package = '{}.install'.format(distname)
+ log.warn("bdist_wheel: Ignore package: %s",
+ self.skip_package)
+
+ def build_module(self, module, module_file, package):
+ if isinstance(package, str):
+ package = package.split('.')
+ name = '.'.join(list(package) + [module])
+ if self.skip_package and name.startswith(self.skip_package):
+ # remove file in case it has been copied to build/lib before
+ outfile = self.get_module_outfile(self.build_lib, package, module)
+ try:
+ os.unlink(outfile)
+ except OSError:
+ pass
+ else:
+ return setuptools_build_py.build_module(self, module,
+ module_file, package)
PACKAGE_VERSION = {
@@ -89,6 +122,9 @@ def ipasetup(name, doc, **kwargs):
# exclude setup helpers from getting installed
epd = setup_kwargs.setdefault('exclude_package_data', {})
epd.setdefault('', []).extend(['*/setup.py', '*/ipasetup.py'])
+ # exclude NAME.install from wheels
+ cmdclass = setup_kwargs.setdefault('cmdclass', {})
+ cmdclass['build_py'] = build_py
os.chdir(local_path)
try: