Permalink
Browse files

Alter path sanity check to allow PATH lookup, rather than requiring

absolute paths.

(partial cherrypick from b35ddbf)
  • Loading branch information...
1 parent e414577 commit 90f48c8ffd9681d79bd5d3c48c6b5e42172c967c @wagnerrp wagnerrp committed Feb 16, 2011
Showing with 16 additions and 3 deletions.
  1. +1 −1 mythtv/bindings/python/MythTV/static.py
  2. +15 −2 mythtv/bindings/python/MythTV/system.py
@@ -4,7 +4,7 @@
Contains any static and global variables for MythTV Python Bindings
"""
-OWN_VERSION = (0,24,0,1)
+OWN_VERSION = (0,24,0,2)
SCHEMA_VERSION = 1264
MVSCHEMA_VERSION = 1038
NVSCHEMA_VERSION = 1007
@@ -36,8 +36,21 @@ def __init__(self, path=None, setting=None, db=None):
if path is None:
raise MythError('Invalid input to System()')
self.path = path
- if not os.access(self.path, os.F_OK):
- raise MythFileError('Defined grabber path does not exist.')
+
+ cmd = self.path.split()[0]
+ if self.path.startswith('/'):
+ # test full given path
+ if not os.access(cmd, os.F_OK):
+ raise MythFileError('Defined executable path does not exist.')
+ else:
+ # search command from PATH
+ for folder in os.environ['PATH'].split(':'):
+ if os.access(os.path.join(folder,cmd), os.F_OK):
+ self.path = os.path.join(folder,self.path)
+ break
+ else:
+ raise MythFileError('Defined executable path does not exist.')
+
self.returncode = 0
self.stderr = ''

0 comments on commit 90f48c8

Please sign in to comment.