Skip to content

Commit

Permalink
fix: remove pkg_resources dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
fdintino committed Jul 11, 2024
1 parent 380c9c2 commit 65f39dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 1 addition & 5 deletions selenosis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
#
# without running afoul of the strict import order required by Django 1.9+.
# This implementation is shamelessly stolen from werkzeug's ``__init__.py``.
import pkg_resources
import sys
from types import ModuleType

try:
__version__ = pkg_resources.get_distribution('django-selenosis').version
except pkg_resources.DistributionNotFound:
__version__ = None
__version__ = "2.0.5"

# import mapping to objects in other modules
all_by_module = {
Expand Down
16 changes: 15 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
#!/usr/bin/env python
from os import path
import re

from setuptools import setup, find_packages


# Find the package version in __init__.py without importing it
init_file = path.join(path.dirname(__file__), "selenosis", "__init__.py")
with open(init_file) as f:
for line in f:
m = re.search(r"""^__version__ = (['"])(.+?)\1$""", line)
if m is not None:
version = m.group(2)
break
else:
raise LookupError("Unable to find __version__ in " + init_file)



def read(*parts):
file_path = path.join(path.dirname(__file__), *parts)
return open(file_path).read()


setup(
name='django-selenosis',
version='2.0.5',
version=version,
license='BSD',
description='Helpers for writing selenium tests for Django',
long_description=read('README.rst'),
Expand Down

0 comments on commit 65f39dd

Please sign in to comment.