Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a2f0ad77dd |
@ -1,245 +0,0 @@
|
||||
commit 2e66bd488cd24289a47cdfe2e1cf3a2ae73d6f38
|
||||
Author: Lawrence D'Oliveiro <ldo@geek-central.gen.nz>
|
||||
Date: Thu Jul 4 23:46:14 2019 +0000
|
||||
|
||||
Update documentation build scripts for Python 3. Python 2 is mere
|
||||
months away from becoming a museum piece, so time to move on!
|
||||
|
||||
diff --git a/cmake/FindDocutils.cmake b/cmake/FindDocutils.cmake
|
||||
index 2fdc522b..e34c2680 100644
|
||||
--- a/cmake/FindDocutils.cmake
|
||||
+++ b/cmake/FindDocutils.cmake
|
||||
@@ -49,7 +49,7 @@ if (RST2HTML_EXECUTABLE)
|
||||
# right way to do it for all platforms, or find a way that works for all
|
||||
# platforms uniformly.
|
||||
if (WIN32)
|
||||
- find_package(PythonInterp)
|
||||
+ find_package(PythonInterp 3)
|
||||
if (NOT PYTHON_EXECUTABLE)
|
||||
message(FATAL_ERROR "Could not find python interpreter, which is required for Docutils")
|
||||
endif()
|
||||
diff --git a/documentation/CMakeLists.txt b/documentation/CMakeLists.txt
|
||||
index 32b12a3d..d5d6d5b4 100644
|
||||
--- a/documentation/CMakeLists.txt
|
||||
+++ b/documentation/CMakeLists.txt
|
||||
@@ -54,7 +54,7 @@ else()
|
||||
|
||||
endif()
|
||||
|
||||
-find_package(PythonInterp 2.6)
|
||||
+find_package(PythonInterp 3)
|
||||
|
||||
# ReST - HTML documentation
|
||||
if (DOCUTILS_FOUND AND PYTHONINTERP_FOUND)
|
||||
diff --git a/documentation/processHtml.py b/documentation/processHtml.py
|
||||
index 1a81df59..fd112d18 100755
|
||||
--- a/documentation/processHtml.py
|
||||
+++ b/documentation/processHtml.py
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright 2013 Pixar
|
||||
#
|
||||
@@ -25,13 +25,12 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
-import string
|
||||
import re
|
||||
-import HTMLParser
|
||||
+from html.parser import HTMLParser
|
||||
|
||||
-class HtmlToTextParser(HTMLParser.HTMLParser):
|
||||
+class HtmlToTextParser(HTMLParser):
|
||||
def __init__(self):
|
||||
- HTMLParser.HTMLParser.__init__(self)
|
||||
+ HTMLParser.__init__(self)
|
||||
self.m_text = []
|
||||
self.m_inTitle = False
|
||||
self.m_inScript = False
|
||||
@@ -49,7 +48,7 @@ class HtmlToTextParser(HTMLParser.HTMLParser):
|
||||
self.m_text.append(text + ' ')
|
||||
if self.m_inTitle:
|
||||
self.m_title = str(text)
|
||||
-
|
||||
+
|
||||
def handle_endtag(self, tag):
|
||||
if tag.lower() == "title": self.m_inTitle = False
|
||||
if tag.lower() == "script": self.m_inScript = False
|
||||
@@ -58,11 +57,11 @@ class HtmlToTextParser(HTMLParser.HTMLParser):
|
||||
def handle_starttag(self, tag, attrs):
|
||||
if tag.lower() == "title": self.m_inTitle = True
|
||||
if tag.lower() == "script": self.m_inScript = True
|
||||
- if tag.lower() == "style": self.m_inStyle = True
|
||||
+ if tag.lower() == "style": self.m_inStyle = True
|
||||
if tag.lower() == "div":
|
||||
for attr in attrs:
|
||||
- if (len(attr)>=2 and \
|
||||
- attr[0].lower()=="class" and \
|
||||
+ if (len(attr)>=2 and
|
||||
+ attr[0].lower()=="class" and
|
||||
attr[1].lower()=="navigation"):
|
||||
self.m_navigation = True
|
||||
|
||||
@@ -71,7 +70,7 @@ class HtmlToTextParser(HTMLParser.HTMLParser):
|
||||
|
||||
def GetText(self):
|
||||
return ''.join(self.m_text).strip()
|
||||
-
|
||||
+
|
||||
def GetTitle(self):
|
||||
return self.m_title
|
||||
|
||||
@@ -89,27 +88,27 @@ def ReadNavigationTemplate( filePath ):
|
||||
try:
|
||||
navFile = open( filePath, "r")
|
||||
except IOError:
|
||||
- print "Could not open file \'"+filePath+"\'"
|
||||
-
|
||||
+ print("Could not open file \'"+filePath+"\'")
|
||||
+
|
||||
with navFile:
|
||||
- print "Navigation template: \'"+filePath+"\'"
|
||||
+ print("Navigation template: \'"+filePath+"\'")
|
||||
navHtml = navFile.read()
|
||||
navHtml = StripHTMLComments(navHtml)
|
||||
navFile.close()
|
||||
navHtml = StripHTMLComments(navHtml)
|
||||
-
|
||||
+
|
||||
return navHtml
|
||||
-
|
||||
+
|
||||
#-------------------------------------------------------------------------------
|
||||
def WriteIndexFile( outputFile, content ):
|
||||
outputPath = os.path.dirname( outputFile )
|
||||
-
|
||||
+
|
||||
try:
|
||||
os.makedirs( outputPath );
|
||||
except:
|
||||
pass
|
||||
|
||||
- print "Creating Search-Index File : \""+outputFile+"\""
|
||||
+ print("Creating Search-Index File : \""+outputFile+"\"")
|
||||
|
||||
f = open(outputFile, "w")
|
||||
f.write(content)
|
||||
@@ -117,7 +116,7 @@ def WriteIndexFile( outputFile, content ):
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
def Usage():
|
||||
- print str(sys.argv[0])+" <input directory> <output directory> <html template>"
|
||||
+ print(str(sys.argv[0])+" <input directory> <output directory> <html template>")
|
||||
exit(1);
|
||||
|
||||
|
||||
@@ -129,10 +128,10 @@ if (len(sys.argv)<3):
|
||||
rootDir = str(sys.argv[1])
|
||||
|
||||
navTemplate = str(sys.argv[2])
|
||||
-
|
||||
+
|
||||
navHtml = ReadNavigationTemplate( navTemplate )
|
||||
|
||||
-print "Scanning : \'"+rootDir+"\'"
|
||||
+print("Scanning : \'"+rootDir+"\'")
|
||||
|
||||
searchIndex = 'var tipuesearch = { "pages": [ '
|
||||
|
||||
@@ -153,12 +152,9 @@ for root, dirs, files in os.walk(rootDir):
|
||||
|
||||
# parse the ReST generated HTML
|
||||
parser = HtmlToTextParser()
|
||||
- try:
|
||||
- parser.feed(html)
|
||||
- title = parser.GetTitle()
|
||||
- text = parser.GetText()
|
||||
- except HTMLParser.HTMLParseError:
|
||||
- continue
|
||||
+ parser.feed(html)
|
||||
+ title = parser.GetTitle()
|
||||
+ text = parser.GetText()
|
||||
|
||||
msg = " \""+inputFile+"\" - "
|
||||
|
||||
@@ -172,24 +168,23 @@ for root, dirs, files in os.walk(rootDir):
|
||||
|
||||
# if necessary, insert navigation html
|
||||
if (not parser.HasNavigationSection()):
|
||||
- loc = string.find(html,"<body>")
|
||||
+ loc = html.find("<body>")
|
||||
html = html[:loc+6] + navHtml + html[loc+6:]
|
||||
|
||||
msg += "added navigation"
|
||||
|
||||
# replace the article title placeholder with the real title
|
||||
if title:
|
||||
- html = string.replace(html,"OSD_ARTICLE_TITLE", title)
|
||||
+ html = html.replace("OSD_ARTICLE_TITLE", title)
|
||||
else:
|
||||
- html = string.replace(html,"OSD_ARTICLE_TITLE", "")
|
||||
+ html = html.replace("OSD_ARTICLE_TITLE", "")
|
||||
|
||||
f.seek(0)
|
||||
f.write(html)
|
||||
f.close()
|
||||
|
||||
- print msg
|
||||
+ print(msg)
|
||||
|
||||
searchIndex = searchIndex + "]};"
|
||||
|
||||
WriteIndexFile( os.path.join(rootDir, "tipuesearch", "tipuesearch_content.js"), searchIndex )
|
||||
-
|
||||
diff --git a/documentation/processTutorials.py b/documentation/processTutorials.py
|
||||
index e6329152..b66abc29 100755
|
||||
--- a/documentation/processTutorials.py
|
||||
+++ b/documentation/processTutorials.py
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright 2013 Pixar
|
||||
#
|
||||
@@ -30,10 +30,7 @@ import re
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
def ReadFile(inputfile):
|
||||
- try:
|
||||
- f = open( inputfile, "r")
|
||||
- except IOError:
|
||||
- print "Could not read file \'"+inputfile+"\'"
|
||||
+ f = open( inputfile, "r")
|
||||
content = f.read()
|
||||
f.close()
|
||||
return content
|
||||
@@ -41,14 +38,8 @@ def ReadFile(inputfile):
|
||||
#-------------------------------------------------------------------------------
|
||||
def WriteToFile(outputfile, content):
|
||||
outputPath = os.path.dirname(outputfile)
|
||||
- try:
|
||||
- os.makedirs(outputPath);
|
||||
- except:
|
||||
- pass
|
||||
- try:
|
||||
- f = open(outputfile, "w")
|
||||
- except IOError:
|
||||
- print "Could not write file \'"+outputfile+"\'"
|
||||
+ os.makedirs(outputPath, exist_ok = True)
|
||||
+ f = open(outputfile, "w")
|
||||
f.write(content)
|
||||
f.close()
|
||||
|
||||
@@ -85,8 +76,8 @@ def Process(srcfile, title):
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
def Usage():
|
||||
- print str(sys.argv[0])+" <input file> <output file> <title>"
|
||||
- exit(1);
|
||||
+ print(str(sys.argv[0])+" <input file> <output file> <title>")
|
||||
+ exit(1)
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
@ -35,6 +35,8 @@ BuildRequires: pkgconfig(python3)
|
||||
BuildRequires: pkgconfig(tbb)
|
||||
BuildRequires: pkgconfig(zlib)
|
||||
BuildRequires: python3dist(pygments)
|
||||
# Drop libs subpackage
|
||||
Obsoletes: %{name}-libs < %{version}-%{release}
|
||||
|
||||
%description
|
||||
OpenSubdiv is a set of open source libraries that implement high performance
|
||||
@ -43,12 +45,6 @@ GPU architectures.
|
||||
This codepath is optimized for drawing deforming subdivs with static topology
|
||||
at interactive framerates.
|
||||
|
||||
%package libs
|
||||
Summary: Core OpenSubdiv libraries
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
%description libs
|
||||
%{summary}
|
||||
|
||||
%package devel
|
||||
Summary: Development files for %{name}
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
@ -116,11 +112,7 @@ make test V=1
|
||||
find %{buildroot} -name '*.la' -delete
|
||||
find %{buildroot} -name '*.a' -delete
|
||||
|
||||
#%%files
|
||||
#%%license LICENSE.txt
|
||||
#%%{_bindir}/stringify
|
||||
|
||||
%files libs
|
||||
%files
|
||||
%license LICENSE.txt
|
||||
%doc README.md
|
||||
%{_libdir}/*.so.%{version}
|
||||
|
Loading…
Reference in New Issue
Block a user