From fddcdd2db29008e0f152c8c0d2eba0c124395cc1 Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Fri, 16 Feb 2018 22:49:20 +0100 Subject: [PATCH] MAINT allow to set environment variable at install --- readme.md | 10 ++++++++++ setup.py | 13 +++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index 66d6798..8fdf5fa 100644 --- a/readme.md +++ b/readme.md @@ -48,3 +48,13 @@ The output generated by the above example should look like the following: - Cython (only for building and installing, not for everyday use) - Pillow (friendly fork of PIL, used here for file I/O with the example and during unit tests) - CharLS (source included as subfolder) + +## Installing + +Under Linux, you need to set the environment variable `MSCV` to be able to install: + +``` +export MSCV=False +pip install . +``` + diff --git a/setup.py b/setup.py index 04c67a4..cae3562 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,9 @@ - - -import numpy as np +import os import setuptools - from setuptools import setup, find_packages from setuptools.extension import Extension +import numpy as np from Cython.Distutils import build_ext # Cython extension. @@ -20,8 +18,11 @@ extra_link_args = [] -flag_MSVC = True # Set this flag to True if using Visual Studio. -if flag_MSVC: +if 'MSCV' in os.environ and os.environ['MSCV'] == 'False': + flag_MSCV = False +else: + flag_MSCV = True +if flag_MSCV: extra_compile_args = ['/EHsc'] else: extra_compile_args = []