Extra logging at build.py + rearrange ifs

This commit is contained in:
Ivan Blinkov 2020-03-30 22:33:33 +03:00 committed by GitHub
parent 7c2c8e2d1b
commit 2f40335390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,7 +219,7 @@ def build_single_page_version(lang, args, cfg):
single_page_output_path
)
if not args.skip_pdf:
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')
@ -239,18 +239,18 @@ def build_single_page_version(lang, args, cfg):
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,8 +262,10 @@ 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
logging.info(f'Running tests for {lang}')
test.test_single_page(
os.path.join(test_dir, 'single', 'index.html'), lang)