PIL: Support systems with Pillow and without

Fixes for systems with Pillow, but leaves a "try: except ImportError" to
support anything that doesn't have a PIL top level import.

Signed-off-by: Alon Levy <alon@pobox.com>
This commit is contained in:
Alon Levy 2013-04-08 11:19:56 +03:00
parent 519bcfb0e6
commit d0e9f843e2
8 changed files with 34 additions and 11 deletions

View File

@ -20,7 +20,7 @@
# Bram de Jong <bram.dejong at domain.com where domain in gmail>
# 2012, Joar Wandborg <first name at last name dot se>
import Image, ImageDraw, ImageColor #@UnresolvedImport
from PIL import Image, ImageDraw, ImageColor #@UnresolvedImport
from functools import partial
import math
import numpy

View File

@ -14,9 +14,14 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import Image
import ImageFont
import ImageDraw
try:
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
except ImportError:
import Image
import ImageFont
import ImageDraw
import logging
import pkg_resources
import os

View File

@ -15,7 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import chardet
import os
import Image
try:
from PIL import Image
except ImportError:
import Image
import logging
from mediagoblin import mg_globals as mgg

View File

@ -19,7 +19,10 @@
# Bram de Jong <bram.dejong at domain.com where domain in gmail>
# 2012, Joar Wandborg <first name at last name dot se>
from PIL import Image
try:
from PIL import Image
except ImportError:
import Image
import math
import numpy

View File

@ -15,7 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import Image
try:
from PIL import Image
except ImportError:
import Image
from mediagoblin.processing import BadMediaFail
from mediagoblin.media_types.audio import audioprocessing

View File

@ -14,7 +14,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import Image
try:
from PIL import Image
except ImportError:
import Image
import os
import logging

View File

@ -26,7 +26,10 @@ import pygst
pygst.require('0.10')
import gst
import struct
import Image
try:
from PIL import Image
except ImportError:
import Image
from gst.extend import discoverer

View File

@ -15,7 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import Image
try:
from PIL import Image
except ImportError:
import Image
from mediagoblin.tools.exif import exif_fix_image_orientation, \
extract_exif, clean_exif, get_gps_data, get_useful