mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-16 21:30:23 +00:00
Deprecate imagekit.processors submodules
- `base`, `crop`, `resize`, and `utils` are now placed in `pilkit` app - remove magic compatibility between `imagekit.processors` and `pilkit.procesors`
This commit is contained in:
parent
e56f8c5925
commit
1ac3399737
8 changed files with 38 additions and 37 deletions
|
|
@ -1,5 +1,4 @@
|
|||
# flake8: noqa
|
||||
from . import importers
|
||||
from . import conf
|
||||
from . import generatorlibrary
|
||||
from .specs import ImageSpec
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
"""
|
||||
Looking for processors? They have moved to PILKit. See imagekit.importers for
|
||||
details.
|
||||
|
||||
"""
|
||||
12
imagekit/processors/__init__.py
Normal file
12
imagekit/processors/__init__.py
Normal 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'
|
||||
]
|
||||
7
imagekit/processors/base.py
Normal file
7
imagekit/processors/base.py
Normal 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']
|
||||
7
imagekit/processors/crop.py
Normal file
7
imagekit/processors/crop.py
Normal 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']
|
||||
7
imagekit/processors/resize.py
Normal file
7
imagekit/processors/resize.py
Normal 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']
|
||||
5
imagekit/processors/utils.py
Normal file
5
imagekit/processors/utils.py
Normal 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)
|
||||
Loading…
Reference in a new issue