Fetching contributors…
Cannot retrieve contributors at this time
79 lines (65 sloc) 3.58 KB
from version import version
from setuptools import find_packages, setup
from pkg_resources import require, DistributionNotFound, parse_version
s3am_version = '2.0'
def check_provided(distribution, min_version, max_version=None, optional=False):
# taken from
min_version = parse_version(min_version)
if isinstance(min_version, tuple):
raise RuntimeError("Setuptools version 8.0 or newer required. Update by running "
"'pip install setuptools --upgrade'")
if max_version is not None:
max_version = parse_version(max_version)
messages = []
toil_missing = 'Cannot find a valid installation of Toil.'
dist_missing = 'Cannot find an installed copy of the %s distribution, typically provided by Toil.' % distribution
version_too_low = 'The installed copy of %s is out of date.' % distribution
version_too_high = 'The installed copy of %s is too new.' % distribution
required_version = 'Setup requires version %s or higher' % min_version
required_version += '.' if max_version is None else ', up to but not including %s.' % max_version
install_toil = 'Installing Toil should fix this problem.'
upgrade_toil = 'Upgrading Toil should fix this problem.'
reinstall_dist = 'Uninstalling %s and reinstalling Toil should fix this problem.' % distribution
reinstall_toil = 'Uninstalling Toil and reinstalling it should fix this problem.'
footer = ("Setup doesn't install Toil automatically to give you a chance to choose any of the optional extras "
"that Toil provides. More on installing Toil at")
# This check will fail if the distribution or any of its dependencies are missing.
installed_version = parse_version(require(distribution)[0].version)
except DistributionNotFound:
installed_version = None
if not optional:
messages.extend([toil_missing if distribution == 'toil' else dist_missing, install_toil])
if installed_version < min_version:
messages.extend([version_too_low, required_version,
upgrade_toil if distribution == 'toil' else reinstall_dist])
elif max_version is not None and max_version < installed_version:
messages.extend([version_too_high, required_version,
reinstall_toil if distribution == 'toil' else reinstall_dist])
if messages:
raise RuntimeError(' '.join(messages))
return str(installed_version)
toil_version = check_provided('toil', min_version='3.7.0a1.dev392', max_version='3.7.0a1.dev392')
kwargs = dict(
description='A common library for functions and tools used in toil-based pipelines',
author='UCSC Computational Genomics Lab',
package_dir={'': 'src'},
"Thank you for installing toil-lib! If you want to run Toil on a cluster in a cloud, please reinstall it "
"with the appropriate extras. For example, To install AWS/EC2 support for example, run "
"pip install toil[aws,mesos]==%s"
"on every EC2 instance. Refer to Toil's documentation at "
"for more information."
% toil_version)