Closed r0ckarong closed 3 years ago
I'm suspecting a problem with how it tries to find the asciidoctor executable in Windows but the Path correctly contains the ruby bin
directory and directly calling the asciidoctor command from the subprocess works fine.
I realized now that it actually generates the intermediate files but fails to convert them to the final HTML on its own because of the bug.
To run AsciiDoxy on Windows and python 3.8.0 The following replacement of the function asciidoctor at cli.py can be used as workaround
def asciidoctor(destination_dir: Path, out_file: Path, processed_file: Path, multipage: bool,
backend: str, extra_args: Sequence[str], image_dir: Path) -> None:
args = [
"asciidoctor",
"-D", f"{destination_dir}", "-o", f"{out_file}", "-b" ,f"{backend}",
"-a", f"imagesdir@={image_dir}",
f"{processed_file}",
]
if multipage:
args = args + ["-a","multipage",]
args = args + extra_args
subprocess.run(args,
shell=True,
check=True)
Thank you for the suggestion. It was a little more involved than this to make it work on all platforms. Some snippets from the python documentation:
args should be a sequence of program arguments or else a single string. ... Unless otherwise stated, it is recommended to pass args as a sequence. ... If shell is True, it is recommended to pass args as a string rather than as a sequence. ... The only time you need to specify shell=True on Windows is when the command you wish to execute is built into the shell (e.g. dir or copy). You do not need shell=True to run a batch file or console-based executable.
I created separate logic to run on Windows platforms. It will be released as AsciiDoxy 0.7.5
Testing on Windows showed that shell=True
is still required. Updated the commit.
I've set up the example project like described in the docs. However, when I run AsciiDoxy it complains about not being able to find the specified path.
When I run the exact Asciidoctor command that if fails with (including all the double backslashes) it seems to work OK and I get some output in the correct directory.
I already tried progressing with the examples and added some doxygen files but the problem remains the same.
File structure
``` C:. | packages.toml | +---build | +---fragments | +---intermediate | | | .asciidoxy.index.adoc | | | index.adoc | | | reference.adoc | | | | | \---images | \---output | .asciidoxy.index.html | index.html | \---my-package | contents.toml | +---images +---src | index.adoc | reference.adoc | \---xmlAsciidoxy output
``` asciidoxy --base-dir .\src\ .\src\index.adoc ___ _ _ ____ 0.7.4 / | __________(_|_) __ \____ _ ____ __ / /| | / ___/ ___/ / / / / / __ \| |/_/ / / / / ___ |(__ ) /__/ / / /_/ / /_/ /> /_/ / /_/ |_/____/\___/_/_/_____/\____/_/|_|\__, / /____/ Preparing work directory: 100%|███████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 250.00pkg/s] Processing asciidoc : 100%|██████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00, 499.89file/s] Running asciidoctor : 0%| | 0/1 [00:00, ?file/s]The system cannot find the path specified. Running asciidoctor : 0%| | 0/1 [00:00, ?file/s] Traceback (most recent call last): File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Python39\Scripts\asciidoxy.exe\__main__.py", line 7, in