Merge branch 'processors-deprecation' into develop

* processors-deprecation:
  Deprecate `imagekit.processors` submodules
This commit is contained in:
Matthew Dapena-Tretter 2014-09-28 12:12:54 -04:00
commit 94255855db
8 changed files with 38 additions and 37 deletions

View file

@ -1,5 +1,4 @@
# flake8: noqa
from . import importers
from . import conf
from . import generatorlibrary
from .specs import ImageSpec

View file

@ -1,31 +0,0 @@
import re
import sys
class ProcessorImporter(object):
"""
The processors were moved to the PILKit project so they could be used
separtely from ImageKit (which has a bunch of Django dependencies). However,
there's no real need to expose this fact (and we want to maintain backwards
compatibility), so we proxy all "imagekit.processors" imports to
"pilkit.processors" using this object.
"""
pattern = re.compile(r'^imagekit\.processors((\..*)?)$')
def find_module(self, name, path=None):
if self.pattern.match(name):
return self
def load_module(self, name):
if name in sys.modules:
return sys.modules[name]
from django.utils.importlib import import_module
new_name = self.pattern.sub(r'pilkit.processors\1', name)
mod = import_module(new_name)
sys.modules[name] = mod
return mod
sys.meta_path.insert(0, ProcessorImporter())

View file

@ -1,5 +0,0 @@
"""
Looking for processors? They have moved to PILKit. See imagekit.importers for
details.
"""

View file

@ -0,0 +1,12 @@
from pilkit.processors import *
__all__ = [
# Base
'ProcessorPipeline', 'Adjust', 'Reflection', 'Transpose',
'Anchor', 'MakeOpaque',
# Crop
'TrimBorderColor', 'Crop', 'SmartCrop',
# Resize
'Resize', 'ResizeToCover', 'ResizeToFill', 'SmartResize',
'ResizeCanvas', 'AddBorder', 'ResizeToFit', 'Thumbnail'
]

View file

@ -0,0 +1,7 @@
import warnings
from pilkit.processors.base import *
warnings.warn('imagekit.processors.base is deprecated use imagekit.processors instead', DeprecationWarning)
__all__ = ['ProcessorPipeline', 'Adjust', 'Reflection', 'Transpose', 'Anchor', 'MakeOpaque']

View file

@ -0,0 +1,7 @@
import warnings
from pilkit.processors.crop import *
warnings.warn('imagekit.processors.crop is deprecated use imagekit.processors instead', DeprecationWarning)
__all__ = ['TrimBorderColor', 'Crop', 'SmartCrop']

View file

@ -0,0 +1,7 @@
import warnings
from pilkit.processors.resize import *
warnings.warn('imagekit.processors.resize is deprecated use imagekit.processors instead', DeprecationWarning)
__all__ = ['Resize', 'ResizeToCover', 'ResizeToFill', 'SmartResize', 'ResizeCanvas', 'AddBorder', 'ResizeToFit', 'Thumbnail']

View file

@ -0,0 +1,5 @@
import warnings
from pilkit.processors.utils import *
warnings.warn('imagekit.processors.utils is deprecated use pilkit.processors.utils instead', DeprecationWarning)