1
1
mirror of https://github.com/eblot/pybootd.git synced 2024-10-27 00:51:54 +03:00

Make pkg_resources an optional module dependency

This commit is contained in:
David Decotigny 2013-03-05 17:56:14 -08:00
parent 2e88c19568
commit 8112480bee
3 changed files with 13 additions and 4 deletions

View File

@ -23,9 +23,11 @@ Python
- Python_ 2.6 or above is required. Python_ 3.x is not yet supported.
- Netifaces_ Python module
- Optional: python-pkg-resources_ Python module
.. _Python: http://python.org/
.. _Netifaces: http://alastairs-place.net/netifaces/
.. _python-pkg-resources: http://pythonhosted.org/distribute/pkg_resources.html
Permissions
-----------

View File

@ -21,7 +21,11 @@ import os
import sys
def _get_package_name(default='', version='1.5.0'):
try:
from pkg_resources import WorkingSet
except ImportError:
ws = []
else:
ws = WorkingSet()
_path, _ = os.path.split(os.path.dirname( \
sys.modules['pybootd'].__file__))
@ -48,9 +52,12 @@ def pybootd_path(path):
else:
try:
from pkg_resources import Requirement, resource_filename
from pkg_resources import get_distribution
except ImportError:
raise IOError('pkg_resources module not available')
try:
newpath = resource_filename(Requirement.parse(PRODUCT_NAME), path)
if not newpath:
from pkg_resources import get_distribution
localpath = get_distribution(PRODUCT_NAME).location
newpath = os.path.join(localpath, path)
except KeyError:

View File

@ -36,7 +36,7 @@ setup(
url='http://github.com/eblot/pybootd',
download_url='https://github.com/eblot/pybootd/tarball/master',
packages=['pybootd'],
requires=['netifaces (>= 0.5)'],
# requires=['netifaces (>= 0.5)'],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: No Input/Output (Daemon)',