summaryrefslogtreecommitdiff
path: root/morphlib/plugins/deploy_plugin.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-04-16 14:19:10 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-04-16 14:19:10 +0100
commit867d193648723e23ce31974b625116656512b52b (patch)
tree03cb87928dcba8d44d10d949092c798d889d8500 /morphlib/plugins/deploy_plugin.py
parente7e90384da00a8197c5e0363a5a4005754a790eb (diff)
downloadmorph-867d193648723e23ce31974b625116656512b52b.tar.gz
Give better error message if extension is not executable
Diffstat (limited to 'morphlib/plugins/deploy_plugin.py')
-rw-r--r--morphlib/plugins/deploy_plugin.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py
index 94ac8a75..7a6f2b92 100644
--- a/morphlib/plugins/deploy_plugin.py
+++ b/morphlib/plugins/deploy_plugin.py
@@ -18,6 +18,7 @@ import cliapp
import gzip
import os
import shutil
+import stat
import tarfile
import tempfile
import urlparse
@@ -206,6 +207,9 @@ class DeployPlugin(cliapp.Plugin):
if not os.path.exists(ext_filename):
raise morphlib.Error(
'Could not find extension %s%s' % (name, kind))
+ if not self._is_executable(ext_filename):
+ raise morphlib.Error(
+ 'Extension not executable: %s' % ext_filename)
delete_ext = False
else:
# Found it in the system morphology's repository.
@@ -222,6 +226,11 @@ class DeployPlugin(cliapp.Plugin):
if delete_ext:
os.remove(ext_filename)
+
+ def _is_executable(self, filename):
+ st = os.stat(filename)
+ mask = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
+ return (stat.S_IMODE(st.st_mode) & mask) != 0
def _cat_file(self, repo_dir, ref, pathname):
'''Retrieve contents of a file from a git repository.'''