diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-03-18 23:55:22 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-03-18 23:55:22 +0100 |
commit | a7924a66bfa35eaf9050645d5eac9e7117a1f4ac (patch) | |
tree | a853f424e671cfcd7a2797eabeb8110869bcdea8 /src | |
parent | 80ad262aa91c497dd0ac058a4e5dca8b656e9d2a (diff) | |
parent | c201e9739713559617624e0f05ca14e4af471376 (diff) | |
download | pyexiv2-a7924a66bfa35eaf9050645d5eac9e7117a1f4ac.tar.gz |
Merge the master branch.
Diffstat (limited to 'src')
-rw-r--r-- | src/SConscript | 35 | ||||
-rw-r--r-- | src/pyexiv2/metadata.py | 5 |
2 files changed, 27 insertions, 13 deletions
diff --git a/src/SConscript b/src/SConscript index abf299c..a19d287 100644 --- a/src/SConscript +++ b/src/SConscript @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import os +import site from distutils.sysconfig import get_python_inc, get_python_lib import SCons.Util @@ -30,17 +31,31 @@ cpp_sources = ['exiv2wrapper.cpp', 'exiv2wrapper_python.cpp'] libpyexiv2 = env.SharedLibrary('exiv2python', cpp_sources) env.Alias('lib', libpyexiv2) -# Install the shared library and the Python modules, invoked using -# 'scons install'. If DESTDIR is specified on the command line when invoking -# scons, it will be prepended to each installed target file. See -# http://www.gnu.org/prep/standards/html_node/DESTDIR.html for reference. -python_lib_path = get_python_lib(plat_specific=True) -dest_dir = ARGUMENTS.get('DESTDIR') -if (dest_dir is None) or (not os.path.isabs(dest_dir)): - install_dir = python_lib_path +# Install the shared library and the Python modules, invoked with +# 'scons install'. +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 = site.USER_SITE else: - install_dir = os.path.join(dest_dir, python_lib_path[1:]) + python_lib_path = get_python_lib(plat_specific=True) + # If DESTDIR is specified on the command line when invoking + # 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): + install_dir = python_lib_path + else: + install_dir = os.path.join(dest_dir, python_lib_path[1:]) + env.Install(install_dir, [libpyexiv2]) -env.Install(os.path.join(install_dir, 'pyexiv2'), Glob('pyexiv2/*.py')) +modules = ['__init__', 'metadata', 'exif', 'iptc', 'xmp', 'utils'] +env.Install(os.path.join(install_dir, 'pyexiv2'), + ['pyexiv2/%s.py' % module for module in modules]) env.Alias('install', install_dir) diff --git a/src/pyexiv2/metadata.py b/src/pyexiv2/metadata.py index fc36568..6dbe190 100644 --- a/src/pyexiv2/metadata.py +++ b/src/pyexiv2/metadata.py @@ -29,6 +29,7 @@ Provide the ImageMetadata class. """ import os +import sys from errno import ENOENT import libexiv2python @@ -54,9 +55,7 @@ class ImageMetadata(object): :param filename: path to an image file :type filename: string """ - self.filename = filename - if isinstance(filename, unicode): - self.filename = filename.encode('utf-8') + self.filename = filename.encode(sys.getfilesystemencoding()) self._image = None self._keys = {'exif': None, 'iptc': None, 'xmp': None} self._tags = {'exif': {}, 'iptc': {}, 'xmp': {}} |