Skip to content

Commit

Permalink
Alter path sanity check to allow PATH lookup, rather than requiring
Browse files Browse the repository at this point in the history
absolute paths.

(partial cherrypick from b35ddbf)
  • Loading branch information
wagnerrp committed Feb 16, 2011
1 parent e414577 commit 90f48c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mythtv/bindings/python/MythTV/static.py
Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions mythtv/bindings/python/MythTV/system.py
Expand Up @@ -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 = ''

Expand Down

0 comments on commit 90f48c8

Please sign in to comment.