7 from os.path import exists, join
14 FILES = ('config.py', 'utils.py', 'client.py', 'cli.py')
17 def cat(path, dst, skipheader=True):
21 for line in open(path):
22 if in_header and line.strip() and not line.startswith('#'):
25 if line.startswith('from kamaki.'):
26 continue # Skip local imports
28 if skipheader and in_header:
35 if not exists(DSTDIR):
37 dstpath = join(DSTDIR, DST)
39 dst = open(dstpath, 'w')
41 dst.write('#!/usr/bin/env python\n')
43 cat(join(SRCDIR, '__init__.py'), dst, skipheader=False)
46 cat(join(SRCDIR, file), dst)
50 # Make file executable
51 mode = stat.S_IMODE(os.stat(dstpath).st_mode)
53 os.chmod(dstpath, mode)
56 if __name__ == '__main__':