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:
parent
519bcfb0e6
commit
d0e9f843e2
@ -20,7 +20,7 @@
|
|||||||
# Bram de Jong <bram.dejong at domain.com where domain in gmail>
|
# Bram de Jong <bram.dejong at domain.com where domain in gmail>
|
||||||
# 2012, Joar Wandborg <first name at last name dot se>
|
# 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
|
from functools import partial
|
||||||
import math
|
import math
|
||||||
import numpy
|
import numpy
|
||||||
|
@ -14,6 +14,11 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
try:
|
||||||
|
from PIL import Image
|
||||||
|
from PIL import ImageFont
|
||||||
|
from PIL import ImageDraw
|
||||||
|
except ImportError:
|
||||||
import Image
|
import Image
|
||||||
import ImageFont
|
import ImageFont
|
||||||
import ImageDraw
|
import ImageDraw
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
import chardet
|
import chardet
|
||||||
import os
|
import os
|
||||||
|
try:
|
||||||
|
from PIL import Image
|
||||||
|
except ImportError:
|
||||||
import Image
|
import Image
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
# Bram de Jong <bram.dejong at domain.com where domain in gmail>
|
# Bram de Jong <bram.dejong at domain.com where domain in gmail>
|
||||||
# 2012, Joar Wandborg <first name at last name dot se>
|
# 2012, Joar Wandborg <first name at last name dot se>
|
||||||
|
|
||||||
|
try:
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
except ImportError:
|
||||||
|
import Image
|
||||||
import math
|
import math
|
||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
try:
|
||||||
|
from PIL import Image
|
||||||
|
except ImportError:
|
||||||
import Image
|
import Image
|
||||||
|
|
||||||
from mediagoblin.processing import BadMediaFail
|
from mediagoblin.processing import BadMediaFail
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
try:
|
||||||
|
from PIL import Image
|
||||||
|
except ImportError:
|
||||||
import Image
|
import Image
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
@ -26,6 +26,9 @@ import pygst
|
|||||||
pygst.require('0.10')
|
pygst.require('0.10')
|
||||||
import gst
|
import gst
|
||||||
import struct
|
import struct
|
||||||
|
try:
|
||||||
|
from PIL import Image
|
||||||
|
except ImportError:
|
||||||
import Image
|
import Image
|
||||||
|
|
||||||
from gst.extend import discoverer
|
from gst.extend import discoverer
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
try:
|
||||||
|
from PIL import Image
|
||||||
|
except ImportError:
|
||||||
import Image
|
import Image
|
||||||
|
|
||||||
from mediagoblin.tools.exif import exif_fix_image_orientation, \
|
from mediagoblin.tools.exif import exif_fix_image_orientation, \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user