Skip to contentSkip to conversation

Add building man page on Windows

PATCH Superseded Lev Stipakov 3 participants 8 messages Aug 24, 2021 – Sep 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add building man page on Windows

From: Lev Stipakov <[email protected]...>

Use rst2html to build html from rst. Ignore error - this is not fatal and affects only MSI build.

---
 build/msvc/msvc-generate/Makefile.mak | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
build/msvc/msvc-generate/Makefile.mak +8 -1
index 59fc9f0e..36c2618f 100644
@@ -11,7 +11,10 @@ OUTPUT_PLUGIN=$(SOURCEBASE)/include/openvpn-plugin.h
 INPUT_PLUGIN_CONFIG=version.m4.in
 OUTPUT_PLUGIN_CONFIG=version.m4
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN)
+INPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.rst
+OUTPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.html
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
 
 $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
 	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -22,7 +25,11 @@ $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG)
 $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
 	cscript //nologo msvc-generate.js --config="$(OUTPUT_PLUGIN_CONFIG)" --input="$(INPUT_PLUGIN)" --output="$(OUTPUT_PLUGIN)"
 
+$(OUTPUT_MAN): $(INPUT_MAN)
+	rst2html.py $(INPUT_MAN) $(OUTPUT_MAN) || echo "rst2html failed, expect problems with MSI build"
+
 clean:
 	-del "$(OUTPUT_MSVC_VER)"
 	-del "$(OUTPUT_PLUGIN)"
 	-del "$(OUTPUT_PLUGIN_CONFIG)"
+	-del "$(OUTPUT_MAN)"
Signature · 1 line
2.23.0.windows.1
#1 lore raw

PATCH v2 1/1 Add building man page on Windows

From: Lev Stipakov <[email protected]...>

Use rst2html to build html from rst. Ignore errors, this is not fatal and affects only MSI build.

Modify MSVC GitHub Actions to install python3/rst2html and add html man page to artifacts.

---
v2:
- change implementation to support GitHub Actions

 .github/workflows/build.yaml          | 9 +++++++++
 build/msvc/msvc-generate/Makefile.mak | 9 ++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
.github/workflows/build.yaml +9 -0
index 5d7dd37b..4cb2f4cc 100644
@@ -206,6 +206,14 @@ jobs:
       - name: Add MSBuild to PATH
         uses: microsoft/[email protected]...
 
+      - name: Set up Python
+        uses: actions/[email protected]...
+        with:
+          python-version: '3.x'
+
+      - name: Install rst2html
+        run: python -m pip install --upgrade pip rst2html
+
       - name: Restore artifacts, or run vcpkg, build and cache artifacts
         uses: lukka/[email protected]...
         with:
@@ -227,3 +235,4 @@ jobs:
           path: |
             ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.exe
             ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.dll
+            doc/openvpn.8.html
build/msvc/msvc-generate/Makefile.mak +8 -1
index 59fc9f0e..4924a6ce 100644
@@ -11,7 +11,10 @@ OUTPUT_PLUGIN=$(SOURCEBASE)/include/openvpn-plugin.h
 INPUT_PLUGIN_CONFIG=version.m4.in
 OUTPUT_PLUGIN_CONFIG=version.m4
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN)
+INPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.rst
+OUTPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.html
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
 
 $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
 	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -22,7 +25,11 @@ $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG)
 $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
 	cscript //nologo msvc-generate.js --config="$(OUTPUT_PLUGIN_CONFIG)" --input="$(INPUT_PLUGIN)" --output="$(OUTPUT_PLUGIN)"
 
+$(OUTPUT_MAN): $(INPUT_MAN)
+    -FOR /F %i IN ('where rst2html.py') DO python3 %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
+
 clean:
 	-del "$(OUTPUT_MSVC_VER)"
 	-del "$(OUTPUT_PLUGIN)"
 	-del "$(OUTPUT_PLUGIN_CONFIG)"
+	-del "$(OUTPUT_MAN)"
Signature · 1 line
2.23.0.windows.1
#2 lore raw

Hi,

I smoke-tested this on Linux and it does not break anything (docutils installed or not). Results of Windows testing below.

Il 24/08/21 16:46, Lev Stipakov ha scritto:

Quoted 58 lines

From: Lev Stipakov <[email protected]...>

Use rst2html to build html from rst. Ignore errors, this is not fatal and affects only MSI build.

Modify MSVC GitHub Actions to install python3/rst2html and add html man page to artifacts.

---
v2:
- change implementation to support GitHub Actions

  .github/workflows/build.yaml          | 9 +++++++++
  build/msvc/msvc-generate/Makefile.mak | 9 ++++++++-
  2 files changed, 17 insertions(+), 1 deletion(-)
.github/workflows/build.yaml +9 -0
index 5d7dd37b..4cb2f4cc 100644
@@ -206,6 +206,14 @@ jobs:
        - name: Add MSBuild to PATH
          uses: microsoft/[email protected]...
 
+      - name: Set up Python
+        uses: actions/[email protected]...
+        with:
+          python-version: '3.x'
+
+      - name: Install rst2html
+        run: python -m pip install --upgrade pip rst2html
+
        - name: Restore artifacts, or run vcpkg, build and cache artifacts
          uses: lukka/[email protected]...
          with:
@@ -227,3 +235,4 @@ jobs:
            path: |
              ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.exe
              ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.dll
+            doc/openvpn.8.html
build/msvc/msvc-generate/Makefile.mak +4 -1
index 59fc9f0e..4924a6ce 100644
@@ -11,7 +11,10 @@ OUTPUT_PLUGIN=$(SOURCEBASE)/include/openvpn-plugin.h
  INPUT_PLUGIN_CONFIG=version.m4.in
  OUTPUT_PLUGIN_CONFIG=version.m4
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN)
+INPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.rst
+OUTPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.html
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
 
  $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
  	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"

build/msvc/msvc-generate/Makefile.mak $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG) · line 29

Quoted 5 lines
build/msvc/msvc-generate/Makefile.mak +2 -0
@@ -22,7 +25,11 @@ $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG)
  $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
  	cscript //nologo msvc-generate.js --config="$(OUTPUT_PLUGIN_CONFIG)" --input="$(INPUT_PLUGIN)" --output="$(OUTPUT_PLUGIN)"
 
+$(OUTPUT_MAN): $(INPUT_MAN)
+    -FOR /F %i IN ('where rst2html.py') DO python3 %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"

This line breaks at least if Python 3 was installed with Chocolatey[1]:

choco install python

The problem is that there's no "python3" binary in PATH. There is a "python" binary though. If I change the line above to say "python" I get a HTML man-page out.

Maybe "python3" is gone from the latest Python packages? If not, I can have a look at what Chocolatey is doing when installing the Python package.

build/msvc/msvc-generate/Makefile.mak $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG) · line 35

Quoted 7 lines
build/msvc/msvc-generate/Makefile.mak +2 -0
+
  clean:
  	-del "$(OUTPUT_MSVC_VER)"
  	-del "$(OUTPUT_PLUGIN)"
  	-del "$(OUTPUT_PLUGIN_CONFIG)"
+	-del "$(OUTPUT_MAN)"

[1] <https://community.chocolatey.org/packages/python/3.9.6>

#3 lore raw

PATCH v3 1/1 Add building man page on Windows

From: Lev Stipakov <[email protected]...>

Use rst2html to build html from rst. Ignore errors, this is not fatal and affects only MSI build.

Modify MSVC GitHub Actions to install python3/rst2html and add html man page to artifacts.

---
v3:
- replace "python3" with "python"

v2:
- change implementation to support GitHub Actions

 .github/workflows/build.yaml          | 9 +++++++++
 build/msvc/msvc-generate/Makefile.mak | 9 ++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
.github/workflows/build.yaml +9 -0
index 5d7dd37b..4cb2f4cc 100644
@@ -206,6 +206,14 @@ jobs:
       - name: Add MSBuild to PATH
         uses: microsoft/[email protected]...
 
+      - name: Set up Python
+        uses: actions/[email protected]...
+        with:
+          python-version: '3.x'
+
+      - name: Install rst2html
+        run: python -m pip install --upgrade pip rst2html
+
       - name: Restore artifacts, or run vcpkg, build and cache artifacts
         uses: lukka/[email protected]...
         with:
@@ -227,3 +235,4 @@ jobs:
           path: |
             ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.exe
             ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.dll
+            doc/openvpn.8.html
build/msvc/msvc-generate/Makefile.mak +8 -1
index 59fc9f0e..4924a6ce 100644
@@ -11,7 +11,10 @@ OUTPUT_PLUGIN=$(SOURCEBASE)/include/openvpn-plugin.h
 INPUT_PLUGIN_CONFIG=version.m4.in
 OUTPUT_PLUGIN_CONFIG=version.m4
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN)
+INPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.rst
+OUTPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.html
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
 
 $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
 	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -22,7 +25,11 @@ $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG)
 $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
 	cscript //nologo msvc-generate.js --config="$(OUTPUT_PLUGIN_CONFIG)" --input="$(INPUT_PLUGIN)" --output="$(OUTPUT_PLUGIN)"
 
+$(OUTPUT_MAN): $(INPUT_MAN)
+    -FOR /F %i IN ('where rst2html.py') DO python3 %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
+
 clean:
 	-del "$(OUTPUT_MSVC_VER)"
 	-del "$(OUTPUT_PLUGIN)"
 	-del "$(OUTPUT_PLUGIN_CONFIG)"
+	-del "$(OUTPUT_MAN)"
Signature · 1 line
2.23.0.windows.1
#4 lore raw

PATCH v4 1/1 Add building man page on Windows

From: Lev Stipakov <[email protected]...>

Use rst2html to build html from rst. Ignore errors, this is not fatal and affects only MSI build.

Modify MSVC GitHub Actions to install python3/rst2html and add html man page to artifacts.

---

v4:
- really replace "python3" with "python"

v3:
- replace "python3" with "python"

v2:
- change implementation to support GitHub Actions

 .github/workflows/build.yaml          | 9 +++++++++
 build/msvc/msvc-generate/Makefile.mak | 9 ++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
.github/workflows/build.yaml +9 -0
index 5d7dd37b..4cb2f4cc 100644
@@ -206,6 +206,14 @@ jobs:
       - name: Add MSBuild to PATH
         uses: microsoft/[email protected]...
 
+      - name: Set up Python
+        uses: actions/[email protected]...
+        with:
+          python-version: '3.x'
+
+      - name: Install rst2html
+        run: python -m pip install --upgrade pip rst2html
+
       - name: Restore artifacts, or run vcpkg, build and cache artifacts
         uses: lukka/[email protected]...
         with:
@@ -227,3 +235,4 @@ jobs:
           path: |
             ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.exe
             ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.dll
+            doc/openvpn.8.html
build/msvc/msvc-generate/Makefile.mak +8 -1
index 59fc9f0e..6da859e3 100644
@@ -11,7 +11,10 @@ OUTPUT_PLUGIN=$(SOURCEBASE)/include/openvpn-plugin.h
 INPUT_PLUGIN_CONFIG=version.m4.in
 OUTPUT_PLUGIN_CONFIG=version.m4
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN)
+INPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.rst
+OUTPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.html
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
 
 $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
 	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -22,7 +25,11 @@ $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG)
 $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
 	cscript //nologo msvc-generate.js --config="$(OUTPUT_PLUGIN_CONFIG)" --input="$(INPUT_PLUGIN)" --output="$(OUTPUT_PLUGIN)"
 
+$(OUTPUT_MAN): $(INPUT_MAN)
+    -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
+
 clean:
 	-del "$(OUTPUT_MSVC_VER)"
 	-del "$(OUTPUT_PLUGIN)"
 	-del "$(OUTPUT_PLUGIN_CONFIG)"
+	-del "$(OUTPUT_MAN)"
Signature · 1 line
2.23.0.windows.1
#5 lore raw

Il 25/08/21 19:47, Lev Stipakov ha scritto:

Quoted 67 lines

From: Lev Stipakov <[email protected]...>

Use rst2html to build html from rst. Ignore errors, this is not fatal and affects only MSI build.

Modify MSVC GitHub Actions to install python3/rst2html and add html man page to artifacts.

---

v4:
- really replace "python3" with "python"

v3:
- replace "python3" with "python"

v2:
- change implementation to support GitHub Actions

  .github/workflows/build.yaml          | 9 +++++++++
  build/msvc/msvc-generate/Makefile.mak | 9 ++++++++-
  2 files changed, 17 insertions(+), 1 deletion(-)
.github/workflows/build.yaml +9 -0
index 5d7dd37b..4cb2f4cc 100644
@@ -206,6 +206,14 @@ jobs:
        - name: Add MSBuild to PATH
          uses: microsoft/[email protected]...
 
+      - name: Set up Python
+        uses: actions/[email protected]...
+        with:
+          python-version: '3.x'
+
+      - name: Install rst2html
+        run: python -m pip install --upgrade pip rst2html
+
        - name: Restore artifacts, or run vcpkg, build and cache artifacts
          uses: lukka/[email protected]...
          with:
@@ -227,3 +235,4 @@ jobs:
            path: |
              ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.exe
              ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.dll
+            doc/openvpn.8.html
build/msvc/msvc-generate/Makefile.mak +4 -1
index 59fc9f0e..6da859e3 100644
@@ -11,7 +11,10 @@ OUTPUT_PLUGIN=$(SOURCEBASE)/include/openvpn-plugin.h
  INPUT_PLUGIN_CONFIG=version.m4.in
  OUTPUT_PLUGIN_CONFIG=version.m4
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN)
+INPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.rst
+OUTPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.html
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
 
  $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
  	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -22,7 +25,11 @@ $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG)
  $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)

build/msvc/msvc-generate/Makefile.mak $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG) · line 35

Quoted 10 lines
build/msvc/msvc-generate/Makefile.mak +4 -0
  	cscript //nologo msvc-generate.js --config="$(OUTPUT_PLUGIN_CONFIG)" --input="$(INPUT_PLUGIN)" --output="$(OUTPUT_PLUGIN)"
 
+$(OUTPUT_MAN): $(INPUT_MAN)
+    -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
+
  clean:
  	-del "$(OUTPUT_MSVC_VER)"
  	-del "$(OUTPUT_PLUGIN)"
  	-del "$(OUTPUT_PLUGIN_CONFIG)"
+	-del "$(OUTPUT_MAN)"

Works. ACK.

Samuli

#6 lore raw
In reply to Lev Stipakov

Your patch has been applied to the master branch.

commit d814581a9375713a0a4d70f751f84e750a5d661a

Author: Lev Stipakov
Date:   Wed Aug 25 19:47:52 2021 +0300
     Add building man page on Windows

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Samuli Seppänen <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg22771.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#7 lore raw

Hi,

Quoted 7 lines · Gert Doering

Your patch has been applied to the master branch.

commit d814581a9375713a0a4d70f751f84e750a5d661a

Author: Lev Stipakov
Date:   Wed Aug 25 19:47:52 2021 +0300

Add building man page on Windows

... and pulled up to release/2.5

commit 35c8281ef20de507dc08637bff02ce7895b48ec6 (HEAD -> release/2.5)

Author: Lev Stipakov <[email protected]...>
Date:   Wed Aug 25 19:47:52 2021 +0300

Add building man page on Windows

(cherry picked from commit d814581a9375713a0a4d70f751f84e750a5d661a)

(one minor conflict due to the ".pdb" artefacts patch not being in 2.5, but that was trivially solved)

I have not tested this myself, but Lev confirmed on IRC that it works with 2.5 as well.

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...