mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
sb: Update code base to support Python3 and Python2.
Fix Windows support to allow MSYS2 Python to be used. Updates #2619.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#! /usr/bin/env python
|
||||
#
|
||||
# RTEMS Tools Project (http://www.rtems.org/)
|
||||
# Copyright 2014 Chris Johns (chrisj@rtems.org)
|
||||
# Copyright 2014-2016 Chris Johns (chrisj@rtems.org)
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of the RTEMS Tools package in 'rtems-tools'.
|
||||
@@ -29,6 +29,8 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -42,13 +44,13 @@ except:
|
||||
try:
|
||||
import argparse
|
||||
except:
|
||||
print >> sys.stderr, "Incorrect Source Builder installation"
|
||||
print("Incorrect Source Builder installation", file = sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
import pkgconfig
|
||||
except ImportError:
|
||||
print >> sys.stderr, "Incorrect Source Builder installation"
|
||||
print("Incorrect Source Builder installation", file = sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
@@ -81,12 +83,12 @@ def log(s, lf = True):
|
||||
out = sys.stdout
|
||||
if lf:
|
||||
if out != sys.stdout and trace_stdout:
|
||||
print s
|
||||
print >> out, s
|
||||
print(s)
|
||||
print(s, file = out)
|
||||
else:
|
||||
if out != sys.stdout and trace_stdout:
|
||||
print s,
|
||||
print >> out, s,
|
||||
print(s, end = '', flush = True)
|
||||
print(out, s, end = '', flush = True)
|
||||
|
||||
def run(argv):
|
||||
|
||||
@@ -191,13 +193,13 @@ def run(argv):
|
||||
if ec == 0:
|
||||
if args.cflags:
|
||||
if len(flags['cflags']):
|
||||
print flags['cflags']
|
||||
print(flags['cflags'])
|
||||
log('cflags: %s' % (flags['cflags']))
|
||||
else:
|
||||
log('cflags: empty')
|
||||
if args.libs:
|
||||
if len(flags['libs']):
|
||||
print flags['libs']
|
||||
print(flags['libs'])
|
||||
log('libs: %s' % (flags['libs']))
|
||||
else:
|
||||
log('libs: empty')
|
||||
@@ -215,9 +217,9 @@ try:
|
||||
ec = run(sys.argv)
|
||||
log('ec = %d' % (ec))
|
||||
except ImportError:
|
||||
print >> sys.stderr, "incorrect package config installation"
|
||||
print("incorrect package config installation", file = sys.stderr)
|
||||
sys.exit(1)
|
||||
except pkgconfig.error, e:
|
||||
print >> sys.stderr, 'error: %s' % (e)
|
||||
print('error: %s' % (e), file = sys.stderr)
|
||||
sys.exit(1)
|
||||
sys.exit(ec)
|
||||
|
Reference in New Issue
Block a user