sb: Use shebang env python

Closes #4037
This commit is contained in:
Chris Johns 2020-08-25 21:21:50 +10:00
parent 40af487dfc
commit 650c6f9933
46 changed files with 469 additions and 713 deletions

View File

@ -1,27 +1,221 @@
#! /bin/sh #! /usr/bin/env python
# #
# RTEMS Tools Project (http://www.rtems.org/) # RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2018 Chris Johns (chrisj@rtems.org) # Copyright 2014-2016 Chris Johns (chrisj@rtems.org)
# All rights reserved. # All rights reserved.
# #
# This file is part of the RTEMS Tools package in 'rtems-tools'. # This file is part of the RTEMS Tools package in 'rtems-tools'.
# #
# Permission to use, copy, modify, and/or distribute this software for any # Redistribution and use in source and binary forms, with or without
# purpose with or without fee is hereby granted, provided that the above # modification, are permitted provided that the following conditions are met:
# copyright notice and this permission notice appear in all copies.
# #
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # 1. Redistributions of source code must retain the above copyright notice,
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # this list of conditions and the following disclaimer.
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# #
set -e # 2. Redistributions in binary form must reproduce the above copyright notice,
base=$(dirname $0) # this list of conditions and the following disclaimer in the documentation
PYTHON_CMD=${base}/sb/cmd-pkg-config.py # and/or other materials provided with the distribution.
if test -f ${base}/sb/python-wrapper.sh; then #
. ${base}/sb/python-wrapper.sh # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
fi # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
echo "error: python wrapper not found" # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
from __future__ import print_function
import os
import sys
base = os.path.dirname(sys.argv[0])
try:
import argparse
except:
sys.path.insert(0, base + '/sb/imports')
try:
import argparse
except:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)
import sb.pkgconfig
#
# Make trace true to get a file of what happens and what is being asked.
#
trace = False
trace_stdout = False
logfile = 'pkg-config.log'
out = None
srcfd = None
#
# Write all the package source parsed to a single file.
#
trace_src = False
if trace_src:
srcfd = open('pkg-src.txt', 'w')
def src(text):
if srcfd:
srcfd.writelines(text)
def log(s, lf = True):
global trace, logfile, out
if trace:
if out is None:
if logfile:
out = open(logfile, 'a')
else:
out = sys.stdout
if lf:
if out != sys.stdout and trace_stdout:
print(s)
print(s, file = out)
else:
if out != sys.stdout and trace_stdout:
print(s, end = '')
sys.stdout.flush()
print(s, end = '', file = out)
def run(argv):
class version_action(argparse.Action):
def __call__(self, parser, namespace, values, option_string = None):
parts = values[0].strip().split('.')
for p in parts:
if not p.isdigit():
raise error('invalid version value: %s' % (values))
setattr(namespace, self.dest, '.'.join(parts))
ec = 0
opts = argparse.ArgumentParser(prog = 'pkg-config', description = 'Package Configuration.')
opts.add_argument('libraries', metavar='lib', type = str, help = 'a library', nargs = '*')
opts.add_argument('--modversion', dest = 'modversion', action = 'store', default = None,
help = 'Requests that the version information of the libraries.')
opts.add_argument('--print-errors', dest = 'print_errors', action = 'store_true',
default = False,
help = 'Print any errors.')
opts.add_argument('--short-errors', dest = 'short_errors', action = 'store_true',
default = False,
help = 'Make error messages short.')
opts.add_argument('--silence-errors', dest = 'silence_errors', action = 'store_true',
default = False,
help = 'Do not print any errors.')
opts.add_argument('--errors-to-stdout', dest = 'errors_to_stdout', action = 'store_true',
default = False,
help = 'Print errors to stdout rather than stderr.')
opts.add_argument('--cflags', dest = 'cflags', action = 'store_true',
default = False,
help = 'This prints pre-processor and compile flags required to' \
' compile the package(s)')
opts.add_argument('--libs', dest = 'libs', action = 'store_true',
default = False,
help = 'This option is identical to "--cflags", only it prints the' \
' link flags.')
opts.add_argument('--libs-only-L', dest = 'libs_only_L', action = 'store_true',
default = False,
help = 'This prints the -L/-R part of "--libs".')
opts.add_argument('--libs-only-l', dest = 'libs_only_l', action = 'store_true',
default = False,
help = 'This prints the -l part of "--libs".')
opts.add_argument('--variable', dest = 'variable', action = 'store',
nargs = 1, default = None,
help = 'This returns the value of a variable.')
opts.add_argument('--define-variable', dest = 'define_variable', action = 'store',
nargs = 1, default = None,
help = 'This sets a global value for a variable')
opts.add_argument('--uninstalled', dest = 'uninstalled', action = 'store_true',
default = False,
help = 'Ignored')
opts.add_argument('--atleast-pkgconfig-version', dest = 'atleast_pkgconfig_version',
action = 'store', nargs = 1, default = None,
help = 'Check the version of package config. Always ok.')
opts.add_argument('--exists', dest = 'exists', action = 'store_true',
default = False,
help = 'Test if a library is present')
opts.add_argument('--atleast-version', dest = 'atleast_version',
action = version_action, nargs = 1, default = None,
help = 'The package is at least this version.')
opts.add_argument('--exact-version', dest = 'exact_version', action = version_action,
nargs = 1, default = None,
help = 'The package is the exact version.')
opts.add_argument('--max-version', dest = 'max_version', action = version_action,
nargs = 1, default = None,
help = 'The package is no later than this version.')
opts.add_argument('--msvc-syntax', dest = 'msvc_syntax', action = 'store_true',
default = False,
help = 'Ignored')
opts.add_argument('--dont-define-prefix', dest = 'dont_define_prefix', action = 'store_true',
default = False,
help = 'Ignored')
opts.add_argument('--prefix-variable', dest = 'prefix', action = 'store',
nargs = 1, default = sb.pkgconfig.default_prefix(),
help = 'Define the prefix.')
opts.add_argument('--static', dest = 'static', action = 'store_true',
default = False,
help = 'Output libraries suitable for static linking')
opts.add_argument('--dump', dest = 'dump', action = 'store_true',
default = False,
help = 'Dump the package if one is found.')
args = opts.parse_args(argv)
if (args.exists and (args.exact_version or args.max_version)) or \
(args.exact_version and (args.exists or args.max_version)) or \
(args.max_version and (args.exists or args.exact_version)):
raise error('only one of --exists, --exact-version, or --max-version')
if args.dont_define_prefix:
args.prefix = sb.pkgconfig.default_prefix(False)
exists = False
ec = 1
if args.atleast_pkgconfig_version:
ec = 0
else:
ec, pkg, flags = sb.pkgconfig.check_package(args.libraries, args, log, src)
if ec == 0:
if args.cflags:
if len(flags['cflags']):
print(flags['cflags'])
log('cflags: %s' % (flags['cflags']))
else:
log('cflags: empty')
if args.libs:
if len(flags['libs']):
print(flags['libs'])
log('libs: %s' % (flags['libs']))
else:
log('libs: empty')
#pkgconfig.package.dump_loaded()
return ec
try:
log('-' * 40)
log('pkg-config', lf = False)
for a in sys.argv[2:]:
log(' "%s"' % (a), lf = False)
log('')
ec = run(sys.argv[1:])
log('ec = %d' % (ec))
except ImportError:
print("incorrect package config installation", file = sys.stderr)
sys.exit(1)
except sb.pkgconfig.error as e:
print('error: %s' % (e), file = sys.stderr)
sys.exit(1)
sys.exit(ec)

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /usr/bin/env python
# #
# RTEMS Tools Project (http://www.rtems.org/) # RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2018 Chris Johns (chrisj@rtems.org) # Copyright 2010-2012 Chris Johns (chrisj@rtems.org)
# All rights reserved. # All rights reserved.
# #
# This file is part of the RTEMS Tools package in 'rtems-tools'. # This file is part of the RTEMS Tools package in 'rtems-tools'.
@ -17,11 +17,15 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
set -e from __future__ import print_function
base=$(dirname $0)
PYTHON_CMD=${base}/sb/cmd-check.py import sb.check
if test -f ${base}/sb/python-wrapper.sh; then
. ${base}/sb/python-wrapper.sh try:
fi import sb.check
echo "error: python wrapper not found" sb.check.run()
except ImportError:
import sys
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /usr/bin/env python
# #
# RTEMS Tools Project (http://www.rtems.org/) # RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2018 Chris Johns (chrisj@rtems.org) # Copyright 2010-2013 Chris Johns (chrisj@rtems.org)
# All rights reserved. # All rights reserved.
# #
# This file is part of the RTEMS Tools package in 'rtems-tools'. # This file is part of the RTEMS Tools package in 'rtems-tools'.
@ -17,11 +17,14 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
set -e from __future__ import print_function
base=$(dirname $0)
PYTHON_CMD=${base}/sb/cmd-defaults.py import sys
if test -f ${base}/sb/python-wrapper.sh; then
. ${base}/sb/python-wrapper.sh try:
fi import sb.options
echo "error: python wrapper not found" sb.options.run(sys.argv)
except ImportError:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /usr/bin/env python
# #
# RTEMS Tools Project (http://www.rtems.org/) # RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2019 Chris Johns (chrisj@rtems.org) # Copyright 2010-2019 Chris Johns (chrisj@rtems.org)
# All rights reserved. # All rights reserved.
# #
# This file is part of the RTEMS Tools package in 'rtems-tools'. # This file is part of the RTEMS Tools package in 'rtems-tools'.
@ -17,11 +17,14 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
set -e from __future__ import print_function
base=$(dirname $0)
PYTHON_CMD=${base}/sb/cmd-get-sources.py
if test -f ${base}/sb/python-wrapper.sh; then try:
. ${base}/sb/python-wrapper.sh import sb.getsources
fi sb.getsources.run()
echo "error: python wrapper not found" except ImportError:
import sys
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /usr/bin/env python
# #
# RTEMS Tools Project (http://www.rtems.org/) # RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2018 Chris Johns (chrisj@rtems.org) # Copyright 2010-2013 Chris Johns (chrisj@rtems.org)
# All rights reserved. # All rights reserved.
# #
# This file is part of the RTEMS Tools package in 'rtems-tools'. # This file is part of the RTEMS Tools package in 'rtems-tools'.
@ -17,11 +17,14 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
set -e from __future__ import print_function
base=$(dirname $0)
PYTHON_CMD=${base}/sb/cmd-reports.py import sys
if test -f ${base}/sb/python-wrapper.sh; then
. ${base}/sb/python-wrapper.sh try:
fi import sb.reports
echo "error: python wrapper not found" sb.reports.run(sys.argv)
except ImportError:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /usr/bin/env python
# #
# RTEMS Tools Project (http://www.rtems.org/) # RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2018 Chris Johns (chrisj@rtems.org) # Copyright 2010-2012 Chris Johns (chrisj@rtems.org)
# All rights reserved. # All rights reserved.
# #
# This file is part of the RTEMS Tools package in 'rtems-tools'. # This file is part of the RTEMS Tools package in 'rtems-tools'.
@ -17,11 +17,14 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
set -e from __future__ import print_function
base=$(dirname $0)
PYTHON_CMD=${base}/sb/cmd-rtems-config.py import sys
if test -f ${base}/sb/python-wrapper.sh; then
. ${base}/sb/python-wrapper.sh try:
fi import sb.rtemsconfig
echo "error: python wrapper not found" sb.rtemsconfig.run(sys.argv)
except ImportError:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /usr/bin/env python
# #
# RTEMS Tools Project (http://www.rtems.org/) # RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2018 Chris Johns (chrisj@rtems.org) # Copyright 2010-2012 Chris Johns (chrisj@rtems.org)
# All rights reserved. # All rights reserved.
# #
# This file is part of the RTEMS Tools package in 'rtems-tools'. # This file is part of the RTEMS Tools package in 'rtems-tools'.
@ -17,11 +17,13 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
set -e from __future__ import print_function
base=$(dirname $0)
PYTHON_CMD=${base}/sb/cmd-set-builder.py try:
if test -f ${base}/sb/python-wrapper.sh; then import sb.setbuilder
. ${base}/sb/python-wrapper.sh sb.setbuilder.run()
fi except ImportError:
echo "error: python wrapper not found" import sys
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /usr/bin/env python
# #
# RTEMS Tools Project (http://www.rtems.org/) # RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2019 Chris Johns (chrisj@rtems.org) # Copyright 2010-2019 Chris Johns (chrisj@rtems.org)
# All rights reserved. # All rights reserved.
# #
# This file is part of the RTEMS Tools package in 'rtems-tools'. # This file is part of the RTEMS Tools package in 'rtems-tools'.
@ -17,11 +17,13 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
set -e from __future__ import print_function
base=$(dirname $0)
PYTHON_CMD=${base}/sb/cmd-track.py try:
if test -f ${base}/sb/python-wrapper.sh; then import sb.track
. ${base}/sb/python-wrapper.sh sb.track.run()
fi except ImportError:
echo "error: python wrapper not found" import sys
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -33,17 +33,17 @@ import stat
import sys import sys
try: try:
import check from . import check
import config from . import config
import download from . import download
import error from . import error
import ereport from . import ereport
import execute from . import execute
import log from . import log
import options from . import options
import path from . import path
import sources from . import sources
import version from . import version
except KeyboardInterrupt: except KeyboardInterrupt:
print('abort: user terminated') print('abort: user terminated')
sys.exit(1) sys.exit(1)

View File

@ -23,16 +23,16 @@
from __future__ import print_function from __future__ import print_function
import os
import error
import execute
import fnmatch import fnmatch
import log import os
import options
import path
import re import re
import version
from . import error
from . import execute
from . import log
from . import options
from . import path
from . import version
def _check_none(_opts, macro, value, constraint): def _check_none(_opts, macro, value, constraint):
return True return True

View File

@ -1,29 +0,0 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2010-2012 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
from __future__ import print_function
import sys, os
try:
import check
check.run()
except ImportError:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,29 +0,0 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2010-2013 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
from __future__ import print_function
import sys, os
try:
import options
options.run(sys.argv)
except ImportError:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,29 +0,0 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2010-2019 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
from __future__ import print_function
import sys, os
try:
import getsources
getsources.run()
except ImportError:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,220 +0,0 @@
#
# RTEMS Tools Project (http://www.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'.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
from __future__ import print_function
import os
import sys
base = os.path.dirname(sys.argv[1])
try:
import argparse
except:
sys.path.insert(0, base + '/sb/imports')
try:
import argparse
except:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)
import pkgconfig
#
# Make trace true to get a file of what happens and what is being asked.
#
trace = False
trace_stdout = False
logfile = 'pkg-config.log'
out = None
srcfd = None
#
# Write all the package source parsed to a single file.
#
trace_src = False
if trace_src:
srcfd = open('pkg-src.txt', 'w')
def src(text):
if srcfd:
srcfd.writelines(text)
def log(s, lf = True):
global trace, logfile, out
if trace:
if out is None:
if logfile:
out = open(logfile, 'a')
else:
out = sys.stdout
if lf:
if out != sys.stdout and trace_stdout:
print(s)
print(s, file = out)
else:
if out != sys.stdout and trace_stdout:
print(s, end = '')
sys.stdout.flush()
print(s, end = '', file = out)
def run(argv):
class version_action(argparse.Action):
def __call__(self, parser, namespace, values, option_string = None):
parts = values[0].strip().split('.')
for p in parts:
if not p.isdigit():
raise error('invalid version value: %s' % (values))
setattr(namespace, self.dest, '.'.join(parts))
ec = 0
opts = argparse.ArgumentParser(prog = 'pkg-config', description = 'Package Configuration.')
opts.add_argument('libraries', metavar='lib', type = str, help = 'a library', nargs = '*')
opts.add_argument('--modversion', dest = 'modversion', action = 'store', default = None,
help = 'Requests that the version information of the libraries.')
opts.add_argument('--print-errors', dest = 'print_errors', action = 'store_true',
default = False,
help = 'Print any errors.')
opts.add_argument('--short-errors', dest = 'short_errors', action = 'store_true',
default = False,
help = 'Make error messages short.')
opts.add_argument('--silence-errors', dest = 'silence_errors', action = 'store_true',
default = False,
help = 'Do not print any errors.')
opts.add_argument('--errors-to-stdout', dest = 'errors_to_stdout', action = 'store_true',
default = False,
help = 'Print errors to stdout rather than stderr.')
opts.add_argument('--cflags', dest = 'cflags', action = 'store_true',
default = False,
help = 'This prints pre-processor and compile flags required to' \
' compile the package(s)')
opts.add_argument('--libs', dest = 'libs', action = 'store_true',
default = False,
help = 'This option is identical to "--cflags", only it prints the' \
' link flags.')
opts.add_argument('--libs-only-L', dest = 'libs_only_L', action = 'store_true',
default = False,
help = 'This prints the -L/-R part of "--libs".')
opts.add_argument('--libs-only-l', dest = 'libs_only_l', action = 'store_true',
default = False,
help = 'This prints the -l part of "--libs".')
opts.add_argument('--variable', dest = 'variable', action = 'store',
nargs = 1, default = None,
help = 'This returns the value of a variable.')
opts.add_argument('--define-variable', dest = 'define_variable', action = 'store',
nargs = 1, default = None,
help = 'This sets a global value for a variable')
opts.add_argument('--uninstalled', dest = 'uninstalled', action = 'store_true',
default = False,
help = 'Ignored')
opts.add_argument('--atleast-pkgconfig-version', dest = 'atleast_pkgconfig_version',
action = 'store', nargs = 1, default = None,
help = 'Check the version of package config. Always ok.')
opts.add_argument('--exists', dest = 'exists', action = 'store_true',
default = False,
help = 'Test if a library is present')
opts.add_argument('--atleast-version', dest = 'atleast_version',
action = version_action, nargs = 1, default = None,
help = 'The package is at least this version.')
opts.add_argument('--exact-version', dest = 'exact_version', action = version_action,
nargs = 1, default = None,
help = 'The package is the exact version.')
opts.add_argument('--max-version', dest = 'max_version', action = version_action,
nargs = 1, default = None,
help = 'The package is no later than this version.')
opts.add_argument('--msvc-syntax', dest = 'msvc_syntax', action = 'store_true',
default = False,
help = 'Ignored')
opts.add_argument('--dont-define-prefix', dest = 'dont_define_prefix', action = 'store_true',
default = False,
help = 'Ignored')
opts.add_argument('--prefix-variable', dest = 'prefix', action = 'store',
nargs = 1, default = pkgconfig.default_prefix(),
help = 'Define the prefix.')
opts.add_argument('--static', dest = 'static', action = 'store_true',
default = False,
help = 'Output libraries suitable for static linking')
opts.add_argument('--dump', dest = 'dump', action = 'store_true',
default = False,
help = 'Dump the package if one is found.')
args = opts.parse_args(argv[1:])
if (args.exists and (args.exact_version or args.max_version)) or \
(args.exact_version and (args.exists or args.max_version)) or \
(args.max_version and (args.exists or args.exact_version)):
raise error('only one of --exists, --exact-version, or --max-version')
if args.dont_define_prefix:
args.prefix = pkgconfig.default_prefix(False)
exists = False
ec = 1
if args.atleast_pkgconfig_version:
ec = 0
else:
ec, pkg, flags = pkgconfig.check_package(args.libraries, args, log, src)
if ec == 0:
if args.cflags:
if len(flags['cflags']):
print(flags['cflags'])
log('cflags: %s' % (flags['cflags']))
else:
log('cflags: empty')
if args.libs:
if len(flags['libs']):
print(flags['libs'])
log('libs: %s' % (flags['libs']))
else:
log('libs: empty')
#pkgconfig.package.dump_loaded()
return ec
try:
log('-' * 40)
log('pkg-config', lf = False)
for a in sys.argv[2:]:
log(' "%s"' % (a), lf = False)
log('')
ec = run(sys.argv[1:])
log('ec = %d' % (ec))
except ImportError:
print("incorrect package config installation", file = sys.stderr)
sys.exit(1)
except pkgconfig.error as e:
print('error: %s' % (e), file = sys.stderr)
sys.exit(1)
sys.exit(ec)

View File

@ -1,29 +0,0 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2010-2013 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
from __future__ import print_function
import sys, os
try:
import reports
reports.run(sys.argv)
except ImportError:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,29 +0,0 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2010-2012 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
from __future__ import print_function
import sys, os
try:
import rtemsconfig
rtemsconfig.run(sys.argv)
except ImportError:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,29 +0,0 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2010-2012 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
from __future__ import print_function
import sys, os
try:
import setbuilder
setbuilder.run()
except ImportError:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -1,29 +0,0 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2010-2019 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
from __future__ import print_function
import sys, os
try:
import track
track.run()
except ImportError:
print("Incorrect Source Builder installation", file = sys.stderr)
sys.exit(1)

View File

@ -34,13 +34,13 @@ import re
import sys import sys
try: try:
import error from . import error
import execute from . import execute
import log from . import log
import options from . import options
import path from . import path
import pkgconfig from . import pkgconfig
import sources from . import sources
except KeyboardInterrupt: except KeyboardInterrupt:
print('user terminated', file = sys.stderr) print('user terminated', file = sys.stderr)
sys.exit(1) sys.exit(1)
@ -500,6 +500,7 @@ class file:
except pkgconfig.error as pe: except pkgconfig.error as pe:
self._error('pkgconfig: check: %s' % (pe)) self._error('pkgconfig: check: %s' % (pe))
except: except:
raise
raise error.internal('pkgconfig failure') raise error.internal('pkgconfig failure')
if ok: if ok:
return '1' return '1'
@ -524,6 +525,7 @@ class file:
except pkgconfig.error as pe: except pkgconfig.error as pe:
self._error('pkgconfig: %s: %s' % (flags, pe)) self._error('pkgconfig: %s: %s' % (flags, pe))
except: except:
raise
raise error.internal('pkgconfig failure') raise error.internal('pkgconfig failure')
if pkg_flags is None: if pkg_flags is None:
pkg_flags = '' pkg_flags = ''

View File

@ -25,11 +25,10 @@ from __future__ import print_function
import os import os
import error from . import error
import execute from . import execute
import log from . import log
import options from . import path
import path
class repo: class repo:
"""An object to manage a cvs repo.""" """An object to manage a cvs repo."""
@ -147,6 +146,7 @@ class repo:
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from . import options
opts = options.load(sys.argv, defaults = 'defaults.mc') opts = options.load(sys.argv, defaults = 'defaults.mc')
ldir = 'cvs-test-rm-me' ldir = 'cvs-test-rm-me'
c = repo(ldir, opts) c = repo(ldir, opts)

View File

@ -24,7 +24,7 @@
import os import os
import execute from . import execute
def load(): def load():
uname = os.uname() uname = os.uname()

View File

@ -37,13 +37,13 @@ except ImportError:
import urllib2 as urllib_request import urllib2 as urllib_request
import urlparse as urllib_parse import urlparse as urllib_parse
import cvs from . import cvs
import error from . import error
import git from . import git
import log from . import log
import path from . import path
import sources from . import sources
import version from . import version
def _do_download(opts): def _do_download(opts):
download = True download = True

View File

@ -25,8 +25,8 @@ from __future__ import print_function
import os import os
import error from . import error
import log from . import log
def generate(name, opts, header = None, footer = None): def generate(name, opts, header = None, footer = None):
label, result = opts.with_arg('error-report') label, result = opts.with_arg('error-report')

View File

@ -36,8 +36,8 @@ import threading
import time import time
import traceback import traceback
import error from . import error
import log from . import log
# Trace exceptions # Trace exceptions
trace_threads = False trace_threads = False

View File

@ -27,9 +27,9 @@
import pprint import pprint
import os import os
import check from . import check
import error from . import error
import execute from . import execute
def load(): def load():
uname = os.uname() uname = os.uname()

View File

@ -31,11 +31,11 @@ import os
import sys import sys
try: try:
import build from . import build
import error from . import error
import log from . import log
import simhost from . import simhost
import version from . import version
except KeyboardInterrupt: except KeyboardInterrupt:
print('abort: user terminated', file = sys.stderr) print('abort: user terminated', file = sys.stderr)
sys.exit(1) sys.exit(1)
@ -76,7 +76,7 @@ def run(args = sys.argv):
action = 'store_true') action = 'store_true')
argsp.add_argument('bsets', nargs='*', help = 'Build sets.') argsp.add_argument('bsets', nargs='*', help = 'Build sets.')
argopts = argsp.parse_args(args[2:]) argopts = argsp.parse_args(args[1:])
simhost.load_log(argopts.log) simhost.load_log(argopts.log)
log.notice('RTEMS Source Builder - Get Sources, %s' % (version.string())) log.notice('RTEMS Source Builder - Get Sources, %s' % (version.string()))

View File

@ -25,11 +25,10 @@ from __future__ import print_function
import os import os
import error from . import error
import execute from . import execute
import log from . import log
import options from . import path
import path
class repo: class repo:
"""An object to manage a git repo.""" """An object to manage a git repo."""
@ -230,7 +229,9 @@ class repo:
if __name__ == '__main__': if __name__ == '__main__':
import os.path import os.path
import sys import sys
defaults = path.join(path.dirname(path.dirname(path.shell(sys.argv[0]))), 'defaults.mc') from . import options
defaults = path.join(path.dirname(path.dirname(path.shell(sys.argv[0]))),
'defaults.mc')
opts = options.load(sys.argv, defaults = defaults) opts = options.load(sys.argv, defaults = defaults)
g = repo('.', opts) g = repo('.', opts)
print('g.git_version():', g.git_version()) print('g.git_version():', g.git_version())

View File

@ -26,8 +26,8 @@ import multiprocessing
import pprint import pprint
import os import os
import platform from . import platform
import path from . import path
def load(): def load():
uname = os.uname() uname = os.uname()

View File

@ -26,7 +26,7 @@ from __future__ import print_function
import os import os
import sys import sys
import error from . import error
# #
# A global log. # A global log.

View File

@ -27,8 +27,8 @@ import re
import os import os
import string import string
import error from . import error
import path from . import path
# #
# Macro tables # Macro tables

View File

@ -27,9 +27,9 @@ import os
import smtplib import smtplib
import socket import socket
import error from . import error
import options from . import options
import path from . import path
def append_options(opts): def append_options(opts):
opts['--mail'] = 'Send email report or results.' opts['--mail'] = 'Send email report or results.'

View File

@ -27,8 +27,8 @@
import pprint import pprint
import os import os
import check from . import check
import execute from . import execute
def load(): def load():
uname = os.uname() uname = os.uname()

View File

@ -29,18 +29,17 @@ import pprint
import re import re
import os import os
import string import string
import download
import error
import execute
import git
import log
import macros
import path
import sources
import sys import sys
import version from . import download
from . import error
from . import execute
from . import git
from . import log
from . import macros
from . import path
from . import sources
from . import version
basepath = 'sb' basepath = 'sb'
@ -624,11 +623,6 @@ def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc', logfile = Tru
global host_windows global host_windows
global host_posix global host_posix
#
# Adjust the args to remove the wrapper.
#
args = args[1:]
# #
# The path to this command. # The path to this command.
# #
@ -649,7 +643,7 @@ def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc', logfile = Tru
overrides = None overrides = None
if os.name == 'nt': if os.name == 'nt':
try: try:
import windows from . import windows
overrides = windows.load() overrides = windows.load()
host_windows = True host_windows = True
host_posix = False host_posix = False
@ -659,26 +653,26 @@ def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc', logfile = Tru
uname = os.uname() uname = os.uname()
try: try:
if uname[0].startswith('MINGW64_NT'): if uname[0].startswith('MINGW64_NT'):
import windows from . import windows
overrides = windows.load() overrides = windows.load()
host_windows = True host_windows = True
elif uname[0].startswith('CYGWIN_NT'): elif uname[0].startswith('CYGWIN_NT'):
import windows from . import windows
overrides = windows.load() overrides = windows.load()
elif uname[0] == 'Darwin': elif uname[0] == 'Darwin':
import darwin from . import darwin
overrides = darwin.load() overrides = darwin.load()
elif uname[0] == 'FreeBSD': elif uname[0] == 'FreeBSD':
import freebsd from . import freebsd
overrides = freebsd.load() overrides = freebsd.load()
elif uname[0] == 'NetBSD': elif uname[0] == 'NetBSD':
import netbsd from . import netbsd
overrides = netbsd.load() overrides = netbsd.load()
elif uname[0] == 'Linux': elif uname[0] == 'Linux':
import linux from . import linux
overrides = linux.load() overrides = linux.load()
elif uname[0] == 'SunOS': elif uname[0] == 'SunOS':
import solaris from . import solaris
overrides = solaris.load() overrides = solaris.load()
except error.general as ge: except error.general as ge:
raise error.general('failed to load %s host support: %s' % (uname[0], ge)) raise error.general('failed to load %s host support: %s' % (uname[0], ge))
@ -721,7 +715,9 @@ def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc', logfile = Tru
def run(args): def run(args):
try: try:
_opts = load(args = args, defaults = 'defaults.mc') dpath = path.dirname(args[0])
_opts = load(args = args,
defaults = path.join(dpath, 'defaults.mc'))
log.notice('RTEMS Source Builder - Defaults, %s' % (version.string())) log.notice('RTEMS Source Builder - Defaults, %s' % (version.string()))
_opts.log_info() _opts.log_info()
log.notice('Options:') log.notice('Options:')

View File

@ -25,14 +25,14 @@
from __future__ import print_function from __future__ import print_function
import log
import os import os
import shutil import shutil
import stat import stat
import string import string
import sys import sys
import error from . import error
from . import log
windows_posix = sys.platform == 'msys' windows_posix = sys.platform == 'msys'
windows = os.name == 'nt' windows = os.name == 'nt'

View File

@ -43,7 +43,7 @@ import re
import shlex import shlex
import sys import sys
import path from . import path
def default_prefix(common = True): def default_prefix(common = True):
paths = [] paths = []
@ -214,7 +214,12 @@ class package(object):
prefix = default_prefix() prefix = default_prefix()
if prefix: if prefix:
self._log('prefix: %s' % (prefix)) self._log('prefix: %s' % (prefix))
if type(prefix) is str or type(prefix) is unicode: try:
if type(prefix) is unicode:
prefix = prefix.decode("utf-8", "ignore")
except:
pass
if type(prefix) is str:
prefix = str(prefix) prefix = str(prefix)
self.prefix = [] self.prefix = []
for p in prefix.split(os.pathsep): for p in prefix.split(os.pathsep):

View File

@ -1,39 +0,0 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2018 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
set -e
if test ! -f $PYTHON_CMD; then
echo "error: python command not found: $PYTHON_CMD"
exit 5
fi
for py in python2 python2.7 python3 python
do
set +e
py_cmd=$(command -v $py)
set -e
if test -n "$RTEMS_PYTHON_OVERRIDE"; then
if test "$RTEMS_PYTHON_OVERRIDE" != "$py"; then
py_cmd=""
fi
fi
if test -n "$py_cmd"; then
exec $py_cmd $PYTHON_CMD $0 $*
fi
done
echo "error: no valid python found"
exit 5

View File

@ -34,17 +34,17 @@ import pprint
pp = pprint.PrettyPrinter(indent = 2) pp = pprint.PrettyPrinter(indent = 2)
try: try:
import build from . import build
import check from . import check
import config from . import config
import error from . import error
import git from . import git
import log from . import log
import options from . import options
import path from . import path
import setbuilder from . import setbuilder
import sources from . import sources
import version from . import version
except KeyboardInterrupt: except KeyboardInterrupt:
print('user terminated', file = sys.stderr) print('user terminated', file = sys.stderr)
sys.exit(1) sys.exit(1)

View File

@ -28,11 +28,11 @@ import sys
import threading import threading
import time import time
import error from . import error
import log from . import log
import options from . import options
import path from . import path
import version from . import version
def _collect(path_, file): def _collect(path_, file):
confs = [] confs = []

View File

@ -33,17 +33,17 @@ import sys
import textwrap import textwrap
try: try:
import build from . import build
import check from . import check
import error from . import error
import log from . import log
import mailer from . import mailer
import options from . import options
import path from . import path
import reports from . import reports
import shell from . import shell
import sources from . import sources
import version from . import version
except KeyboardInterrupt: except KeyboardInterrupt:
print('abort: user terminated', file = sys.stderr) print('abort: user terminated', file = sys.stderr)
sys.exit(1) sys.exit(1)

View File

@ -25,10 +25,10 @@
from __future__ import print_function from __future__ import print_function
try: try:
import error from . import error
import execute from . import execute
import log from . import log
import options from . import options
except KeyboardInterrupt: except KeyboardInterrupt:
print('abort: user terminated', file = sys.stderr) print('abort: user terminated', file = sys.stderr)
sys.exit(1) sys.exit(1)

View File

@ -29,15 +29,15 @@ import datetime
import os import os
try: try:
import build from . import build
import check from . import check
import error from . import error
import git from . import git
import log from . import log
import macros from . import macros
import path from . import path
import sources from . import sources
import version from . import version
except KeyboardInterrupt: except KeyboardInterrupt:
print('abort: user terminated', file = sys.stderr) print('abort: user terminated', file = sys.stderr)
sys.exit(1) sys.exit(1)
@ -160,7 +160,7 @@ def find_bset_config(bset_config, macros):
# #
class options(object): class options(object):
def __init__(self, argv, argopts, defaults, extras): def __init__(self, argv, argopts, defaults, extras):
command_path = path.dirname(path.abspath(argv[1])) command_path = path.dirname(path.abspath(argv[0]))
if len(command_path) == 0: if len(command_path) == 0:
command_path = '.' command_path = '.'
self.command_path = command_path self.command_path = command_path
@ -190,7 +190,7 @@ class options(object):
overrides = None overrides = None
if os.name == 'nt': if os.name == 'nt':
try: try:
import windows from . import windows
overrides = windows.load() overrides = windows.load()
host_windows = True host_windows = True
host_posix = False host_posix = False
@ -200,26 +200,26 @@ class options(object):
uname = os.uname() uname = os.uname()
try: try:
if uname[0].startswith('MINGW64_NT'): if uname[0].startswith('MINGW64_NT'):
import windows from . import windows
overrides = windows.load() overrides = windows.load()
host_windows = True host_windows = True
elif uname[0].startswith('CYGWIN_NT'): elif uname[0].startswith('CYGWIN_NT'):
import windows from . import windows
overrides = windows.load() overrides = windows.load()
elif uname[0] == 'Darwin': elif uname[0] == 'Darwin':
import darwin from . import darwin
overrides = darwin.load() overrides = darwin.load()
elif uname[0] == 'FreeBSD': elif uname[0] == 'FreeBSD':
import freebsd from . import freebsd
overrides = freebsd.load() overrides = freebsd.load()
elif uname[0] == 'NetBSD': elif uname[0] == 'NetBSD':
import netbsd from . import netbsd
overrides = netbsd.load() overrides = netbsd.load()
elif uname[0] == 'Linux': elif uname[0] == 'Linux':
import linux from . import linux
overrides = linux.load() overrides = linux.load()
elif uname[0] == 'SunOS': elif uname[0] == 'SunOS':
import solaris from . import solaris
overrides = solaris.load() overrides = solaris.load()
except error.general as ge: except error.general as ge:
raise error.general('failed to load %s host support: %s' % (uname[0], ge)) raise error.general('failed to load %s host support: %s' % (uname[0], ge))

View File

@ -25,9 +25,9 @@
import pprint import pprint
import os import os
import check from . import check
import error from . import error
import execute from . import execute
def load(): def load():
uname = os.uname() uname = os.uname()

View File

@ -21,7 +21,7 @@
# Manage sources and patches # Manage sources and patches
# #
import log from . import log
def _args(args): def _args(args):
return [i for s in [ii.split() for ii in args] for i in s] return [i for s in [ii.split() for ii in args] for i in s]

View File

@ -31,12 +31,12 @@ import os
import sys import sys
try: try:
import build from . import build
import error from . import error
import git from . import git
import log from . import log
import simhost from . import simhost
import version from . import version
except KeyboardInterrupt: except KeyboardInterrupt:
print('abort: user terminated', file = sys.stderr) print('abort: user terminated', file = sys.stderr)
sys.exit(1) sys.exit(1)
@ -138,7 +138,7 @@ def run(args = sys.argv):
action = 'store_true') action = 'store_true')
argsp.add_argument('bsets', nargs='*', help = 'Build sets.') argsp.add_argument('bsets', nargs='*', help = 'Build sets.')
argopts = argsp.parse_args(args[2:]) argopts = argsp.parse_args(args[1:])
simhost.load_log(argopts.log) simhost.load_log(argopts.log)
log.notice('RTEMS Source Builder - Track Dependencies, %s' % (version.string())) log.notice('RTEMS Source Builder - Track Dependencies, %s' % (version.string()))

View File

@ -76,9 +76,9 @@ from __future__ import print_function
import os import os
import sys import sys
import error from . import error
import git from . import git
import path from . import path
# #
# Default to an internal string. # Default to an internal string.

View File

@ -24,9 +24,9 @@
import os import os
import sys import sys
import error from . import error
import execute from . import execute
import path from . import path
def load(): def load():
# Default to the native Windows Python. # Default to the native Windows Python.