Inform setuptools that this is a binary package (#1996)

* Inform setuptools that this is a binary package that needs platform-tags in wheel names.

This fixes issue #1995 .

* PEP8 Formatting

* Add docstring
This commit is contained in:
Holger Peters 2017-03-07 16:26:04 +01:00 committed by Yuan (Terry) Tang
parent 288f309434
commit 95510b9667

View File

@ -3,7 +3,7 @@
from __future__ import absolute_import
import sys
import os
from setuptools import setup, find_packages
from setuptools import setup, find_packages, Distribution
# import subprocess
sys.path.insert(0, '.')
@ -19,6 +19,14 @@ else:
CURRENT_DIR = os.path.dirname(__file__)
class BinaryDistribution(Distribution):
"""Auxilliary class necessary to inform setuptools that this is a
non-generic, platform-specific package."""
def has_ext_modules(self):
return True
# We can not import `xgboost.libpath` in setup.py directly since xgboost/__init__.py
# import `xgboost.core` and finally will import `numpy` and `scipy` which are setup
# `install_requires`. That's why we're using `exec` here.
@ -55,4 +63,5 @@ setup(name='xgboost',
# otherwise install_data process will copy it to
# root directory for some machines, and cause confusions on building
# data_files=[('xgboost', LIB_PATH)],
distclass=BinaryDistribution,
url='https://github.com/dmlc/xgboost')