Merge "Added Designated-Sections to translator"
This commit is contained in:
commit
9fecdd82ca
@ -13,6 +13,9 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
#
|
||||||
|
# This was build for python 2.7, The print statements are failing with
|
||||||
|
# Python 3.X
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
@ -38,9 +41,14 @@ if inFileName is "NONE":
|
|||||||
|
|
||||||
print "reading from", inFileName
|
print "reading from", inFileName
|
||||||
|
|
||||||
|
|
||||||
with open(inFileName) as f:
|
with open(inFileName) as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|
||||||
|
if not isinstance(data, dict):
|
||||||
|
print 'Make sure this is a valid file'
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
outFileName = inFileName.replace("json", "rst")
|
outFileName = inFileName.replace("json", "rst")
|
||||||
|
|
||||||
|
|
||||||
@ -49,9 +57,8 @@ print "writing to", outFileName
|
|||||||
|
|
||||||
# intro
|
# intro
|
||||||
with open(outFileName, "w") as outFile:
|
with open(outFileName, "w") as outFile:
|
||||||
if not isinstance(data,dict) or data.get('id') is None:
|
if data.get('id') is None:
|
||||||
print 'Make sure there is a valid id'
|
print 'Make sure there is a valid id'
|
||||||
print 'Make sure this is a valid file'
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
line01 = "OpenStack DefCore %s" % data["id"]
|
line01 = "OpenStack DefCore %s" % data["id"]
|
||||||
@ -69,9 +76,9 @@ with open(outFileName, "w") as outFile:
|
|||||||
:Status: {status}
|
:Status: {status}
|
||||||
:Replaces: {replaces}
|
:Replaces: {replaces}
|
||||||
|
|
||||||
This document outlines the mandatory and advisory capabilities
|
This document outlines the mandatory capabilities and designated
|
||||||
required to exist in a software installation in order to be
|
sections required to exist in a software installation in order to
|
||||||
eligible to use marks controlled by the OpenStack Foundation.
|
be eligible to use marks controlled by the OpenStack Foundation.
|
||||||
|
|
||||||
This document was generated from the master JSON version.
|
This document was generated from the master JSON version.
|
||||||
|
|
||||||
@ -104,26 +111,65 @@ Platform Components
|
|||||||
components = sorted(data["components"].keys())
|
components = sorted(data["components"].keys())
|
||||||
order = ["required", "advisory", "deprecated", "removed"]
|
order = ["required", "advisory", "deprecated", "removed"]
|
||||||
for component in components:
|
for component in components:
|
||||||
|
|
||||||
outFile.write("""
|
outFile.write("""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{component} Component Capabilities
|
{component} Component Capabilities
|
||||||
====================================
|
""".format(component=component.capitalize()))
|
||||||
""".format(component=component.capitalize()))
|
outFile.write('='*(len(component) + 23)) # footer
|
||||||
|
|
||||||
for event in order:
|
for event in order:
|
||||||
|
|
||||||
outFile.write("\n{event} Capabilities \n".format(
|
outFile.write("\n{event} Capabilities \n".format(
|
||||||
event=event.capitalize()))
|
event=event.capitalize()))
|
||||||
outFile.write("----------------------- \n")
|
outFile.write("-" * (len(event) + 15) + "\n")
|
||||||
|
|
||||||
if(len(data['components'][component][event]) == 0):
|
if(len(data['components'][component][event]) == 0):
|
||||||
outFile.write("None \n")
|
outFile.write("None \n")
|
||||||
|
|
||||||
for req in data['components'][component][event]:
|
for req in data['components'][component][event]:
|
||||||
if not data["capabilities"][req].get('name') is None:
|
if not data["capabilities"][req].get('name') is None:
|
||||||
|
|
||||||
outFile.write("* {name} ({project})\n".format(
|
outFile.write("* {name} ({project})\n".format(
|
||||||
name=data["capabilities"][req]["name"].capitalize(),
|
name=data["capabilities"][req]["name"].capitalize(),
|
||||||
project=data["capabilities"][req].get("project")))
|
project=data["capabilities"][req].get("project")))
|
||||||
else:
|
else:
|
||||||
print "{ capabilities /", req, "/ name } does not exist"
|
print "{ capabilities /", req, "/ name } does not exist"
|
||||||
|
|
||||||
outFile.write("* {name} ({project})\n".format(
|
outFile.write("* {name} ({project})\n".format(
|
||||||
name=req.capitalize(),
|
name=req.capitalize(),
|
||||||
project=data["capabilities"][req].get("project")))
|
project=data["capabilities"][req].get("project")))
|
||||||
|
|
||||||
|
# Designated -Sections
|
||||||
|
|
||||||
|
if 'designated-sections' not in data:
|
||||||
|
print "designated-sections not in json file"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
outFile.write("""
|
||||||
|
|
||||||
|
Designated Sections
|
||||||
|
=====================================
|
||||||
|
|
||||||
|
The following designated sections apply to the same releases as
|
||||||
|
this specification.""")
|
||||||
|
order = ['required', 'advisory', 'deprecated', 'removed']
|
||||||
|
desig = data.get("designated-sections")
|
||||||
|
for event in order:
|
||||||
|
|
||||||
|
outFile.write('\n\n{event} Designated Sections\n'.format(
|
||||||
|
event=event.capitalize()))
|
||||||
|
outFile.write('-'*(len(event) + 20)) # +20 is for length of header
|
||||||
|
|
||||||
|
names = sorted(desig[event].keys())
|
||||||
|
if len(names) is 0:
|
||||||
|
outFile.write('\nNone')
|
||||||
|
|
||||||
|
for name in names:
|
||||||
|
outFile.write("\n* {name} : {guide}".format(
|
||||||
|
name=name.capitalize(),
|
||||||
|
guide=desig[event][name].get('guidance')))
|
||||||
|
|
||||||
|
outFile.write('\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user