mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-24 18:29:12 +00:00
[Plugins] Replace pkg_resources for abspath and decode path
- Use a BASE_PATH constant. - pkg_resources caches the files in python_egg_cache which is not required for plugins and causes issues with non-ascii paths.
This commit is contained in:
parent
bdb3b509ad
commit
85364dc8ab
@ -14,10 +14,12 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from os.path import join
|
||||
import os.path
|
||||
|
||||
from deluge.common import resource_filename
|
||||
from deluge.common import decode_bytes
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.autoadd', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
@ -9,15 +9,17 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os.path
|
||||
from functools import wraps
|
||||
from os.path import join
|
||||
from sys import exc_info
|
||||
|
||||
from deluge.common import resource_filename
|
||||
from deluge.common import decode_bytes
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.blocklist', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
||||
|
||||
def raises_errors_as(error):
|
||||
|
@ -9,10 +9,12 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from os.path import join
|
||||
import os.path
|
||||
|
||||
from deluge.common import resource_filename
|
||||
from deluge.common import decode_bytes
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.execute', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
@ -9,10 +9,12 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from os.path import join
|
||||
import os.path
|
||||
|
||||
from deluge.common import resource_filename
|
||||
from deluge.common import decode_bytes
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.extractor', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
@ -9,10 +9,12 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from os.path import join
|
||||
import os.path
|
||||
|
||||
from deluge.common import resource_filename
|
||||
from deluge.common import decode_bytes
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.label', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
@ -15,19 +15,21 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
from os.path import join
|
||||
import os.path
|
||||
|
||||
from twisted.internet import defer
|
||||
|
||||
from deluge import component
|
||||
from deluge.common import resource_filename
|
||||
from deluge.common import decode_bytes
|
||||
from deluge.event import known_events
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.notifications', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
||||
|
||||
class CustomNotifications(object):
|
||||
|
@ -13,10 +13,12 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from os.path import join
|
||||
import os.path
|
||||
|
||||
from deluge.common import resource_filename
|
||||
from deluge.common import decode_bytes
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.scheduler', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
@ -9,10 +9,12 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from os.path import join
|
||||
import os.path
|
||||
|
||||
from deluge.common import resource_filename
|
||||
from deluge.common import decode_bytes
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.stats', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
@ -14,10 +14,12 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from os.path import join
|
||||
import os.path
|
||||
|
||||
from deluge.common import resource_filename
|
||||
from deluge.common import decode_bytes
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.toggle', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
@ -13,10 +13,12 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from os.path import join
|
||||
import os.path
|
||||
|
||||
from deluge.common import resource_filename
|
||||
from deluge.common import decode_bytes
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.webui', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
@ -210,12 +210,16 @@ COMMON = """
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from os.path import join
|
||||
import os.path
|
||||
|
||||
from deluge.common import decode_bytes
|
||||
|
||||
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
from deluge.common import resource_filename
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename('deluge.plugins.%(safe_name)s', join('data', filename))
|
||||
return os.path.join(BASE_PATH, 'data', filename)
|
||||
|
||||
"""
|
||||
|
||||
GTKUI = """
|
||||
|
Loading…
x
Reference in New Issue
Block a user