From ef34bf9eacb8f01977abaa6dc5c35dac769ea001 Mon Sep 17 00:00:00 2001 From: lottaviano Date: Thu, 4 Nov 2010 16:14:21 +0000 Subject: [PATCH] Add script to create a new board directory skeleton. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4500 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/create_board.py | 67 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 wizard/create_board.py diff --git a/wizard/create_board.py b/wizard/create_board.py new file mode 100755 index 00000000..c6cc0afc --- /dev/null +++ b/wizard/create_board.py @@ -0,0 +1,67 @@ +#/usr/bin/evn python +from __future__ import with_statement +import sys, os, shutil + +SPEC_TEMPLATE = "\ +name = 'Board name'\n\ +description = '''\n\ +\n\ +''' \ +" + +EXAMPLE = "\ +name='Examples'\n\ +ord=1\n\ +description='Full working example projects.'\n\ +" + +TEMPLATE = "\ +name = 'Templates'\n\ +ord = 0\n\ +description = 'Use these as a starting point for your BeRTOS project.'\n\ +" + +BENCHMARK = "\ +name='Benchmarks'\n\ +ord=2\n\ +description='Projects to measure different aspects of BeRTOS performance.'\n\ +" + +def makeBoardDir(dir_path, spec_tpl): + #spec_tpl is a template for .spec file + os.mkdir(dir_path) + with open(dir_path + '.spec', 'w') as f: + f.write(spec_tpl) + + +if len(sys.argv) < 4: + print "Usage: %s " % sys.argv[0] + exit(0) + +board_dir = sys.argv[1] + os.sep +board_img = sys.argv[2] +source_dir = sys.argv[3] + +# create board directory +if not os.path.exists(board_dir): + os.mkdir(board_dir) +else: + print "Board directory exists" + exit(1) + +with open(board_dir + ".spec", 'w') as f: + f.write(SPEC_TEMPLATE) + +# copy board image +shutil.copy(board_img, board_dir + ".image.png") + +# create hw/ directory +shutil.copytree(source_dir + "hw", board_dir + 'hw') + +#create examples, templates and benchmark directories together with .spec files +makeBoardDir(board_dir + "templates" + os.sep, TEMPLATE) +makeBoardDir(board_dir + 'examples' + os.sep, EXAMPLE) +makeBoardDir(board_dir + 'benchmark' + os.sep, BENCHMARK) + +print 'Done. Remember to fill in the description of your board in %s' % (board_dir + '.spec') + -- 2.25.1