done
-# build the releases.json. this reads in the yaml version and dumps
-# out the json representation of the same file. the resulting releases.json
-# should be served from the root of hosted site.
-$vdir/bin/python << EOF > $TOPDIR/build-doc/output/html/_static/releases.json
-from __future__ import print_function
-import datetime
-import json
-import yaml
-
-def json_serialize(obj):
- if isinstance(obj, datetime.date):
- return obj.isoformat()
-
-with open("$TOPDIR/doc/releases/releases.yml", 'r') as fp:
- releases = yaml.safe_load(fp)
- print(json.dumps(releases, indent=2, default=json_serialize))
-EOF
-
#
# Build and install JavaDocs
#
+import datetime
import fileinput
+import json
+import os
import shutil
import sys
-import os
+
+import yaml
# project information
project = 'Ceph'
sys.path.insert(0, pybind)
+# build the releases.json. this reads in the yaml version and dumps
+# out the json representation of the same file. the resulting releases.json
+# should be served from '/_static/releases.json' of hosted site.
+def yaml_to_json(input_path, output_path):
+ def json_serialize(obj):
+ if isinstance(obj, datetime.date):
+ return obj.isoformat()
+
+ yaml_fn = os.path.join(top_level, input_path)
+ json_fn = os.path.join(top_level, output_path)
+
+ def process(app):
+ with open(yaml_fn) as input:
+ with open(json_fn, 'w') as output:
+ releases = yaml.safe_load(input)
+ s = json.dumps(releases, indent=2, default=json_serialize)
+ output.write(s)
+
+ return process
+
+
# handles edit-on-github and old version warning display
def setup(app):
app.add_js_file('js/ceph.js')
generate_state_diagram(['src/osd/PeeringState.h',
'src/osd/PeeringState.cc'],
'doc/dev/peering_graph.generated.dot'))
+ app.connect('builder-inited',
+ yaml_to_json('doc/releases/releases.yml',
+ 'doc/_static/releases.json'))