From bfe1e0ae1de8f057e198a2b643e8a0f2fe18243b Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 2 Nov 2012 08:06:42 -0700 Subject: [PATCH] Detect execution mode. --- pyext/setup.py.in | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/pyext/setup.py.in b/pyext/setup.py.in index 50b2573..c8bddda 100644 --- a/pyext/setup.py.in +++ b/pyext/setup.py.in @@ -25,6 +25,16 @@ import glob import os import sys +# Detect execution mode +is_build = True +if (len(sys.argv) >= 2): + if (sys.argv[1] == 'install'): + is_build = False +if is_build: + sys.stdout.write("Python extension module building:\n") +else: + sys.stdout.write("Python extension module installation:\n") + # Darwin MacPorts kluge: Remove -L/opt/local/lib path from LDSHARED as this # overrides the GammaLib settings. Otherwise, MacPorts libraries would be # used instead of the libraries selected by GammaLib @@ -128,15 +138,16 @@ setup(name='@PACKAGE_NAME@', # Post-processing. A symbolic link is created to the directory containing the # shared wrapper libraries so that we can add this directory to the PYTHONPATH # for testing. -try: - os.chdir('build') - os.remove('ctools') - sys.stdout.write("Removed symbolic link build/ctools.\n") -except: - pass -try: - path = glob.glob('lib.*') - os.symlink(path[0], 'ctools') - sys.stdout.write("Created symbolic link build/ctools.\n") -except: - sys.stdout.write("WARNING: Failed to create symbolic link build/ctools.\n") +if is_build: + try: + os.chdir('build') + os.remove('ctools') + sys.stdout.write("Removed symbolic link build/ctools.\n") + except: + pass + try: + path = glob.glob('lib.*') + os.symlink(path[0], 'ctools') + sys.stdout.write("Created symbolic link build/ctools.\n") + except: + sys.stdout.write("WARNING: Failed to create symbolic link build/ctools.\n") -- libgit2 0.21.4