Make mysql optdep

pictuga 2021-09-11 12:12:51 +02:00
parent 046f3f9f3d
commit 52e73331b8
2 changed files with 10 additions and 3 deletions

View File

@ -630,7 +630,10 @@ class BaseCache:
return True return True
try:
import sqlite3 # isort:skip import sqlite3 # isort:skip
except ImportError:
pass
class SQLiteCache(BaseCache): class SQLiteCache(BaseCache):
@ -667,7 +670,10 @@ class SQLiteCache(BaseCache):
self.con.execute('INSERT INTO data VALUES (?,?,?,?,?,?) ON CONFLICT(url) DO UPDATE SET code=?, msg=?, headers=?, data=?, timestamp=?', (url,) + value + value) self.con.execute('INSERT INTO data VALUES (?,?,?,?,?,?) ON CONFLICT(url) DO UPDATE SET code=?, msg=?, headers=?, data=?, timestamp=?', (url,) + value + value)
try:
import pymysql.cursors # isort:skip import pymysql.cursors # isort:skip
except ImportError:
pass
class MySQLCacheHandler(BaseCache): class MySQLCacheHandler(BaseCache):

View File

@ -13,7 +13,8 @@ setup(
download_url = 'https://git.pictuga.com/pictuga/morss', download_url = 'https://git.pictuga.com/pictuga/morss',
license = 'AGPL v3', license = 'AGPL v3',
packages = [package_name], packages = [package_name],
install_requires = ['lxml', 'bs4', 'python-dateutil', 'chardet', 'pymysql'], install_requires = ['lxml', 'bs4', 'python-dateutil', 'chardet'],
extras_require = {'full': ['pymysql']},
package_data = {package_name: ['feedify.ini']}, package_data = {package_name: ['feedify.ini']},
data_files = [ data_files = [
('share/' + package_name, ['README.md', 'LICENSE']), ('share/' + package_name, ['README.md', 'LICENSE']),