Revert "[Plugins] Replace pkg_resources for abspath and decode path"

This reverts commit 85364dc8ab8d42feb2d5ce38bfe1410e2309453f.
This commit is contained in:
Calum Lind 2017-06-16 11:15:19 +01:00
parent 2b90f309a6
commit 3893d3e214
11 changed files with 33 additions and 57 deletions

View File

@ -14,12 +14,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os.path from os.path import join
from deluge.common import decode_bytes from deluge.common import resource_filename
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
def get_resource(filename): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.autoadd', join('data', filename))

View File

@ -14,17 +14,15 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os.path
from functools import wraps from functools import wraps
from os.path import join
from sys import exc_info from sys import exc_info
from deluge.common import decode_bytes from deluge.common import resource_filename
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
def get_resource(filename): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.blocklist', join('data', filename))
def raises_errors_as(error): def raises_errors_as(error):

View File

@ -14,12 +14,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os.path from os.path import join
from deluge.common import decode_bytes from deluge.common import resource_filename
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
def get_resource(filename): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.execute', join('data', filename))

View File

@ -14,12 +14,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os.path from os.path import join
from deluge.common import decode_bytes from deluge.common import resource_filename
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
def get_resource(filename): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.extractor', join('data', filename))

View File

@ -14,12 +14,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os.path from os.path import join
from deluge.common import decode_bytes from deluge.common import resource_filename
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
def get_resource(filename): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.label', join('data', filename))

View File

@ -15,21 +15,19 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import logging import logging
import os.path from os.path import join
from twisted.internet import defer from twisted.internet import defer
from deluge import component from deluge import component
from deluge.common import decode_bytes from deluge.common import resource_filename
from deluge.event import known_events from deluge.event import known_events
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
def get_resource(filename): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.notifications', join('data', filename))
class CustomNotifications(object): class CustomNotifications(object):

View File

@ -14,12 +14,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os.path from os.path import join
from deluge.common import decode_bytes from deluge.common import resource_filename
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
def get_resource(filename): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.scheduler', join('data', filename))

View File

@ -14,12 +14,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os.path from os.path import join
from deluge.common import decode_bytes from deluge.common import resource_filename
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
def get_resource(filename): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.stats', join('data', filename))

View File

@ -14,12 +14,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os.path from os.path import join
from deluge.common import decode_bytes from deluge.common import resource_filename
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
def get_resource(filename): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.toggle', join('data', filename))

View File

@ -14,12 +14,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os.path from os.path import join
from deluge.common import decode_bytes from deluge.common import resource_filename
BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__)))
def get_resource(filename): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.webui', join('data', filename))

View File

@ -213,16 +213,12 @@ setup(
COMMON = """ COMMON = """
from __future__ import unicode_literals from __future__ import unicode_literals
import os.path from os.path import join
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): def get_resource(filename):
return os.path.join(BASE_PATH, 'data', filename) return resource_filename('deluge.plugins.%(safe_name)s', join('data', filename))
""" """
GTKUI = """ GTKUI = """