diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-11-11 16:02:56 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-11-11 16:02:56 +0000 |
commit | 86487edbf05f712bf6b351ae639cd10bcf87ba63 (patch) | |
tree | 11868958914713bfd42d9dba6a563365ed706ef1 /setup.py | |
parent | 248910daf2da468c4c11b8edbf7cfdf0725918b2 (diff) | |
download | import-86487edbf05f712bf6b351ae639cd10bcf87ba63.tar.gz |
setup.py: Force import extensions to have execute permissions preserved
Code for this was taken from Morph's setup.py file.
It would possibly be more correct to install these files into a
subdirectory of /usr/libexec but it'd be a more complex solution for
little actual benefit.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -18,6 +18,29 @@ from distutils.core import setup +from distutils.command.build import build + +import os +import os.path +import stat + + +class GenerateResources(build): + + def run(self): + build.run(self) + + # Set exec permissions on import extensions. + for dirname, subdirs, basenames in os.walk('baserockimport/exts'): + for basename in basenames: + orig = os.path.join(dirname, basename) + built = os.path.join('build/lib', dirname, basename) + st = os.lstat(orig) + bits = (st.st_mode & + (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)) + if bits != 0: + st2 = os.lstat(built) + os.chmod(built, st2.st_mode | bits) setup(name='baserockimport', @@ -44,4 +67,7 @@ setup(name='baserockimport', 'exts/*', ] }, + cmdclass={ + 'build': GenerateResources, + } ) |