Skip to content

Commit

Permalink
Drop dependency on setuptools/pkg_resources. Fixes #9.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed May 24, 2021
1 parent e7282cf commit 4317993
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
10 changes: 7 additions & 3 deletions cssutils/tests/basetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import sys
import unittest

try:
from importlib import resources
except ImportError:
import importlib_resources as resources

import cssutils


Expand All @@ -27,9 +32,8 @@ def get_resource_filename(resource_name):

def get_sheet_filename(sheet_name):
"""Get the filename for the given sheet."""
# Extract all sheets since they might use @import
sheet_dir = get_resource_filename('tests/sheets')
return os.path.join(sheet_dir, sheet_name)
# assume resources are on the file system
return resources.files('cssutils') / 'tests' / 'sheets' / sheet_name


class BaseTestCase(unittest.TestCase):
Expand Down
12 changes: 1 addition & 11 deletions examples/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,14 @@
"""
import codecs
import cssutils
import os
import sys
import webbrowser

# lxml egg may be in a lib dir below this file (not in SVN though)
sys.path.append(os.path.join(os.path.dirname(__file__), 'lib'))
try:
import pkg_resources

pkg_resources.require('lxml')
except pkg_resources.DistributionNotFound:
pass

try:
from lxml import etree
from lxml.cssselect import CSSSelector
except ImportError as e:
print('You need lxml for this example:', e)
print('lxml is required:', e)
sys.exit(1)


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ include_package_data = true
python_requires = >=3.6
install_requires =
importlib_metadata; python_version < "3.8"
setuptools
setup_requires = setuptools_scm[toml] >= 3.4.1

[options.packages.find]
Expand Down Expand Up @@ -59,6 +58,7 @@ testing =
mock
lxml
cssselect
importlib_resources; python_version < "3.9"

docs =
# upstream
Expand Down

0 comments on commit 4317993

Please sign in to comment.