fixed syntax checker

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-07-22 18:27:16 +00:00
parent 32580a8458
commit eefc8c6086
1 changed files with 7 additions and 1 deletions

View File

@ -212,7 +212,13 @@ class PythonSetLib(method.Method):
class PythonCheckSyntax(method.Method): class PythonCheckSyntax(method.Method):
'''Check the syntax of the current python file''' '''Check the syntax of the current python file'''
def _execute(self, w, **vargs): def _execute(self, w, **vargs):
mod = os.path.splitext(os.path.basename(w.buffer.path))[0] mod = os.path.splitext(w.buffer.path)[0]
cwd = os.getcwd() + '/'
if mod.startswith(cwd):
mod = mod.replace(cwd, '', 1)
else:
mod = os.path.basename(mod)
mod = mod.replace('/', '.')
cmd = "PYTHONPATH=%s python -c 'import %s'" % (w.mode.pythonlib, mod) cmd = "PYTHONPATH=%s python -c 'import %s'" % (w.mode.pythonlib, mod)
(status, output) = commands.getstatusoutput(cmd) (status, output) = commands.getstatusoutput(cmd)
if status == 0: if status == 0: