diff --git a/make.py b/make.py index 5c9088545bebf5369ebc5dd0adcde4d1ae238366..f5f97cdb25d21a45281d1644d7ed1e3d268261c0 100644 --- a/make.py +++ b/make.py @@ -6,12 +6,14 @@ Run when - their README.md is changed """ from __future__ import print_function, absolute_import, division + import os import os.path import sys PREFIX = 'henrietta/' + def readfile(path, prefix=None, lines=False, strip=True): if prefix is not None: path = os.path.join(prefix, path) @@ -27,6 +29,7 @@ def readfile(path, prefix=None, lines=False, strip=True): d = d.strip() return d + def writefile(content, path, prefix=None): if prefix is not None: path = os.path.join(prefix, path) @@ -37,9 +40,10 @@ def writefile(content, path, prefix=None): for piece in content: f.write(piece) + if __name__ == '__main__': dirs = [dir for dir in os.listdir('.') if os.path.isdir(dir) or (dir != '.git')] - exi = lambda box, sup: os.path.exists(os.path.join(box, 'build%s.sh' % (sup, ))) + exi = lambda box, sup: os.path.exists(os.path.join(box, 'build%s.sh' % (sup,))) boxes = [box for box in dirs if exi(box, '') or exi(box, '_as_vagrant')] if len(sys.argv) == 1: @@ -142,7 +146,7 @@ build_$BOX: }] } '''.replace('$DESCRIPTION', description).replace('$BOX', box).replace('$PREFIX', PREFIX).replace('$VERSION', VERSION), - 'metadata.json') + 'metadata.json') if len(sys.argv) == 3: if sys.argv[-2] == 'newbox': @@ -175,4 +179,3 @@ content of Vagrantfile that will refer to this box. # You can delete it if you want to. # cd into a directory if you depend on a particular working directory. ''', 'build_as_vagrant.sh', box) -