From 120d54b6e07191bb96b5afd7a7d6d1d068df2535 Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Thu, 13 Sep 2018 20:24:37 +0100 Subject: [PATCH 01/11] Use batch file as entry point --- .gitignore | 126 ++--------------------------------------------------- make.bat | 38 ---------------- make.cmd | 60 +++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 161 deletions(-) delete mode 100644 make.bat create mode 100644 make.cmd diff --git a/.gitignore b/.gitignore index 4d3b84ffe..62c643ef5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,126 +1,6 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# I want to ignore the source of sphinx -source/ - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# the chmcmd binary and md5 +__pycache__ +build +source chmcmd chmcmd.md5 - -# the resulting chm docs *.chm - -# Django stuff: -*.log -local_settings.py -db.sqlite3 - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# usual things on the venv -bin/ -lib/ -lib64/ -share/ - -# this is a pip-delete-this-directory -src/ - -# pip on venv -pip-selfcheck.json - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ diff --git a/make.bat b/make.bat deleted file mode 100644 index adb2e13c4..000000000 --- a/make.bat +++ /dev/null @@ -1,38 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) - -set SPHINXOPTS=-c . -set SOURCEDIR=source -set BUILDDIR=build -set SPHINXPROJ=AGSHelp - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd diff --git a/make.cmd b/make.cmd new file mode 100644 index 000000000..e771538e9 --- /dev/null +++ b/make.cmd @@ -0,0 +1,60 @@ +@echo off +setlocal enabledelayedexpansion + +if not defined SOURCEDIR set SOURCEDIR=source +if not defined BUILDDIR set BUILDDIR=build +if not defined SPHINXPROJ set SPHINXPROJ=AGSHelp +if not defined SPHINXOPTS set SPHINXOPTS=-c . +if not defined GITURL set GITURL=https://github.com/adventuregamestudio/ags-manual.wiki.git +if not defined GITOPTS set GITOPTS=--depth=1 --branch=master + +if "%*" == "" ( + echo No targets were specified! + echo. + for /f "tokens=*" %%t in ('findstr /r "^:" "%~nx0"') do ( + set TARGET=%%t + set TARGET=!TARGET:~1! + if not "!TARGET!" == "end" echo !TARGET! + ) +) else ( + for %%t in (%*) do call :%%~t %%~t +) + +goto end + +:clone +if exist "%SOURCEDIR%" rd /s /q "%SOURCEDIR%" +git clone %GITOPTS% %GITURL% %SOURCEDIR% +exit /b + +:html +:htmlhelp +sphinx-build -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +exit /b + +:chm +move "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" %TEMP% &&^ +findstr /v /c:"Binary TOC=No" /c:"Binary Index=No" %TEMP%\AGSHelpdoc.hhp > "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" + +reg query HKLM\Hardware\Description\System\CentralProcessor\0 /c /f "x86" > nul: +if %ERRORLEVEL% == 0 ( + set HHC="%PROGRAMFILES%\HTML Help Workshop\hhc.exe" +) else ( + set HHC="%PROGRAMFILES(X86)%\HTML Help Workshop\hhc.exe" +) + +%HHC% "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" +move "%BUILDDIR%\htmlhelp\AGSHelpdoc.chm" ags-help.chm +exit /b + +:clean +for /r %%d in (*.gitignore) do ( + for /f "tokens=*" %%c in (%%d) do ( + echo Cleaning %%~pd%%c + 2>nul rd /s /q "%%~pd%%c" || del "%%~pd%%c" /q /f + ) +) +exit /b + +:end +endlocal From 1ab63597995362df767d0173dbb0ec5525c45026 Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Sat, 15 Sep 2018 11:32:24 +0100 Subject: [PATCH 02/11] Extension writes index.rst --- _extensions/h2r.py | 30 ++++++++++++++++++++++++++++-- conf.py | 1 + make.cmd | 16 ++++++++-------- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/_extensions/h2r.py b/_extensions/h2r.py index 871a5fc17..02c20b67e 100644 --- a/_extensions/h2r.py +++ b/_extensions/h2r.py @@ -7,6 +7,10 @@ For when you need indicies and you have none, this extension generates some based on H2 and H3 markdown headers + h2r_toc_from_doc is a path to a markdown page of headings and list + items, which will be converted to rst, have toc entries added per + section, and overwrite the contents of the master doc + h2r_script_object_from_header is a regular expression that matches a script object in match group 1, from the H2 header @@ -18,6 +22,7 @@ import io import sphinx import re +from m2r import parse_from_file from sphinx.util import logging logger = logging.getLogger(__name__) @@ -42,6 +47,9 @@ def map_page(app, env, docnames): script_object = None for docname in env.found_docs: + if docname == app.config.master_doc: + continue + with io.open(env.doc2path(docname), encoding='utf-8') as f: changes[docname] = [] offset = 0 @@ -68,7 +76,13 @@ def map_page(app, env, docnames): offset += len(line) -def add_indices(app, docname, source): +def source_transform(app, docname, source): + if docname != app.config.master_doc: + add_indicies(app, docname, source) + elif app.config.h2r_toc_from_doc: + add_toc(app, docname, source) + +def add_indicies(app, docname, source): modified = [] offset = 0 @@ -98,9 +112,21 @@ def add_indices(app, docname, source): source[0] = ''.join(modified) logger.info('Added %d indicies for document \'%s\'' % (len(changes[docname]), docname)) +def add_toc(app, docname, source): + # overwrite master doc source with the rst version of the contents page + source[0] = parse_from_file(app.config.h2r_toc_from_doc) + ## convert lists to toc items + source[0] = re.sub(r'\* `([^`]+)`_?', r' \1', source[0]) + ## insert toc directives + source[0] = re.sub(r'(--+)', r'\1\n\n.. toctree::\n :maxdepth: 1', source[0]) + ## add a glob toc to cover remaining docs + source[0] += '\n.. toctree::\n :glob:\n :hidden:\n\n *\n' + logger.info('TOC page \'%s\' generated as:\n%s' % (app.config.master_doc, source[0])) + def setup(app): + app.add_config_value('h2r_toc_from_doc', '', 'html') app.add_config_value('h2r_script_object_from_header', r'(.*)', 'html') app.add_config_value('h2r_script_object_force_global', {}, 'html') app.connect('env-before-read-docs', map_page) - app.connect('source-read', add_indices) + app.connect('source-read', source_transform) return {'version': sphinx.__display_version__, 'parallel_read_safe': True} diff --git a/conf.py b/conf.py index 0c1ee866a..13127e37d 100644 --- a/conf.py +++ b/conf.py @@ -44,6 +44,7 @@ m2r_parse_relative_links = True # Settings for h2r +h2r_toc_from_doc = 'source/Home.md' h2r_script_object_from_header = r'^(\w+) ([Pp]roperties|[Ff]unctions)' h2r_script_object_force_global = { 'Display': [ diff --git a/make.cmd b/make.cmd index e771538e9..06a0ef553 100644 --- a/make.cmd +++ b/make.cmd @@ -5,9 +5,16 @@ if not defined SOURCEDIR set SOURCEDIR=source if not defined BUILDDIR set BUILDDIR=build if not defined SPHINXPROJ set SPHINXPROJ=AGSHelp if not defined SPHINXOPTS set SPHINXOPTS=-c . + if not defined GITURL set GITURL=https://github.com/adventuregamestudio/ags-manual.wiki.git if not defined GITOPTS set GITOPTS=--depth=1 --branch=master +if not defined PROGRAMFILES(X86) ( + set HHC="%PROGRAMFILES%\HTML Help Workshop\hhc.exe" +) else ( + set HHC="%PROGRAMFILES(X86)%\HTML Help Workshop\hhc.exe" +) + if "%*" == "" ( echo No targets were specified! echo. @@ -25,6 +32,7 @@ goto end :clone if exist "%SOURCEDIR%" rd /s /q "%SOURCEDIR%" git clone %GITOPTS% %GITURL% %SOURCEDIR% +copy /b NUL "%SOURCEDIR%\index.rst" exit /b :html @@ -35,14 +43,6 @@ exit /b :chm move "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" %TEMP% &&^ findstr /v /c:"Binary TOC=No" /c:"Binary Index=No" %TEMP%\AGSHelpdoc.hhp > "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" - -reg query HKLM\Hardware\Description\System\CentralProcessor\0 /c /f "x86" > nul: -if %ERRORLEVEL% == 0 ( - set HHC="%PROGRAMFILES%\HTML Help Workshop\hhc.exe" -) else ( - set HHC="%PROGRAMFILES(X86)%\HTML Help Workshop\hhc.exe" -) - %HHC% "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" move "%BUILDDIR%\htmlhelp\AGSHelpdoc.chm" ags-help.chm exit /b From b1bab01f36b39a67182ffe969169840ce557324a Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Sat, 15 Sep 2018 11:33:06 +0100 Subject: [PATCH 03/11] Ignore CHM binary data --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 62c643ef5..31034a757 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ source chmcmd chmcmd.md5 *.chm +*.chw From db2a36bd16ddf9cec30c40fed66222b758740e38 Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Sat, 15 Sep 2018 16:38:33 +0100 Subject: [PATCH 04/11] Makefile does the same thing as make.cmd --- Makefile | 65 ++++++++++++++++++++++++++++++--------- get-help-source.sh | 49 ----------------------------- make-chm-from-htmlhelp.sh | 28 ----------------- 3 files changed, 50 insertions(+), 92 deletions(-) delete mode 100755 get-help-source.sh delete mode 100755 make-chm-from-htmlhelp.sh diff --git a/Makefile b/Makefile index 689896979..6b0157497 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,55 @@ -# Minimal makefile for Sphinx documentation -# +SOURCEDIR ?= source +BUILDDIR ?= build +SPHINXPROJ ?= AGSHelp +SPHINXOPTS ?= -c . -# You can set these variables from the command line. -SPHINXOPTS ?= -c . -SPHINXBUILD = sphinx-build -SPHINXPROJ = AGSHelp -SOURCEDIR = source -BUILDDIR = build +GITURL ?= https://github.com/adventuregamestudio/ags-manual.wiki.git +GITOPTS ?= --depth=1 --branch=master + +.PHONY: help clone html htmlhelp chm clean -# Put it first so that "make" without argument is like "make help". help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + @awk '/^[^ ][a-z ]+:/ { \ + sub(":", ""); \ + gsub(" ", "\n"); \ + print $$0 \ + }' Makefile + +clone: + @rm -rf "$(SOURCEDIR)" + @git clone $(GITOPTS) $(GITURL) $(SOURCEDIR) + touch "$(SOURCEDIR)/index.rst" + +html htmlhelp: + @sphinx-build -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) + +chm: + @sed -E -i.bak -n "/^Binary (TOC|Index)=No$$/!p" "$(BUILDDIR)/htmlhelp/AGSHelpdoc.hhp" && \ + rm "$(BUILDDIR)/htmlhelp/AGSHelpdoc.hhp.bak" -.PHONY: help Makefile + @chmcmd=`which chmcmd` ;\ + if [ $$? != 0 ]; then \ + if [ "`uname`" == "Linux" ]; then \ + rm -f chmcmd && wget –quiet https://github.com/ericoporto/freepascal/releases/download/3.0.4/chmcmd ;\ + echo "af4eea94c843adb20f8ae10884badbc5 chmcmd" > chmcmd.md5 ;\ + md5sum -c chmcmd.md5 || exit 1 ;\ + chmod +x chmcmd ;\ + chmcmd=`pwd`"/chmcmd" ;\ + else \ + echo "chmcmd is not present" ;\ + exit 1;\ + fi ;\ + fi ;\ + echo "Using '$$chmcmd' \ + $$( \ + cd "$(BUILDDIR)/htmlhelp" && \ + rm -f "AGSHelpdoc.chm" && \ + "$$chmcmd" "AGSHelpdoc.hhp" && \ + chmod a+r-w-x "AGSHelpdoc.chm" && \ + mv -fv "AGSHelpdoc.chm" ../../ags-help.chm \ + )" -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -.DEFAULT: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) +clean: + @while read -r line; do \ + rm -rf "$$line"; \ + done < .gitignore diff --git a/get-help-source.sh b/get-help-source.sh deleted file mode 100755 index 890dceb01..000000000 --- a/get-help-source.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -dir="source" -opts="--depth=1 --branch=master" -url="https://github.com/adventuregamestudio/ags-manual.wiki.git" - -echo "--> Getting wiki source" -rm -rf "$dir" -git clone $opts $url $dir - -# write a new index file -echo "--> Generating index.rst" -awk -v maxdepth=1 -v outfile="source/index.rst" ' -{ - if ($1 == "#") { - sub("^# *", "") - - underline = "" - for (i = 0; i < length($0); i ++) - underline = "=" underline - - printf("%s\n%s\n", $0, underline) > outfile - } - - else if ($1 == "##") { - sub("^## *", "") - - underline = "" - for (i = 0; i < length($0); i ++) - underline = "-" underline - - printf("\n%s\n%s\n\n.. toctree::\n :maxdepth: %d\n\n", $0, underline, maxdepth) >> outfile - } - - else if ($1 == "*" || $1 == "-" || $1 == "+") { - match($0, "\\[[^\]]*\\]") - label = substr($0, RSTART + 1, RLENGTH - 2) - - match($0, "\\([^\)]+\\)") - link = substr($0, RSTART + 1, RLENGTH - 2) - - printf(" %s <%s>\n", label, link) >> outfile - } -} - -END { - printf("\n.. toctree::\n :glob:\n :hidden:\n\n *\n") >> outfile -} -' < source/Home.md && rm -f source/Home.md diff --git a/make-chm-from-htmlhelp.sh b/make-chm-from-htmlhelp.sh deleted file mode 100755 index af15bc5ec..000000000 --- a/make-chm-from-htmlhelp.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -htmlhelp="build/htmlhelp" -buildname="AGSHelpdoc" - -echo "Enabling binary TOC and index..." -sed -E -i.bak -n "/^Binary (TOC|Index)=No$/!p" "$htmlhelp/$buildname.hhp" && \ -rm "$htmlhelp/$buildname.hhp.bak" - -echo "Checking or getting chmcmd..." -chmcmd=`which chmcmd` - -if [ $? != 0 ]; then - rm -f chmcmd && wget –quiet https://github.com/ericoporto/freepascal/releases/download/3.0.4/chmcmd - echo "af4eea94c843adb20f8ae10884badbc5 chmcmd" > chmcmd.md5 - md5sum -c chmcmd.md5 || exit 1 - chmod +x chmcmd - chmcmd=`pwd`"/chmcmd" -fi - -echo "Using $chmcmd: -$( - cd "$htmlhelp" && \ - rm -f "$buildname.chm" && \ - "$chmcmd" "$buildname.hhp" && \ - chmod a+r-w-x "$buildname.chm" && \ - mv -fv "$buildname.chm" ../../ags-help.chm -)" From f4745c389721cce9d75c655e55694fc6ee3c478d Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Sat, 15 Sep 2018 16:57:43 +0100 Subject: [PATCH 05/11] Don't print help target --- Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6b0157497..78a64c64a 100644 --- a/Makefile +++ b/Makefile @@ -9,11 +9,8 @@ GITOPTS ?= --depth=1 --branch=master .PHONY: help clone html htmlhelp chm clean help: - @awk '/^[^ ][a-z ]+:/ { \ - sub(":", ""); \ - gsub(" ", "\n"); \ - print $$0 \ - }' Makefile + @awk -F '[: ]' \ + '/^[^ ][a-z ]+:/ { for (i = 1; i < NF; i ++ ) { if ($$i != "help") print $$i } }' Makefile clone: @rm -rf "$(SOURCEDIR)" From 18bc53251cf99db935bfde142e0c96bbaf1482e5 Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Sat, 15 Sep 2018 19:02:58 +0100 Subject: [PATCH 06/11] Rewrite for build changes --- README.md | 59 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index c96470331..7f4afd162 100644 --- a/README.md +++ b/README.md @@ -4,36 +4,57 @@ Travis (web): [![Build Status](https://travis-ci.org/adventuregamestudio/ags-man [**Edit the Help in the Wiki**](https://github.com/adventuregamestudio/ags-manual/wiki) | [**Revision History**](https://github.com/adventuregamestudio/ags-manual/wiki/_history) -The help files can be edited on the wiki or cloned locally and pushed. Create issues if something is wrong. +The help files can be edited on the wiki or cloned locally and pushed. Please open an issue if something is wrong. git clone https://github.com/adventuregamestudio/ags-manual.wiki.git -## Read the help files +## Reading the help files -The manual is hosted online on [adventuregamestudio.github.io/ags-manual/](https://adventuregamestudio.github.io/ags-manual) . +The manual is hosted online on [adventuregamestudio.github.io/ags-manual/](https://adventuregamestudio.github.io/ags-manual). -You can also download it from [latest release](https://github.com/adventuregamestudio/ags-manual/releases/latest) . +You can also download the [latest release](https://github.com/adventuregamestudio/ags-manual/releases/latest). ![](ags-manual-readme.png) -## How to generate the help files from the wiki! +## Building the help files -The help file is generated using [Python 3 Sphinx](http://www.sphinx-doc.org/en/master/)! +The help files are generated using [Python 3 Sphinx](http://www.sphinx-doc.org/en/master/)! -This documentation assumes you have Sphinx already installed and configured and you have access to a Unix-style *bash* compatible shell. +**Note that the use of a virtualenv is recommended if your Python installation is system-wide** -To build the help files, clone this repository first! +Install the requisite pip packages - git clone git@github.com:adventuregamestudio/ags-manual.git - cd agshelp + pip install -r requirements.txt -Then you need to get the wiki files +Install an HTML help compiler - ./get-help-source.sh +For Windows, install [HTML Help Workshop](http://go.microsoft.com/fwlink/?LinkId=14188). For macOS, Unix, Linux, etc. install chmcmd from your regular package repository or install [Free Pascal](https://www.freepascal.org/download.var). -Now just use make to create any help version you want! **Example for html files**: +### Make targets - make html +name | function +--- | --- +clone | git clone the wiki source +html | run sphinx-build with the html builder +htmlhelp | run sphinx-build with the htmlhelp builder +chm | run the HTML compiler +clean | delete everything listed in .gitignore + +build just the html site + + make clone html + +build just the CHM (Windows help) file + + make clone htmlhelp chm + +build everything + + make clone html htmlhelp chm + +rebuild everything + + make clean clone html htmlhelp chm ## Indexing @@ -44,12 +65,12 @@ Markdown | Indexed as \#\# Heading | Single entry: 'Heading' \#\#\# Sub-heading | Paired entry: 'Heading' <-> 'Sub-heading' -Using \#\#\# without a preceeding \#\# on the page will generate a warning and be ignored by Sphinx, so it won't appear in the index. To create an H2 style heading without an index entry, use the alternate H2 markup: +To create an H2 style heading without an index entry, use the alternate H2 markup: Heading ------- -H1 headings are not checked, effectively reserving their use for primary document titles. +H1 headings are not checked, effectively reserving their use for the primary title on the contents page. ## Checking wiki links @@ -57,8 +78,4 @@ If making a lot of changes, the included AWK script can validate links within a ./checklinks path/to/wiki/source/*.md -A checklinks task is run on every Travis-CI build, and the build will fail for any missing link. [Read the logs here to find the missing link](https://travis-ci.org/adventuregamestudio/ags-manual). - -Additionally, *sphinx linkchecker* can check if external links are broken. - - make linkcheck +A checklinks task is run on every Travis-CI build, and the build will fail for any missing link. Read the logs [here](https://travis-ci.org/adventuregamestudio/ags-manual) to find the missing link. From 1f035afd9bc478579a811ddb8e1c94b288d297b2 Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Sat, 15 Sep 2018 19:51:40 +0100 Subject: [PATCH 07/11] Fix if statement --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 78a64c64a..c4157e2de 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ chm: @chmcmd=`which chmcmd` ;\ if [ $$? != 0 ]; then \ - if [ "`uname`" == "Linux" ]; then \ + if [ "`uname`" = "Linux" ]; then \ rm -f chmcmd && wget –quiet https://github.com/ericoporto/freepascal/releases/download/3.0.4/chmcmd ;\ echo "af4eea94c843adb20f8ae10884badbc5 chmcmd" > chmcmd.md5 ;\ md5sum -c chmcmd.md5 || exit 1 ;\ From 96c23611dffc0cd898ee5c455603d492816f9810 Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Sat, 15 Sep 2018 19:53:28 +0100 Subject: [PATCH 08/11] Match Makefile output --- make.cmd | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/make.cmd b/make.cmd index 06a0ef553..263400b62 100644 --- a/make.cmd +++ b/make.cmd @@ -16,12 +16,10 @@ if not defined PROGRAMFILES(X86) ( ) if "%*" == "" ( - echo No targets were specified! - echo. for /f "tokens=*" %%t in ('findstr /r "^:" "%~nx0"') do ( set TARGET=%%t set TARGET=!TARGET:~1! - if not "!TARGET!" == "end" echo !TARGET! + if not "!TARGET!" == "end" echo !TARGET! ) ) else ( for %%t in (%*) do call :%%~t %%~t From 1b9b1549ed856f88e351e83c3b9782c978bded6d Mon Sep 17 00:00:00 2001 From: ericoporto Date: Sat, 15 Sep 2018 17:46:36 -0300 Subject: [PATCH 09/11] modifyied appveyor.yml and .travis.yml to build and deploy ags-manual with new Makefile and make.cmd --- .travis.yml | 9 ++++----- appveyor.yml | 15 ++++++--------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index adf029907..a93371e59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,12 @@ before_install: install: - pip install -r requirements.txt script: -- ./get-help-source.sh -- make html htmlhelp -- ./checklinks source/*.md +- make clone html htmlhelp chm - touch build/html/.nojekyll before_deploy: # run only once, the tasks executed prepares the files to be upload # once a github tag is created, ideally using the release button + # saves the sources for being able to reproduce builds easily if needed - | if ! [ "$BEFORE_DEPLOY_RUN" ]; then export BEFORE_DEPLOY_RUN=1; @@ -26,7 +25,7 @@ before_deploy: pushd build/htmlhelp/ zip -r ../../ags-manual-hhp-build.zip * popd - ./make-chm-from-htmlhelp.sh + mv ags-help.chm ags-help-FP.chm fi deploy: @@ -43,7 +42,7 @@ deploy: file: - "ags-manual-wiki-md-source.zip" - "ags-manual-hhp-build.zip" - - "ags-help.chm" + - "ags-help-FP.chm" skip_cleanup: true on: branch: master diff --git a/appveyor.yml b/appveyor.yml index 5bd067dfd..6e4346c57 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,8 +3,8 @@ version: "cygwin-{build}" environment: matrix: - ARCH: x86 - CYGWIN: C:\Cygwin - CYGSH: C:\Cygwin\bin\bash -lc +# CYGWIN: C:\Cygwin +# CYGSH: C:\Cygwin\bin\bash -lc PYTHON: "C:\\Python36" PYTHON_VERSION: "3.6.x" PYTHON_ARCH: "32" @@ -18,20 +18,17 @@ install: - pip install -r requirements.txt build_script: - - "%CYGWIN%\\setup-%ARCH%.exe -q -P awk,sed" - - "%CYGSH% 'cd /cygdrive/c/projects/%APPVEYOR_PROJECT_SLUG%; ./get-help-source.sh; make htmlhelp'" - - "%CYGSH% 'cd /cygdrive/c/projects/%APPVEYOR_PROJECT_SLUG%; sed -E -i -n \"/^Binary (TOC|Index)=No$/!p\" build/htmlhelp/AGSHelpdoc.hhp'" - - "%CYGSH% 'cd /cygdrive/c/projects/%APPVEYOR_PROJECT_SLUG%; /cygdrive/c/Program\\ Files\\ \\(x86\\)/HTML\\ Help\\ Workshop/hhc.exe build/htmlhelp/AGSHelpdoc.hhp; mv build/htmlhelp/AGSHelpdoc.chm ags-help-HHW.chm'" + - make clone htmlhelp chm artifacts: -- path: ags-help-HHW.chm - name: ags-help-HHW.chm +- path: ags-help.chm + name: ags-help.chm deploy: - provider: GitHub auth_token: secure: RE/XSZF5WYBi1os9XeUernSQ7znWyIeCUu5m8rzCR/Ocyhmcjoa4N2101UXxtRPr - artifact: ags-help-HHW.chm + artifact: ags-help.chm draft: false prerelease: false on: From b1f26e8cd947c11ed5c140354fb680315eadf28a Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Sun, 16 Sep 2018 09:19:27 +0100 Subject: [PATCH 10/11] Prepend python directory to PATH for AppVeyor plus some cleaning up --- appveyor.yml | 15 +++++++-------- make.cmd | 6 +++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6e4346c57..d260759fb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,13 +1,10 @@ -version: "cygwin-{build}" +version: "chm-{build}" environment: matrix: - - ARCH: x86 -# CYGWIN: C:\Cygwin -# CYGSH: C:\Cygwin\bin\bash -lc - PYTHON: "C:\\Python36" - PYTHON_VERSION: "3.6.x" - PYTHON_ARCH: "32" + - PYTHON: "C:\\Python36" + PYTHON_VERSION: 3.6 + PYTHON_ARCH: 32 branches: except: @@ -15,7 +12,9 @@ branches: install: - cinst html-help-workshop - - pip install -r requirements.txt + - set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH% + - python -c "import sys; print(sys.version)" + - python -m pip install -r requirements.txt build_script: - make clone htmlhelp chm diff --git a/make.cmd b/make.cmd index 263400b62..08b3d95c8 100644 --- a/make.cmd +++ b/make.cmd @@ -35,12 +35,12 @@ exit /b :html :htmlhelp -sphinx-build -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +python -m sphinx -b %1 %SOURCEDIR% %BUILDDIR%\%1 %SPHINXOPTS% exit /b :chm -move "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" %TEMP% &&^ -findstr /v /c:"Binary TOC=No" /c:"Binary Index=No" %TEMP%\AGSHelpdoc.hhp > "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" +move "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" "%TEMP%" &&^ +findstr /v /c:"Binary TOC=No" /c:"Binary Index=No" "%TEMP%\AGSHelpdoc.hhp" > "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" %HHC% "%BUILDDIR%\htmlhelp\AGSHelpdoc.hhp" move "%BUILDDIR%\htmlhelp\AGSHelpdoc.chm" ags-help.chm exit /b From 4ba5d8f20125e660165f5ee16f1c96d20660b404 Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Sun, 16 Sep 2018 10:48:34 +0100 Subject: [PATCH 11/11] Update Makefile to also not use sphinx-build --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c4157e2de..0f8789665 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ clone: touch "$(SOURCEDIR)/index.rst" html htmlhelp: - @sphinx-build -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) + @python -m sphinx -b $@ "$(SOURCEDIR)" "$(BUILDDIR)/$@" $(SPHINXOPTS) chm: @sed -E -i.bak -n "/^Binary (TOC|Index)=No$$/!p" "$(BUILDDIR)/htmlhelp/AGSHelpdoc.hhp" && \