Skip to content
Snippets Groups Projects
Commit 87f50598 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

test

parent f8f73ac9
No related branches found
No related tags found
No related merge requests found
Pipeline #620 failed
...@@ -6,12 +6,14 @@ Run when ...@@ -6,12 +6,14 @@ Run when
- their README.md is changed - their README.md is changed
""" """
from __future__ import print_function, absolute_import, division from __future__ import print_function, absolute_import, division
import os import os
import os.path import os.path
import sys import sys
PREFIX = 'henrietta/' PREFIX = 'henrietta/'
def readfile(path, prefix=None, lines=False, strip=True): def readfile(path, prefix=None, lines=False, strip=True):
if prefix is not None: if prefix is not None:
path = os.path.join(prefix, path) path = os.path.join(prefix, path)
...@@ -27,6 +29,7 @@ def readfile(path, prefix=None, lines=False, strip=True): ...@@ -27,6 +29,7 @@ def readfile(path, prefix=None, lines=False, strip=True):
d = d.strip() d = d.strip()
return d return d
def writefile(content, path, prefix=None): def writefile(content, path, prefix=None):
if prefix is not None: if prefix is not None:
path = os.path.join(prefix, path) path = os.path.join(prefix, path)
...@@ -37,9 +40,10 @@ def writefile(content, path, prefix=None): ...@@ -37,9 +40,10 @@ def writefile(content, path, prefix=None):
for piece in content: for piece in content:
f.write(piece) f.write(piece)
if __name__ == '__main__': if __name__ == '__main__':
dirs = [dir for dir in os.listdir('.') if os.path.isdir(dir) or (dir != '.git')] 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')] boxes = [box for box in dirs if exi(box, '') or exi(box, '_as_vagrant')]
if len(sys.argv) == 1: if len(sys.argv) == 1:
...@@ -142,7 +146,7 @@ build_$BOX: ...@@ -142,7 +146,7 @@ build_$BOX:
}] }]
} }
'''.replace('$DESCRIPTION', description).replace('$BOX', box).replace('$PREFIX', PREFIX).replace('$VERSION', VERSION), '''.replace('$DESCRIPTION', description).replace('$BOX', box).replace('$PREFIX', PREFIX).replace('$VERSION', VERSION),
'metadata.json') 'metadata.json')
if len(sys.argv) == 3: if len(sys.argv) == 3:
if sys.argv[-2] == 'newbox': if sys.argv[-2] == 'newbox':
...@@ -175,4 +179,3 @@ content of Vagrantfile that will refer to this box. ...@@ -175,4 +179,3 @@ content of Vagrantfile that will refer to this box.
# You can delete it if you want to. # You can delete it if you want to.
# cd into a directory if you depend on a particular working directory. # cd into a directory if you depend on a particular working directory.
''', 'build_as_vagrant.sh', box) ''', 'build_as_vagrant.sh', box)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment