diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-03-18 18:02:10 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-03-18 18:02:10 +0100 |
commit | ab214d20c38736bce62fb09bb9c666ecf2f0c9b7 (patch) | |
tree | 1e51c88c4b1e6b1f9d99a08a2dbfed663e2a354e | |
parent | 474e4afe97d6510a94c7bd0ed9ae4b6dda4efb60 (diff) | |
download | pyexiv2-ab214d20c38736bce62fb09bb9c666ecf2f0c9b7.tar.gz |
Do not add the --user switch for Python < 2.6.
-rw-r--r-- | SConstruct | 8 | ||||
-rw-r--r-- | src/SConscript | 13 |
2 files changed, 16 insertions, 5 deletions
@@ -1,7 +1,13 @@ # -*- coding: utf-8 -*- def build_lib(): - AddOption('--user', action='store_true') + try: + from site import USER_SITE + except ImportError: + # Installing in the user site directory requires Python ≥ 2.6. + pass + else: + AddOption('--user', action='store_true') SConscript('src/SConscript', variant_dir='build', duplicate=0) def build_doc(): diff --git a/src/SConscript b/src/SConscript index af0e4cb..3099b3d 100644 --- a/src/SConscript +++ b/src/SConscript @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import os +import site from distutils.sysconfig import get_python_inc, get_python_lib -from site import USER_SITE import SCons.Util env = Environment() @@ -33,14 +33,19 @@ env.Alias('lib', libpyexiv2) # Install the shared library and the Python modules, invoked with # 'scons install'. -if GetOption('user'): +try: + user_site = GetOption('user') +except AttributeError: + user_site = False + +if user_site: # Install in the current user site directory. # See http://www.python.org/dev/peps/pep-0370/ for reference. - install_dir = USER_SITE + install_dir = site.USER_SITE else: python_lib_path = get_python_lib(plat_specific=True) # If DESTDIR is specified on the command line when invoking - # scons, it will be prepended to each installed target file. See + # scons, its value will be prepended to each installed target file. See # http://www.gnu.org/prep/standards/html_node/DESTDIR.html for reference. dest_dir = ARGUMENTS.get('DESTDIR') if dest_dir is None or not os.path.isabs(dest_dir): |