waf

FORK: waf with some random patches
git clone https://git.neptards.moe/neptards/waf.git
Log | Files | Refs | README

wscript (621B)


      1 #! /usr/bin/env python
      2 # encoding: utf-8
      3 # Matt Clarkson, 2015 (ita)
      4 
      5 VERSION='0.0.1'
      6 APPNAME='json_test'
      7 
      8 top = '.'
      9 
     10 import sys
     11 import waflib.Configure
     12 waflib.Configure.autoconfig = True
     13 
     14 def options(opt):
     15 	opt.add_option(
     16 		'--pretty',
     17 		action  = 'store_true',
     18 		help    = 'pretty prints the writing of the JSON')
     19 
     20 def configure(conf):
     21 	pass
     22 
     23 def build(bld):
     24 	node = bld.srcnode.make_node('test.json')
     25 	json = node.read_json()
     26 	print('Read', json)
     27 	json['new_key'] = {
     28 		'number': 199
     29 	}
     30 	output = bld.bldnode.make_node('output.json')
     31 	output.write_json(json, pretty=bld.options.pretty)
     32 	print('Wrote', output.read())