From aa214223a55759029af2aa88a1a2872d136e2752 Mon Sep 17 00:00:00 2001 From: Kevin Putnam Date: Tue, 12 May 2020 17:45:00 -0700 Subject: [PATCH] Add reDocs GUI support (#1117) * Adding support for reDocs GUI to Clear Linux Docs repo. 1. Added .tox and MANIFEST to .gitignore 2. Added py rule to make.bat to enable building of bundles.html.txt in Windows 3. Added .tox to exclude_patterns in conf.py 4. Added tox.ini and setup.py support files to project. Signed-off-by: Kevin Putnam * Updated setup.py with Clear Linux docs info. Signed-off-by: Kevin Putnam * Small adjustment. Signed-off-by: Kevin Putnam --- .gitignore | 4 ++++ make.bat | 12 ++++++++++++ setup.py | 11 +++++++++++ source/_scripts/_python/manpages/manpages.py | 4 ++-- source/conf.py | 2 +- tox.ini | 13 +++++++++++++ 6 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 setup.py create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 14c2dd61..4730e5d2 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,10 @@ bundles.html.txt # ignore the venv, used for running make py venv +#ignore for reDocs GUI +.tox +MANIFEST + # ignore artifacts of man page generation source/_scripts/_python/manpages/*.rst source/reference/manpages diff --git a/make.bat b/make.bat index 2bc255b1..d67dad35 100644 --- a/make.bat +++ b/make.bat @@ -5,6 +5,8 @@ REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) + +set SCRIPTDIR=source\_scripts\_python set BUILDDIR=source\_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source set I18NSPHINXOPTS=%SPHINXOPTS% source @@ -81,6 +83,16 @@ if "%1" == "html" ( goto end ) +if "%1" == "py" ( + cd %SCRIPTDIR% + python.exe bundle_lister.py + copy bundles.html.txt ..\..\reference\bundles + for /d %%i in (cloned_repo\*) do rmdir /q /s %%i + del /q /s bundles.html.txt + echo "Python bundle script finished successfully!" + goto end +) + if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..47d5bbd9 --- /dev/null +++ b/setup.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from distutils.core import setup + +setup(name='Clear Linux Documentation', + version='', + description='Sphinx build of Clear Linux documentation', + author='Many', + author_email='kevin.putnam@intel.com', + url='https://github.com/clearlinux/clear-linux-documentation/', + ) diff --git a/source/_scripts/_python/manpages/manpages.py b/source/_scripts/_python/manpages/manpages.py index a9d14ab6..fa640869 100644 --- a/source/_scripts/_python/manpages/manpages.py +++ b/source/_scripts/_python/manpages/manpages.py @@ -138,7 +138,7 @@ def updateManPages(): #makeSeeAlsoReplacements() for file in manFiles: manFile = "" - with open(file,'r') as f: + with open(file,'r',encoding="utf8") as f: manFile = f.read() #manFile = addTOC(manFile,file) # Not convinced adding TOC adds value. # @@ -153,7 +153,7 @@ def updateManPages(): manFile = manFile.replace(perm,buildManName(nameAndSection[0],nameAndSection[1])) for manName, doNotUse in manNamePerms.items(): manFile = manFile.replace(buildManName(manName[0],manName[1]),linkToMan(manName[0],manName[1])) - with open(file,'w') as w: + with open(file,'w',encoding="utf8") as w: w.write(manFile) def addTOC(manContent,file): diff --git a/source/conf.py b/source/conf.py index 0b25023f..a8dff6e5 100644 --- a/source/conf.py +++ b/source/conf.py @@ -81,7 +81,7 @@ language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build','_themes','_scripts'] +exclude_patterns = ['_build','_themes','.tox','_scripts'] # The reST default role (used for this markup: `text`) to use for all # documents. diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..ffeb174d --- /dev/null +++ b/tox.ini @@ -0,0 +1,13 @@ +[tox] +envlist = py3-{mylinux,mywindows} + +[testenv] +platform = mylinux: linux + mywindows: win32 +whitelist_externals = make.bat + /usr/bin/make +deps = -rrequirements.txt +commands = + mylinux: make {posargs} + mywindows: make.bat {posargs} +