mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Extra logging at build.py + rearrange ifs
This commit is contained in:
parent
7c2c8e2d1b
commit
2f40335390
@ -218,39 +218,39 @@ def build_single_page_version(lang, args, cfg):
|
||||
os.path.join(site_temp, 'single'),
|
||||
single_page_output_path
|
||||
)
|
||||
|
||||
logging.info(f'Re-building single page for {lang} pdf/test')
|
||||
with util.temp_dir() as test_dir:
|
||||
single_page_pdf = os.path.abspath(
|
||||
os.path.join(single_page_output_path, f'clickhouse_{lang}.pdf')
|
||||
)
|
||||
extra['single_page'] = False
|
||||
cfg.load_dict({
|
||||
'docs_dir': docs_temp_lang,
|
||||
'site_dir': test_dir,
|
||||
'extra': extra,
|
||||
'nav': [
|
||||
{cfg.data.get('site_name'): 'single.md'}
|
||||
]
|
||||
})
|
||||
mkdocs_build.build(cfg)
|
||||
|
||||
if not args.skip_pdf:
|
||||
with util.temp_dir() as test_dir:
|
||||
single_page_pdf = os.path.abspath(
|
||||
os.path.join(single_page_output_path, f'clickhouse_{lang}.pdf')
|
||||
)
|
||||
extra['single_page'] = False
|
||||
cfg.load_dict({
|
||||
'docs_dir': docs_temp_lang,
|
||||
'site_dir': test_dir,
|
||||
'extra': extra,
|
||||
'nav': [
|
||||
{cfg.data.get('site_name'): 'single.md'}
|
||||
]
|
||||
})
|
||||
mkdocs_build.build(cfg)
|
||||
|
||||
css_in = ' '.join(website.get_css_in(args))
|
||||
js_in = ' '.join(website.get_js_in(args))
|
||||
subprocess.check_call(f'cat {css_in} > {test_dir}/css/base.css', shell=True)
|
||||
subprocess.check_call(f'cat {js_in} > {test_dir}/js/base.js', shell=True)
|
||||
css_in = ' '.join(website.get_css_in(args))
|
||||
js_in = ' '.join(website.get_js_in(args))
|
||||
subprocess.check_call(f'cat {css_in} > {test_dir}/css/base.css', shell=True)
|
||||
subprocess.check_call(f'cat {js_in} > {test_dir}/js/base.js', shell=True)
|
||||
if not args.skip_pdf:
|
||||
port_for_pdf = util.get_free_port()
|
||||
with socketserver.TCPServer(
|
||||
('', port_for_pdf), http.server.SimpleHTTPRequestHandler
|
||||
) as httpd:
|
||||
logging.info(f"serving for pdf at port {port_for_pdf}")
|
||||
logging.info(f"Serving for {lang} pdf at port {port_for_pdf}")
|
||||
thread = threading.Thread(target=httpd.serve_forever)
|
||||
with util.cd(test_dir):
|
||||
thread.start()
|
||||
create_pdf_command = [
|
||||
'wkhtmltopdf',
|
||||
'--print-media-type',
|
||||
'--no-stop-slow-scripts',
|
||||
'--log-level', 'warn',
|
||||
f'http://localhost:{port_for_pdf}/single/', single_page_pdf
|
||||
]
|
||||
@ -262,10 +262,12 @@ def build_single_page_version(lang, args, cfg):
|
||||
finally:
|
||||
httpd.shutdown()
|
||||
thread.join(timeout=5.0)
|
||||
logging.info(f"Stop serving for {lang} pdf at port {port_for_pdf}")
|
||||
|
||||
if not args.version_prefix: # maybe enable in future
|
||||
test.test_single_page(
|
||||
os.path.join(test_dir, 'single', 'index.html'), lang)
|
||||
if not args.version_prefix: # maybe enable in future
|
||||
logging.info(f'Running tests for {lang}')
|
||||
test.test_single_page(
|
||||
os.path.join(test_dir, 'single', 'index.html'), lang)
|
||||
|
||||
logging.info(f'Finished building single page version for {lang}')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user