Skip to content

Commit

Permalink
MAINT make it possible to use wheelhouse-uploader
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ogrisel committed Dec 29, 2014
1 parent 132ac81 commit 9825d17
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
9 changes: 9 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
30 changes: 20 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,20 @@
# 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',
'bdist_wininst', 'install_egg_info', 'build_sphinx',
'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
Expand All @@ -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"
Expand All @@ -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')
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9825d17

Please sign in to comment.