mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-13 05:06:49 +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
|
from __future__ import print_function
|
||||||
|
|
||||||
VERSION = "1.1.7"
|
from PIL import VERSION, PILLOW_VERSION, _plugins
|
||||||
PILLOW_VERSION = "2.0.0"
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import warnings
|
import warnings
|
||||||
|
@ -336,34 +335,15 @@ def init():
|
||||||
if _initialized >= 2:
|
if _initialized >= 2:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
visited = {}
|
for plugin in _plugins:
|
||||||
|
try:
|
||||||
directories = sys.path
|
if DEBUG:
|
||||||
|
print ("Importing %s"%plugin)
|
||||||
try:
|
__import__("PIL.%s"%plugin, globals(), locals(), [])
|
||||||
directories = directories + [os.path.dirname(__file__)]
|
except ImportError:
|
||||||
except NameError:
|
if DEBUG:
|
||||||
pass
|
print("Image: failed to import", end=' ')
|
||||||
|
print(plugin, ":", sys.exc_info()[1])
|
||||||
# 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
|
|
||||||
|
|
||||||
if OPEN or SAVE:
|
if OPEN or SAVE:
|
||||||
_initialized = 2
|
_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