Commit 9a0652f0 authored by Michael Murtaugh's avatar Michael Murtaugh
Browse files

smake quite option to avoid utf-8 errors with scons printing out

parent 622450e3
......@@ -17,7 +17,7 @@ def extract (text):
def get_info(path, data=None):
p = subprocess.run(["identify", path], capture_output=True)
o = p.stdout.decode("utf-8")
o = p.stdout.decode("utf-8", errors="replace")
if data == None:
data = {}
data['mediatype'] = "image"
......
......@@ -28,7 +28,7 @@ def extract_duration (text):
async def pdf_info_from_data (data):
p = await asyncio.create_subprocess_exec("pdfinfo", "-", stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE)
stdout, stderr = await p.communicate(data)
stdout = stdout.decode("utf-8")
stdout = stdout.decode("utf-8", errors="replace")
d = {}
for line in stdout.splitlines():
if ":" in line:
......@@ -40,7 +40,7 @@ async def pdf_info_from_data (data):
def get_info(url, d=None):
popen = subprocess.Popen(["pdfinfo", url], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
o = popen.communicate()[0].decode("utf-8")
o = popen.communicate()[0].decode("utf-8", errors="replace")
if d is None:
d = {}
d['mediatype'] = "pdf"
......
......@@ -14,6 +14,8 @@ def main (args):
env = os.environ.copy()
env['SCONS_TEMPLATE'] = template_path
cmd = ["scons", "-f", sconstruct_path] + args.path
if args.quiet:
cmd.append("--quiet")
if args.root:
env['SCONS_ROOT'] = args.root
p = subprocess.run(cmd, env=env, cwd=args.root)
......@@ -27,6 +29,7 @@ def add_subparser (subparsers):
p.add_argument('--sconstruct')
# usage: go to root folder
p.add_argument('--root', help='root, default .')
p.add_argument('--quiet', actions="store_true", default=False)
p.add_argument('path', nargs="*")
p.set_defaults(func=main)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment