mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
namespaced operation works when installed as a zipped egg using 'sudo python[3] setup.py easy_install -l --zip-ok .'
This commit is contained in:
parent
b0fffd24a4
commit
026f6bb61e
40
PIL/Image.py
40
PIL/Image.py
|
@ -26,8 +26,7 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
VERSION = "1.1.7"
|
||||
PILLOW_VERSION = "2.0.0"
|
||||
from PIL import VERSION, PILLOW_VERSION, _plugins
|
||||
|
||||
try:
|
||||
import warnings
|
||||
|
@ -336,34 +335,15 @@ def init():
|
|||
if _initialized >= 2:
|
||||
return 0
|
||||
|
||||
visited = {}
|
||||
|
||||
directories = sys.path
|
||||
|
||||
try:
|
||||
directories = directories + [os.path.dirname(__file__)]
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
# only check directories (including current, if present in the path)
|
||||
for directory in filter(isDirectory, directories):
|
||||
fullpath = os.path.abspath(directory)
|
||||
if fullpath in visited:
|
||||
continue
|
||||
for file in os.listdir(directory):
|
||||
if file[-14:] == "ImagePlugin.py":
|
||||
f, e = os.path.splitext(file)
|
||||
try:
|
||||
sys.path.insert(0, directory)
|
||||
try:
|
||||
__import__(f, globals(), locals(), [])
|
||||
finally:
|
||||
del sys.path[0]
|
||||
except ImportError:
|
||||
if DEBUG:
|
||||
print("Image: failed to import", end=' ')
|
||||
print(f, ":", sys.exc_info()[1])
|
||||
visited[fullpath] = None
|
||||
for plugin in _plugins:
|
||||
try:
|
||||
if DEBUG:
|
||||
print ("Importing %s"%plugin)
|
||||
__import__("PIL.%s"%plugin, globals(), locals(), [])
|
||||
except ImportError:
|
||||
if DEBUG:
|
||||
print("Image: failed to import", end=' ')
|
||||
print(plugin, ":", sys.exc_info()[1])
|
||||
|
||||
if OPEN or SAVE:
|
||||
_initialized = 2
|
||||
|
|
|
@ -10,3 +10,48 @@
|
|||
#
|
||||
|
||||
# ;-)
|
||||
|
||||
VERSION = '1.1.7' # PIL version
|
||||
PILLOW_VERSION = '2.0.0' # Pillow
|
||||
|
||||
_plugins = ['ArgImagePlugin',
|
||||
'BmpImagePlugin',
|
||||
'BufrStubImagePlugin',
|
||||
'CurImagePlugin',
|
||||
'DcxImagePlugin',
|
||||
'EpsImagePlugin',
|
||||
'FitsStubImagePlugin',
|
||||
'FliImagePlugin',
|
||||
'FpxImagePlugin',
|
||||
'GbrImagePlugin',
|
||||
'GifImagePlugin',
|
||||
'GribStubImagePlugin',
|
||||
'Hdf5StubImagePlugin',
|
||||
'IcnsImagePlugin',
|
||||
'IcoImagePlugin',
|
||||
'ImImagePlugin',
|
||||
'ImtImagePlugin',
|
||||
'IptcImagePlugin',
|
||||
'JpegImagePlugin',
|
||||
'McIdasImagePlugin',
|
||||
'MicImagePlugin',
|
||||
'MpegImagePlugin',
|
||||
'MspImagePlugin',
|
||||
'PalmImagePlugin',
|
||||
'PcdImagePlugin',
|
||||
'PcxImagePlugin',
|
||||
'PdfImagePlugin',
|
||||
'PixarImagePlugin',
|
||||
'PngImagePlugin',
|
||||
'PpmImagePlugin',
|
||||
'PsdImagePlugin',
|
||||
'SgiImagePlugin',
|
||||
'SpiderImagePlugin',
|
||||
'SunImagePlugin',
|
||||
'TgaImagePlugin',
|
||||
'TiffImagePlugin',
|
||||
'WebPImagePlugin',
|
||||
'WmfImagePlugin',
|
||||
'XbmImagePlugin',
|
||||
'XpmImagePlugin',
|
||||
'XVThumbImagePlugin']
|
||||
|
|
Loading…
Reference in New Issue
Block a user