From 1292f58e7bf595362b92451962c4c10e27007613 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Thu, 8 Mar 2018 17:21:02 +0100 Subject: [PATCH] Fix wheel pure lib generation (#616) --- tools/setup.py | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/tools/setup.py b/tools/setup.py index 97bf8110ff2..65a96bc81d8 100644 --- a/tools/setup.py +++ b/tools/setup.py @@ -1,4 +1,6 @@ from sys import executable +from os.path import join as pjoin +from os.path import dirname setuptools_import_error_message = """setuptools is not installed for """ + executable + """ Please follow this link for installing instructions : @@ -10,9 +12,6 @@ except ImportError: raise ImportError(setuptools_import_error_message) -from os.path import join as pjoin -from os.path import dirname - # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw @@ -20,11 +19,17 @@ def read(fname): return open(pjoin(dirname(__file__), fname)).read() - class BinaryDistribution(Distribution): - def has_ext_modules(foo): - return True + def is_pure(self): + return False + def has_ext_modules(self): + return True +from setuptools.command.install import install +class InstallPlatlib(install): + def finalize_options(self): + install.finalize_options(self) + self.install_lib = self.install_platlib setup( name='ORTOOLS_PYTHON_VERSION', @@ -40,11 +45,11 @@ def has_ext_modules(foo): 'ortools.sat.python', 'ortools.util', ], - install_requires = [ + install_requires=[ 'protobuf >= PROTOBUF_TAG', 'six >= 1.10', ], - package_data = { + package_data={ 'ortools.constraint_solver' : ['_pywrapcp.dll'], 'ortools.data' : ['_pywraprcpsp.dll'], 'ortools.linear_solver' : ['_pywraplp.dll'], @@ -55,15 +60,15 @@ def has_ext_modules(foo): }, include_package_data=True, license='Apache 2.0', - author = 'Google Inc', - author_email = 'lperron@google.com', - description = 'Google OR-Tools python libraries and modules', - keywords = ('operations research, constraint programming, ' + - 'linear programming,' + 'flow algorithms,' + - 'python'), - url = 'https://developers.google.com/optimization/', - download_url = 'https://github.com/google/or-tools/releases', - classifiers = [ + author='Google Inc', + author_email='lperron@google.com', + description='Google OR-Tools python libraries and modules', + keywords=('operations research, constraint programming, ' + + 'linear programming,' + 'flow algorithms,' + + 'python'), + url='https://developers.google.com/optimization/', + download_url='https://github.com/google/or-tools/releases', + classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', @@ -80,5 +85,6 @@ def has_ext_modules(foo): 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Software Development :: Libraries :: Python Modules'], distclass=BinaryDistribution, - long_description = read('README.txt'), + cmdclass={'install': InstallPlatlib}, + long_description=read('README.txt'), )