From 7c88ecf10c3197c337990c7f92c7ace6a85d316e Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Sun, 11 Aug 2013 21:56:37 +0800 Subject: [PATCH] Make compilation of extensions optional through an environment variable. --- setup.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 0931116..afd79db 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,13 @@ +import os + from distutils.core import setup from distutils.core import Extension -setup(name = 'wrapt', +with_extensions = os.environ.get('WRAPT_EXTENSIONS', 'true') +with_extensions = (with_extensions.lower() != 'false') + +setup_kwargs = dict( + name = 'wrapt', version = '0.9.0', description = 'Module for decorators, wrappers and monkey patching.', author = 'Graham Dumpleton', @@ -10,5 +16,13 @@ setup(name = 'wrapt', url = 'https://github.com/GrahamDumpleton/wrapt', packages = ['wrapt'], package_dir={'wrapt': 'src'}, - ext_modules = [Extension("wrapt._wrappers", ["src/_wrappers.c"])], ) + +setup_extension_kwargs = dict( + ext_modules = [Extension("wrapt._wrappers", ["src/_wrappers.c"])], +) + +if with_extensions: + setup_kwargs.update(setup_extension_kwargs) + +setup(**setup_kwargs)