Skip to content

Commit

Permalink
Merge pull request #514 from loris-imageserver/py38
Browse files Browse the repository at this point in the history
support python 3.8, remove support for python 3.5 (includes PR #513 changes)
  • Loading branch information
bcail authored Oct 15, 2020
2 parents 3c641eb + 8477ffb commit 614e1ab
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 56 deletions.
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ addons:
language: python

python:
- 3.5
- 3.6
- 3.7
- 3.8

jobs:
allow_failures:
- python: 3.8

install:
- pip install -r requirements_test.txt

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
26 changes: 13 additions & 13 deletions loris/user_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@


CONFIG_FILE_NAME = 'loris2.conf'
CONFIG_DIR_DEFAULT = '/etc/loris2'
CONFIG_DIR_TARGET_DEFAULT = '/etc/loris2'
WSGI_FILE_NAME = 'loris2.wsgi'


def _src_code_repo_root():
return os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def _data_directory_path():
return os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data')


def _config_file_path():
return os.path.join(_src_code_repo_root(), 'etc', CONFIG_FILE_NAME)
return os.path.join(_data_directory_path(), CONFIG_FILE_NAME)


def _get_default_config_content():
Expand All @@ -35,24 +35,24 @@ def _get_default_wsgi():

def _write_wsgi(config):
wsgi_content = _get_default_wsgi()
www_dir = config['loris.Loris']['www_dp']
wsgi_file_path = os.path.join(www_dir, WSGI_FILE_NAME)
www_target = config['loris.Loris']['www_dp']
wsgi_file_path = os.path.join(www_target, WSGI_FILE_NAME)
with open(wsgi_file_path, 'w') as f:
f.write(wsgi_content)


def _write_config():
config_file_target = os.path.join(CONFIG_DIR_DEFAULT, CONFIG_FILE_NAME)
config_file_target = os.path.join(CONFIG_DIR_TARGET_DEFAULT, CONFIG_FILE_NAME)
with open(config_file_target, 'wb') as f:
f.write(_get_default_config_content().encode('utf8'))

def _copy_index_and_favicon(config):
www_dir = config['loris.Loris']['www_dp']
www_src = os.path.join(_src_code_repo_root(), 'www')
www_target = config['loris.Loris']['www_dp']
www_src = os.path.join(_data_directory_path(), 'www')
index_src = os.path.join(www_src, 'index.txt')
favicon_src = os.path.join(www_src, 'icons/favicon.ico')
index_target = os.path.join(www_dir, 'index.txt')
favicon_target_dir = os.path.join(www_dir, 'icons')
index_target = os.path.join(www_target, 'index.txt')
favicon_target_dir = os.path.join(www_target, 'icons')
favicon_target = os.path.join(favicon_target_dir, 'favicon.ico')
os.makedirs(favicon_target_dir, exist_ok=True)
shutil.copyfile(index_src, index_target)
Expand All @@ -64,12 +64,12 @@ def _make_directories(config):
info_cache = config['img_info.InfoCache']['cache_dp']
log_dir = config['logging']['log_dir']
tmp_dir = config['transforms']['jp2']['tmp_dp']
www_dir = config['loris.Loris']['www_dp']
www_target = config['loris.Loris']['www_dp']
loris_directories = [
image_cache,
info_cache,
tmp_dir,
www_dir,
www_target,
log_dir,
]
for d in loris_directories:
Expand Down
7 changes: 4 additions & 3 deletions loris/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,22 @@
def get_debug_config(debug_jp2_transformer):
# change a few things, read the config and set up logging
project_dp = path.dirname(path.dirname(path.realpath(__file__)))
config_file_path = path.join(project_dp, 'etc', 'loris2.conf')
data_directory = path.join(project_dp, 'loris', 'data')
config_file_path = path.join(data_directory, 'loris2.conf')

config = read_config(config_file_path)

config['logging']['log_to'] = 'console'
config['logging']['log_level'] = 'DEBUG'

# override some stuff to look at relative or tmp directories.
config['loris.Loris']['www_dp'] = path.join(project_dp, 'www')
config['loris.Loris']['www_dp'] = path.join(data_directory, 'www')
config['loris.Loris']['tmp_dp'] = '/tmp/loris/tmp'
config['loris.Loris']['enable_caching'] = True
config['img.ImageCache']['cache_dp'] = '/tmp/loris/cache/img'
config['img_info.InfoCache']['cache_dp'] = '/tmp/loris/cache/info'
config['resolver']['impl'] = 'loris.resolver.SimpleFSResolver'
config['resolver']['src_img_root'] = path.join(project_dp,'tests','img')
config['resolver']['src_img_root'] = path.join(project_dp, 'tests', 'img')
config['transforms']['target_formats'] = [ 'jpg', 'png', 'gif', 'webp', 'tif']

if debug_jp2_transformer == 'opj':
Expand Down
20 changes: 10 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements.txt requirements.in
# pip-compile requirements.in
#
asn1crypto==0.24.0 # via cryptography
attrs==17.4.0
attrs==20.2.0 # via -r requirements.in
certifi==2018.1.18 # via requests
cffi==1.11.5 # via cryptography
cffi==1.14.3 # via cryptography
chardet==3.0.4 # via requests
configobj==5.0.0
cryptography==2.3
configobj==5.0.0 # via -r requirements.in
cryptography==2.3 # via -r requirements.in
idna==2.6 # via cryptography, requests
netaddr==0.7.19
pillow==6.2.0
netaddr==0.7.19 # via -r requirements.in
pillow==6.2.0 # via -r requirements.in
pycparser==2.18 # via cffi
pyjwt==1.5.3
requests==2.20.0
pyjwt==1.5.3 # via -r requirements.in
requests==2.20.0 # via -r requirements.in
six==1.11.0 # via cryptography
urllib3==1.22 # via requests
werkzeug==0.15.3
werkzeug==0.15.3 # via -r requirements.in
54 changes: 29 additions & 25 deletions requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,37 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements_test.txt requirements_test.in
# pip-compile requirements_test.in
#
asn1crypto==0.24.0
attrs==17.4.0
certifi==2018.1.18
cffi==1.11.5
chardet==3.0.4
configobj==5.0.0
coverage==4.4.1
cryptography==2.3
flake8==3.5.0
hypothesis==3.46.1
idna==2.6
asn1crypto==0.24.0 # via -r requirements.txt, cryptography
attrs==20.2.0 # via -r requirements.txt, hypothesis
certifi==2018.1.18 # via -r requirements.txt, requests
cffi==1.14.3 # via -r requirements.txt, cryptography
chardet==3.0.4 # via -r requirements.txt, requests
configobj==5.0.0 # via -r requirements.txt
coverage==4.4.1 # via -r requirements_test.in, pytest-cov
cryptography==2.3 # via -r requirements.txt
flake8==3.8.4 # via -r requirements_test.in
hypothesis==5.37.1 # via -r requirements_test.in
idna==2.6 # via -r requirements.txt, cryptography, requests
mccabe==0.6.1 # via flake8
mock==2.0.0 # via responses
netaddr==0.7.19
netaddr==0.7.19 # via -r requirements.txt
pbr==3.1.1 # via mock
pillow==6.2.0
pillow==6.2.0 # via -r requirements.txt
py==1.5.2 # via pytest
pycodestyle==2.3.1 # via flake8
pycparser==2.18
pyflakes==1.6.0 # via flake8
pyjwt==1.5.3
pytest-cov==2.5.1
pytest==3.1.3
requests==2.20.0
responses==0.3.0
six==1.11.0
urllib3==1.22
werkzeug==0.15.3
pycodestyle==2.6.0 # via flake8
pycparser==2.18 # via -r requirements.txt, cffi
pyflakes==2.2.0 # via flake8
pyjwt==1.5.3 # via -r requirements.txt
pytest-cov==2.5.1 # via -r requirements_test.in
pytest==3.1.3 # via -r requirements_test.in, pytest-cov
requests==2.20.0 # via -r requirements.txt, responses
responses==0.3.0 # via -r requirements_test.in
six==1.11.0 # via -r requirements.txt, cryptography, mock, responses
sortedcontainers==2.2.2 # via hypothesis
urllib3==1.22 # via -r requirements.txt, requests
werkzeug==0.15.3 # via -r requirements.txt

# The following packages are considered to be unsafe in a requirements file:
# setuptools
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def _read(fname):
license='Simplified BSD',
version=VERSION,
packages=['loris'],
package_data={
'loris': ['data/*', 'data/www/*', 'data/www/icons/*'],
},
install_requires=install_requires,
)

0 comments on commit 614e1ab

Please sign in to comment.