From 9825d173ee4cf6bca03cd2d1ed3b7b89570e47a7 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Mon, 29 Dec 2014 18:48:49 +0100 Subject: [PATCH] MAINT make it possible to use wheelhouse-uploader wheelhouse-uploader makes it possible to leverage our CI infrastructure (travis and appveyor) to automate the generation of binary packages for OSX and windows (both .exe and .whl packages). The cloud containers that are used to store the build artifacts of the CI workers are configured in the setup.cfg file. More details at: https://github.com/ogrisel/wheelhouse-uploader --- setup.cfg | 9 +++++++++ setup.py | 30 ++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/setup.cfg b/setup.cfg index 4c256a035e9f6..377428127ca79 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,6 +21,15 @@ doctest-extension = rst doctest-fixtures = _fixture #doctest-options = +ELLIPSIS,+NORMALIZE_WHITESPACE +[wheelhouse_uploader] +artifact_indexes= + # OSX wheels built by travis (only for specific tags): + # https://github.com/MacPython/scikit-learn-wheels + http://wheels.scipy.org + # Windows wheels buit by: + # https://ci.appveyor.com/project/sklearn-ci/scikit-learn/ + http://windows-wheels.scikit-learn.org/ + # Uncomment the following under windows to build using: # http://sourceforge.net/projects/mingw/ diff --git a/setup.py b/setup.py index eb9774f1a7d0d..de129757ac62b 100755 --- a/setup.py +++ b/setup.py @@ -38,14 +38,12 @@ # We can actually import a restricted version of sklearn that # does not need the compiled code import sklearn - VERSION = sklearn.__version__ -############################################################################### + # Optional setuptools features # We need to import setuptools early, if we want setuptools features, # as it monkey-patches the 'setup' function - # For some commands, use setuptools SETUPTOOLS_COMMANDS = set([ 'develop', 'release', 'bdist_egg', 'bdist_rpm', @@ -53,9 +51,7 @@ 'egg_info', 'easy_install', 'upload', 'bdist_wheel', '--single-version-externally-managed', ]) - - -if len(SETUPTOOLS_COMMANDS.intersection(sys.argv)) > 0: +if SETUPTOOLS_COMMANDS.intersection(sys.argv): import setuptools extra_setuptools_args = dict( zip_safe=False, # the package can run out of an .egg file @@ -64,8 +60,8 @@ else: extra_setuptools_args = dict() -############################################################################### +# Custom clean command to remove build artifacts class CleanCommand(Clean): description = "Remove build artifacts from the source tree" @@ -84,8 +80,22 @@ def run(self): if dirname == '__pycache__': shutil.rmtree(os.path.join(dirpath, dirname)) +cmdclass = {'clean': CleanCommand} + + +# Optional wheelhouse-uploader features +# To automate release of binary packages for scikit-learn we need a tool +# to download the packages generated by travis and appveyor workers (with +# version number matching the current release) and upload them all at once +# to PyPI at release time. +# The URL of the artifact repositories are configured in the setup.cfg file. + +WHEELHOUSE_UPLOADER_COMMANDS = set(['fetch_artifacts', 'upload_all']) +if WHEELHOUSE_UPLOADER_COMMANDS.intersection(sys.argv): + import wheelhouse_uploader.cmd + cmdclass.update(vars(wheelhouse_uploader.cmd)) + -############################################################################### def configuration(parent_package='', top_path=None): if os.path.exists('MANIFEST'): os.remove('MANIFEST') @@ -133,7 +143,7 @@ def setup_package(): 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', ], - cmdclass={'clean': CleanCommand}, + cmdclass=cmdclass, **extra_setuptools_args) if (len(sys.argv) >= 2 @@ -143,7 +153,7 @@ def setup_package(): # For these actions, NumPy is not required. # # They are required to succeed without Numpy for example when - # pip is used to install Scikit when Numpy is not yet present in + # pip is used to install Scikit-learn when Numpy is not yet present in # the system. try: from setuptools import setup