mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-04-02 20:32:26 +02:00
37 lines
1.3 KiB
Diff
37 lines
1.3 KiB
Diff
diff --git a/sassutils/wsgi.py b/sassutils/wsgi.py
|
|
index d29fa824f353..f2232b88232f 100644
|
|
--- a/sassutils/wsgi.py
|
|
+++ b/sassutils/wsgi.py
|
|
@@ -6,7 +6,18 @@ import collections.abc
|
|
import logging
|
|
import os.path
|
|
|
|
-from pkg_resources import resource_filename
|
|
+# For getting resources filenames, we now use importlib.resources
|
|
+from contextlib import ExitStack
|
|
+from sys import version_info
|
|
+
|
|
+# However, we check the Python version in order to still support older
|
|
+# versions which don't support importlib.resources (backwards compatibility)
|
|
+if version_info >= (3, 7):
|
|
+ # Use importlib.resources for Python 3.7 and later
|
|
+ from importlib import resources
|
|
+else:
|
|
+ # Use importlib_resources for Python 3.6 and earlier
|
|
+ import importlib_resources as resources
|
|
|
|
from .builder import Manifest
|
|
from sass import CompileError
|
|
@@ -107,7 +118,9 @@ class SassMiddleware:
|
|
for package_name in self.manifests:
|
|
if package_name in self.package_dir:
|
|
continue
|
|
- path = resource_filename(package_name, '')
|
|
+ ref = resources.files(package_name) / 'resource.dat'
|
|
+ with resources.as_file(ref) as res_path:
|
|
+ path = res_path
|
|
self.package_dir[package_name] = path
|
|
self.paths = []
|
|
for package_name, manifest in self.manifests.items():
|
|
|