Skip to content

Commit

Permalink
Add Python 3 and Thumbor 7 support
Browse files Browse the repository at this point in the history
Minor updates to bring the module up to Python 3 standard.
  • Loading branch information
nosmo committed Aug 23, 2022
1 parent 28108e4 commit cf7e045
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 24 deletions.
4 changes: 2 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ test:
override:
- make pyvows_run
post:
- fpm -s python -t deb --iteration 1 --no-python-dependencies -d python-dateutil -d thumbor -d python-boto --python-install-lib /usr/lib/python2.7/dist-packages -x "*.pyc" ./setup.py
- mv ./*.deb $CIRCLE_ARTIFACTS
- fpm -s python -t deb --iteration 1 --no-python-dependencies -d python-dateutil -d thumbor -d python-boto --python-install-lib /usr/lib/python3.8/dist-packages -x "*.pyc" ./setup.py
- mv ./*.deb $CIRCLE_ARTIFACTS
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
master_doc = 'index'

# General information about the project.
project = u'Thumbor Community Core'
copyright = u'Thumbor Community'
project = 'Thumbor Community Core'
copyright = 'Thumbor Community'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -248,8 +248,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Thumbor Community', u'Thumbor Community Documentation',
u'@masom', 'Thumbor Community', 'Thumbor Community Extensions',
('index', 'Thumbor Community', 'Thumbor Community Documentation',
'@masom', 'Thumbor Community', 'Thumbor Community Extensions',
'Miscellaneous'),
]

Expand Down
16 changes: 10 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# -*- coding: utf-8 -*-

from setuptools import setup
from setuptools import setup, find_packages


setup(
name='tc_core',
version='0.4.1',
version='0.5',
url='http://github.com/thumbor_community/core',
license='MIT',
author='Thumbor Community',
description='Thumbor community extensions core',
packages=['tc_core'],
packages=find_packages(),
include_package_data=True,
zip_safe=False,
platforms='any',
install_requires=[
'libthumbor>=1.3.0',
'thumbor>=5.0',
'libthumbor>=2.0.2',
'thumbor>=7.0.10',
],
extras_require={
'tests': [
Expand All @@ -29,7 +29,11 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Software Development :: Libraries :: Python Modules'
]
)
4 changes: 2 additions & 2 deletions tc_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from tc_core.importer import Importer


class Extensions(object):
class Extensions:

extensions = []

Expand Down Expand Up @@ -39,7 +39,7 @@ def register_module(cls, config_key, class_name, multiple=False):
Importer.register_module(config_key, class_name, multiple)


class Extension(object):
class Extension:

def __init__(self, name):
'''
Expand Down
7 changes: 2 additions & 5 deletions tc_core/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
# Use of this source code is governed by the MIT license that can be
# found in the LICENSE file.

import tornado.web
import tornado.ioloop

from thumbor.app import ThumborServiceApp
from thumbor.handlers import ContextHandler
from thumbor.utils import logger
Expand Down Expand Up @@ -46,7 +43,7 @@ def initialize(self, context):

ContextHandler.initialize = initialize

super(App, self).__init__(context)
super().__init__(context)

def get_handlers(self):
'''Return a list of tornado web handlers.
Expand All @@ -67,6 +64,6 @@ def get_handlers(self):

handlers.append(handler)

handlers.extend(super(App, self).get_handlers())
handlers.extend(super().get_handlers())

return handlers
2 changes: 1 addition & 1 deletion tc_core/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from thumbor.importer import Importer as ThumborImporter


class Importer(object):
class Importer:

_community_modules = []

Expand Down
9 changes: 5 additions & 4 deletions tc_core/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
else:
from tornado.routing import _unquote_or_none

class RequestParser(object):
class RequestParser:

_url_regex = None

Expand All @@ -36,15 +36,16 @@ def path_to_parameters(cls, path):
# unnamed groups, we want to use either groups
# or groupdict but not both.
if cls._url_regex.groupindex:
parameters = dict(
parameters = {
(str(k), _unquote_or_none(v))
for (k, v) in match.groupdict().items())
for (k, v) in match.groupdict().items()
}
else:
parameters = [
_unquote_or_none(s)
for s in match.groups()
]
else:
parameters = dict()
parameters = {}

return parameters
4 changes: 4 additions & 0 deletions vows/context_importer_vows.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class Importer(object):
detectors = []
filters = []
optimizers = []
compatibility_legacy_loader = None
compatibility_legacy_storage = None
compatibility_legacy_result_storage = None


class Extension(object):

Expand Down

0 comments on commit cf7e045

Please sign in to comment.