1717from tqdm import tqdm
1818
1919logger = logging .getLogger (__name__ )
20+ # add our own stream handler - we want some output here
21+ handler = logging .StreamHandler ()
22+ handler .setFormatter (fmt = logging .Formatter (fmt = "[{levelname}] {msg}" , style = "{" ))
23+ handler .setLevel (logging .INFO )
24+ logger .setLevel (logging .INFO )
25+ logger .addHandler (handler )
2026
2127DOWNLOADS_FOLDER = Path (__pyppeteer_home__ ) / 'local-chromium'
2228DEFAULT_DOWNLOAD_HOST = 'https://storage.googleapis.com'
@@ -67,7 +73,7 @@ def get_url() -> str:
6773
6874def download_zip (url : str ) -> BytesIO :
6975 """Download data from url."""
70- logger .info ('Starting Chromium download. Download may take a few minutes. ' )
76+ logger .info ('Starting Chromium download.' )
7177
7278 with urllib3 .PoolManager (cert_reqs = 'CERT_REQUIRED' , ca_certs = certifi .where ()) as http :
7379 # Get data from url.
@@ -92,13 +98,13 @@ def download_zip(url: str) -> BytesIO:
9298 process_bar .update (len (chunk ))
9399 process_bar .close ()
94100
95- logger .info ('Chromium download done.' )
96101 return _data
97102
98103
99104def extract_zip (data : BytesIO , path : Path ) -> None :
100105 """Extract zipped data to path."""
101106 # On mac zipfile module cannot extract correctly, so use unzip instead.
107+ logger .info ('Beginning extraction' )
102108 if current_platform () == 'mac' :
103109 import subprocess
104110 import shutil
@@ -125,22 +131,14 @@ def extract_zip(data: BytesIO, path: Path) -> None:
125131 if not exec_path .exists ():
126132 raise IOError ('Failed to extract chromium.' )
127133 exec_path .chmod (exec_path .stat ().st_mode | stat .S_IXOTH | stat .S_IXGRP | stat .S_IXUSR )
128- logger .info (f'chromium extracted to: { path } ' )
134+ logger .info (f'Chromium extracted to: { path } ' )
129135
130136
131137def download_chromium () -> None :
132138 """Download and extract chromium."""
133139 extract_zip (download_zip (get_url ()), DOWNLOADS_FOLDER / REVISION )
134140
135141
136- def chromium_excutable () -> Path :
137- """[Deprecated] miss-spelled function.
138- Use `chromium_executable` instead.
139- """
140- logger .warning ('`chromium_excutable` function is deprecated. ' 'Use `chromium_executable instead.' )
141- return chromium_executable ()
142-
143-
144142def chromium_executable () -> Path :
145143 """Get path of the chromium executable."""
146144 return chromiumExecutable [current_platform ()]
0 commit comments