This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git

commit 4598877e923966c46c9368cd5b3c24b46de0cff8
Author: tison <[email protected]>
AuthorDate: Wed May 3 09:37:43 2023 +0800

    [fix] Create parents on references generating
    
    Signed-off-by: tison <[email protected]>
---
 tools/pytools/lib/execute/config_doc_generator.py           | 4 +++-
 tools/pytools/lib/execute/pulsar_admin_clidoc_generator.py  | 4 +++-
 tools/pytools/lib/execute/pulsar_clidoc_generator.py        | 4 +++-
 tools/pytools/lib/execute/pulsar_client_clidoc_generator.py | 1 +
 tools/pytools/lib/execute/pulsar_perf_clidoc_generator.py   | 1 +
 5 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/pytools/lib/execute/config_doc_generator.py 
b/tools/pytools/lib/execute/config_doc_generator.py
index b5ad27c1d9e..c0f08d60030 100644
--- a/tools/pytools/lib/execute/config_doc_generator.py
+++ b/tools/pytools/lib/execute/config_doc_generator.py
@@ -94,7 +94,9 @@ def execute(master: Path, version: str):
     ]
 
     for config in configs:
-        with (reference / config.type / config.filename).open('w') as f:
+        p = (reference / config.type / config.filename)
+        p.parent.mkdir(exist_ok=True, parents=True)
+        with p.open('w') as f:
             run(java, '-cp', classpath, config.generator, '-c', 
config.classname, stdout=f)
 
     shutil.copy2(
diff --git a/tools/pytools/lib/execute/pulsar_admin_clidoc_generator.py 
b/tools/pytools/lib/execute/pulsar_admin_clidoc_generator.py
index 088312b5319..7f1c8bf3b14 100644
--- a/tools/pytools/lib/execute/pulsar_admin_clidoc_generator.py
+++ b/tools/pytools/lib/execute/pulsar_admin_clidoc_generator.py
@@ -49,5 +49,7 @@ def execute(basedir: Path, version: str):
     ]
 
     for command in commands:
-        with (reference / f'{command}.md').open('w') as f:
+        p = (reference / f'{command}.md')
+        p.parent.mkdir(exist_ok=True, parents=True)
+        with p.open('w') as f:
             run(str(admin.absolute()), 'documents', 'generate', command, 
stdout=f)
diff --git a/tools/pytools/lib/execute/pulsar_clidoc_generator.py 
b/tools/pytools/lib/execute/pulsar_clidoc_generator.py
index ffc9f20ae48..e76c4bc9fb6 100644
--- a/tools/pytools/lib/execute/pulsar_clidoc_generator.py
+++ b/tools/pytools/lib/execute/pulsar_clidoc_generator.py
@@ -43,7 +43,9 @@ def execute(basedir: Path, version: str):
     ]
 
     for command in commands:
-        with (reference / f'{command[0]}.md').open('w') as f:
+        p = (reference / f'{command[0]}.md')
+        p.parent.mkdir(exist_ok=True, parents=True)
+        with p.open('w') as f:
             run(str(pulsar.absolute()), *command, codes={0, 255}, stdout=f, 
env={
                 'PULSAR_BROKER_CONF': 'conf/broker.conf',
                 'PULSAR_WORKER_CONF': 'conf/functions_worker.yml',
diff --git a/tools/pytools/lib/execute/pulsar_client_clidoc_generator.py 
b/tools/pytools/lib/execute/pulsar_client_clidoc_generator.py
index c3c1616e0b6..fdba56f1ac5 100644
--- a/tools/pytools/lib/execute/pulsar_client_clidoc_generator.py
+++ b/tools/pytools/lib/execute/pulsar_client_clidoc_generator.py
@@ -25,5 +25,6 @@ def execute(basedir: Path, version: str):
     client = basedir / 'bin' / 'pulsar-client'
     reference = site_path() / 'static' / 'reference' / version / 
'pulsar-client'
 
+    reference.mkdir(exist_ok=True, parents=True)
     with (reference / 'pulsar-client.md').open('w') as f:
         run(str(client.absolute()), 'generate_documentation', stdout=f)
diff --git a/tools/pytools/lib/execute/pulsar_perf_clidoc_generator.py 
b/tools/pytools/lib/execute/pulsar_perf_clidoc_generator.py
index e737eed00f0..d6450d3f848 100644
--- a/tools/pytools/lib/execute/pulsar_perf_clidoc_generator.py
+++ b/tools/pytools/lib/execute/pulsar_perf_clidoc_generator.py
@@ -25,5 +25,6 @@ def execute(basedir: Path, version: str):
     perf = basedir / 'bin' / 'pulsar-perf'
     reference = site_path() / 'static' / 'reference' / version / 'pulsar-perf'
 
+    reference.mkdir(exist_ok=True, parents=True)
     with (reference / 'pulsar-perf.md').open('w') as f:
         run(str(perf.absolute()), 'gen-doc', stdout=f)

Reply via email to