Commit dabf31bc authored by shadMod's avatar shadMod 💬

replaced pkg_resources with os.path

parent 7cafc9c0
......@@ -24,32 +24,28 @@ import collections
import flask
import itsdangerous
import requests
import pkg_resources
from . import cache
from . import launchpad
CONFIG_FILE = "data/downloads.toml"
CONFIG_FILE = "/data/downloads.toml"
CACHE_FILE = "download-cache.json"
CACHE_FILE_VERSION = 1
class Downloads:
def __init__(self, data_path):
# Load the configuration
raw = pkg_resources.resource_string("uitwww", CONFIG_FILE)
self.config = toml.loads(
raw.decode("utf-8"),
_dict=collections.OrderedDict,
path = os.path.dirname(os.path.abspath(__file__)) + CONFIG_FILE
self.config = toml.load(
path, # _dict=collections.OrderedDict,
)
self._strip_non_lts_releases()
# Save the hash of the configuration
self._config_hash = "sha1=%s" % hashlib.sha1(raw).hexdigest()
with open(path, "rb") as raw:
self._config_hash = "sha1=%s" % hashlib.sha1(raw.read()).hexdigest()
self._cache_file = os.path.join(data_path, CACHE_FILE)
@property
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment