mirror of
https://github.com/MacDownApp/macdown.git
synced 2026-06-16 12:44:38 +00:00
31 lines
705 B
Python
31 lines
705 B
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
import subprocess
|
|
|
|
|
|
XCODEBUILD = '/usr/bin/xcodebuild'
|
|
|
|
XLIFF_URL = 'urn:oasis:names:tc:xliff:document:1.2'
|
|
|
|
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
|
class CommandError(Exception):
|
|
pass
|
|
|
|
|
|
def execute(*args):
|
|
proc = subprocess.Popen(
|
|
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
|
)
|
|
stdout, stderr = map(lambda s: s.decode('utf-8'), proc.communicate())
|
|
if proc.returncode:
|
|
raise CommandError(
|
|
'"{cmd}" failed with error {code}.\n {output}'.format(
|
|
cmd=' '.join(args), code=proc.returncode, output=stderr
|
|
)
|
|
)
|
|
return stdout
|