workaround for python 3.6s behaviour with BEGIN EXCLUSIVE in sqlite

This commit is contained in:
Mike Fährmann
2017-01-11 00:17:02 +01:00
parent 8780abcc77
commit 989820d719
3 changed files with 14 additions and 8 deletions

View File

@@ -1,11 +1,14 @@
sudo: false sudo: false
language: python language: python
python: python:
- "3.3" - 3.3
- "3.4" - 3.4
- "3.5" - 3.5
- 3.6
install: install:
- pip install -r requirements.txt - pip install -r requirements.txt
script: script:
- if [[ $TRAVIS_PYTHON_VERSION != '3.3' ]]; then nosetests --ignore-files=test_extractors --verbose test; fi - if [[ $TRAVIS_PYTHON_VERSION != '3.6' ]]; then nosetests --ignore-files=test_extractors --verbose test; fi
- if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then nosetests --verbose test; fi - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then nosetests --verbose test; fi
git:
depth: 10

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2016 Mike Fährmann # Copyright 2016-2017 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@@ -123,7 +123,10 @@ class DatabaseCache(CacheModule):
key, timestamp = key key, timestamp = key
try: try:
cursor = self.db.cursor() cursor = self.db.cursor()
cursor.execute("BEGIN EXCLUSIVE") try:
cursor.execute("BEGIN EXCLUSIVE")
except sqlite3.OperationalError:
"""workaround for python 3.6"""
cursor.execute("SELECT value, expires FROM data WHERE key=?", (key,)) cursor.execute("SELECT value, expires FROM data WHERE key=?", (key,))
value, expires = cursor.fetchone() value, expires = cursor.fetchone()
if timestamp < expires: if timestamp < expires:

View File

@@ -56,7 +56,7 @@ if __name__ == '__main__' and len(sys.argv) > 1:
] ]
del sys.argv[1:] del sys.argv[1:]
skip = ("exhentai", "kissmanga") skip = ("deviantart"1, "kissmanga")
for extr in extractors: for extr in extractors:
if extr.category in skip: if extr.category in skip:
continue continue