Skip to content

Commit

Permalink
Merge pull request #24061 from davidlange6/printMig_180724T4_Document…
Browse files Browse the repository at this point in the history
…ation_ReferenceManualScripts

Print function migration for Documentation_ReferenceManualScripts
  • Loading branch information
cmsbuild committed Jul 27, 2018
2 parents 438ab5e + e6a21fa commit b3f37e6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Documentation/ReferenceManualScripts/python/BeautifulSoup.py
Expand Up @@ -77,6 +77,7 @@
"""
from __future__ import generators
from __future__ import print_function

__author__ = "Leonard Richardson (leonardr@segfault.org)"
__version__ = "3.2.1"
Expand Down Expand Up @@ -2014,4 +2015,4 @@ def _ebcdic_to_ascii(self, s):
if __name__ == '__main__':
import sys
soup = BeautifulSoup(sys.stdin)
print soup.prettify()
print(soup.prettify())
27 changes: 14 additions & 13 deletions Documentation/ReferenceManualScripts/python/MainPageGenerator.py
@@ -1,3 +1,4 @@
from __future__ import print_function
import json, urllib2, os, sys
from BeautifulSoup import *

Expand Down Expand Up @@ -100,10 +101,10 @@ def __init__(self, dataPath, path, cmsVer = ""):
self.mainPageTemplate = str(soup)
self.mainPageTemplate = self.mainPageTemplate.replace("CSCDQM Framework Guide", "")
self.mainPageTemplate = self.mainPageTemplate.replace('&lt;','<').replace('&gt;', '>')
print "Main page template created..."
print("Main page template created...")

self.CreateBuildRefMan()
print "RefMan created..."
print("RefMan created...")

self.treePageTamplate = self.ReadFile(self.dataPath + "tree_template.html", pathFlag = False)
self.classesSource = self.ReadFile("classes.html")
Expand All @@ -113,18 +114,18 @@ def __init__(self, dataPath, path, cmsVer = ""):
def ReadFile(self, fileName, pathFlag = True):
"""This method reads file directly or from path."""
if pathFlag:
print "Read:", self.path + fileName
print("Read:", self.path + fileName)
f = open(self.path + fileName)
else:
f = open(fileName)
print "Read:", fileName
print("Read:", fileName)
data = f.read()
f.close()
return data

def WriteFile(self, fileName, data):
"""This method writes data"""
print "Write:", self.path + fileName
print("Write:", self.path + fileName)
f = open(self.path + fileName, "w")
f.write(data)
f.close()
Expand Down Expand Up @@ -158,18 +159,18 @@ def __HTMLFileName(self, fileName):

def PrepareData(self):
self.managers = self.ParseJsonFromURL(self.managersURL)
print "Managers loaded and parsed..."
print("Managers loaded and parsed...")

self.users = self.ParseJsonFromURL(self.usersURL)
print "Users loaded and parsed..."
print("Users loaded and parsed...")

self.data = {}
for i in self.managers.keys():
self.data[i] = {"__DATA__":{"Contact":[]}}
for j in self.managers[i]:
self.data[i]["__DATA__"]["Contact"].append(self.users[j])
self.domains = self.ParseJsonFromURL(self.CMSSWURL)
print "Domains loaded and parsed..."
print("Domains loaded and parsed...")

for i in self.domains.keys():
for j in self.domains[i]:
Expand All @@ -191,7 +192,7 @@ def PrepareData(self):
for i in li:
if i.a["href"]:
self.packages[i.a.text] = i.a["href"]
print "Packages parsed(%d)..." % len(self.packages)
print("Packages parsed(%d)..." % len(self.packages))

# for getting items from file.html
soup = BeautifulSoup(self.filesSource)
Expand Down Expand Up @@ -224,7 +225,7 @@ def PrepareData(self):
if flag and i.text != u'interface':
self.classes[level1][level2][i.text] = i.a["href"]
#self.ZEG = i
print "Class hierarchy loaded(%d)..." % len(self.classes)
print("Class hierarchy loaded(%d)..." % len(self.classes))

# self.WriteFile("dbg.json", json.dumps(self.classes, indent = 1))

Expand All @@ -237,7 +238,7 @@ def PrepareData(self):
for i in td:
if i.a and 'href' in i.a:
self.classesURLs[i.a.text] = i.a['href']
print "Class URLs was loaded... (%s)" % len(self.classesURLs)
print("Class URLs was loaded... (%s)" % len(self.classesURLs))

for i in self.data.keys():
for j in self.data[i].keys():
Expand Down Expand Up @@ -380,7 +381,7 @@ def __NewTreePage(self, domain):
if domain in self.tWikiLinks:
self.WriteFile("iframes/%s.html" % domain.lower().replace(' ', '_'), self.treePageTamplate % (domain, self.tWikiLinks[domain], content))
else:
print 'Warning: The twiki link of "%s" domain not found...' % domain
print('Warning: The twiki link of "%s" domain not found...' % domain)
self.WriteFile("iframes/%s.html" % domain.lower().replace(' ', '_'), self.treePageTamplate % (domain, '#', content))

def HTMLTreeBegin(self, title, links = {}):
Expand Down Expand Up @@ -428,4 +429,4 @@ def HTMLTreeAddItem(self, title, links = None, endNode = False, folder = False):

l.CreateNewMainPage(OUTF)
else:
print "parameter error. It must be like this: python MainPageGenerator.py DATA_PATH/ CMSSW/doc/html/ CMS_VER OUTPUT_FILE_NAME"
print("parameter error. It must be like this: python MainPageGenerator.py DATA_PATH/ CMSSW/doc/html/ CMS_VER OUTPUT_FILE_NAME")
3 changes: 2 additions & 1 deletion Documentation/ReferenceManualScripts/python/TableParser.py
@@ -1,3 +1,4 @@
from __future__ import print_function
# email: cmsdoxy@cern.ch, ali.mehmet.altundag@cern.ch

# please have a look at the namespaces.html (namespace list) and annotated.html
Expand Down Expand Up @@ -115,7 +116,7 @@ def generateTab(items, curr, tabClass = 'tabs3'):

# generate pages
for page in pageNames:
print 'generating %s...' % (fileNameTemplate % page)
print('generating %s...' % (fileNameTemplate % page))
temp = BeautifulSoup(str(htmlPage))
table = temp.find('table', {'class' : tableClassName})
oldTab = temp.find('div', {'class' : destTabClassName})
Expand Down

0 comments on commit b3f37e6

Please sign in to comment.