Level : WORDPRESS BOOK LINKEDIN PATENT Send Mail 동냥하기 hajunho.com

autoninja

Swift / / 2020. 10. 23. 09:56
반응형

 

import re

import os

import subprocess

import sys

 

rel_root_src = '../../'

abs_root_src = os.path.abspath(rel_root_src) + '/'

 

build_target = 'chrome'

ninja_binary = 'autoninja'

ninja_params = [ '-C', '../' + os.environ['CONFIGURATION'] + os.environ['EFFECTIVE_PLATFORM_NAME'] ]

 

environ = {}

environ['HOME'] = '/Users/eddie'

environ['LANG'] = 'ko_KR.UTF-8'

environ['PATH'] = '/Users/eddie/Github/depot_tools:/usr/local/Cellar/gnupg/2.2.21/bin:/Users/eddie/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin'

environ['USER'] = 'eddie'

environ['TMPDIR'] = os.environ.get('TMPDIR', '')

environ['ICECC_VERSION'] = ''

environ['ICECC_CLANG_REMOTE_CPP'] = ''

 

if build_target:

  ninja_params.append(build_target)

  print('Compile "' + build_target + '" via ninja')

else:

  print('Compile "all" via ninja')

 

process = subprocess.Popen(

    [ ninja_binary ] + ninja_params,

    stdout=subprocess.PIPE,

    stderr=subprocess.STDOUT,

    universal_newlines=True,

    encoding='utf-8',

    env=environ)

 

pattern = re.compile('(?<!/)' + re.escape(rel_root_src))

 

for line in iter(process.stdout.readline, ''):

  while True:

    match = pattern.search(line)

    if not match:

      break

    span = match.span()

    print(line[:span[0]], end='')

    print(abs_root_src, end='')

    line = line[span[1]:]

  print(line, flush=True, end='')

 

process.wait()

 

sys.exit(process.returncode)

반응형
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기