diff options
author | Chris Johns <chrisj@rtems.org> | 2020-09-25 11:22:34 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2020-09-26 10:49:27 +1000 |
commit | 87262b429d633420402e735a770f6d6cfedecf9a (patch) | |
tree | 6c9ee3464198f2d307b127d41060657565d2d34b /misc | |
parent | linkers: Update due to API changes (diff) | |
download | rtems-tools-87262b429d633420402e735a770f6d6cfedecf9a.tar.bz2 |
Move all python commands to use env python
- If you host does not provide a python command consult the User
manual for ways you can run the python commands.
- Full package paths are being used to avoid namespace pollution and
crosstalk.
Diffstat (limited to 'misc')
-rw-r--r--[-rwxr-xr-x] | misc/__init__.py (renamed from misc/tools/cmd-boot-image.py) | 18 | ||||
-rwxr-xr-x | misc/rtems-boot-image | 31 | ||||
-rwxr-xr-x | misc/rtems-tftp-proxy | 31 | ||||
-rw-r--r--[-rwxr-xr-x] | misc/tools/__init__.py (renamed from misc/tools/cmd-tftpproxy.py) | 18 | ||||
-rw-r--r-- | misc/tools/boot.py | 2 | ||||
-rw-r--r-- | misc/tools/tftpproxy.py | 6 | ||||
-rw-r--r-- | misc/wscript | 8 |
7 files changed, 46 insertions, 68 deletions
diff --git a/misc/tools/cmd-boot-image.py b/misc/__init__.py index f17a91e..6ff279c 100755..100644 --- a/misc/tools/cmd-boot-image.py +++ b/misc/__init__.py @@ -1,6 +1,5 @@ -# # RTEMS Tools Project (http://www.rtems.org/) -# Copyright 2019 Chris Johns (chrisj@rtems.org) +# Copyright 2020 Chris Johns (chrisj@rtems.org) # All rights reserved. # # This file is part of the RTEMS Tools package in 'rtems-tools'. @@ -28,17 +27,4 @@ # POSSIBILITY OF SUCH DAMAGE. # -from __future__ import print_function - -import sys, os - -base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))) -rtems = os.path.dirname(base) -sys.path = [rtems] + sys.path - -try: - import boot - boot.run(sys.argv[1:], command_path = base) -except ImportError: - print("Incorrect RTEMS Tools installation", file = sys.stderr) - sys.exit(1) +all = [] diff --git a/misc/rtems-boot-image b/misc/rtems-boot-image index aa23b2e..7f7ac0d 100755 --- a/misc/rtems-boot-image +++ b/misc/rtems-boot-image @@ -1,7 +1,7 @@ -#! /bin/sh +#! /usr/bin/env python # # RTEMS Tools Project (http://www.rtems.org/) -# Copyright 2019 Chris Johns (chrisj@rtems.org) +# Copyright 2019, 2020 Chris Johns (chrisj@rtems.org) # All rights reserved. # # This file is part of the RTEMS Tools package in 'rtems-tools'. @@ -28,15 +28,18 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -set -e -base=$(dirname $(dirname $0)) -cmd=misc/tools/cmd-boot-image.py -PYTHON_WRAPPER=rtemstoolkit/python-wrapper.sh -if test -f ${base}/${PYTHON_WRAPPER}; then - PYTHON_CMD=${base}/${cmd} - . ${base}/${PYTHON_WRAPPER} -elif test -f ${base}/share/rtems/${PYTHON_WRAPPER}; then - PYTHON_CMD=${base}/share/rtems/${cmd} - . ${base}/share/rtems/${PYTHON_WRAPPER} -fi -echo "error: RTEMS Toolkit python wrapper not found, please report" + +from __future__ import print_function + +import sys, os + +base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))) +rtems = os.path.join(base, 'share', 'rtems') +sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:] + +try: + import misc.tools.boot + misc.tools.boot.run() +except ImportError: + print("Incorrect RTEMS Tools installation", file = sys.stderr) + sys.exit(1) diff --git a/misc/rtems-tftp-proxy b/misc/rtems-tftp-proxy index 213311d..2125662 100755 --- a/misc/rtems-tftp-proxy +++ b/misc/rtems-tftp-proxy @@ -1,7 +1,7 @@ -#! /bin/sh +#! /usr/bin/env python # # RTEMS Tools Project (http://www.rtems.org/) -# Copyright 2019 Chris Johns (chrisj@rtems.org) +# Copyright 2019, 2020 Chris Johns (chrisj@rtems.org) # All rights reserved. # # This file is part of the RTEMS Tools package in 'rtems-tools'. @@ -28,15 +28,18 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -set -e -base=$(dirname $(dirname $0)) -cmd=misc/tools/cmd-tftpproxy.py -PYTHON_WRAPPER=rtemstoolkit/python-wrapper.sh -if test -f ${base}/${PYTHON_WRAPPER}; then - PYTHON_CMD=${base}/${cmd} - . ${base}/${PYTHON_WRAPPER} -elif test -f ${base}/share/rtems/${PYTHON_WRAPPER}; then - PYTHON_CMD=${base}/share/rtems/${cmd} - . ${base}/share/rtems/${PYTHON_WRAPPER} -fi -echo "error: RTEMS Toolkit python wrapper not found, please report" + +from __future__ import print_function + +import sys, os + +base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))) +rtems = os.path.join(base, 'share', 'rtems') +sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:] + +try: + import misc.tools.tftpproxy + misc.tools.tftpproxy.run(sys.argv) +except ImportError: + print("Incorrect RTEMS Tools installation", file = sys.stderr) + sys.exit(1) diff --git a/misc/tools/cmd-tftpproxy.py b/misc/tools/__init__.py index 9f66a76..6ad687a 100755..100644 --- a/misc/tools/cmd-tftpproxy.py +++ b/misc/tools/__init__.py @@ -1,6 +1,5 @@ -# # RTEMS Tools Project (http://www.rtems.org/) -# Copyright 2019 Chris Johns (chrisj@rtems.org) +# Copyright 2013-2014 Chris Johns (chrisj@rtems.org) # All rights reserved. # # This file is part of the RTEMS Tools package in 'rtems-tools'. @@ -28,17 +27,4 @@ # POSSIBILITY OF SUCH DAMAGE. # -from __future__ import print_function - -import sys, os - -base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))) -rtems = os.path.dirname(base) -sys.path = [rtems] + sys.path - -try: - import tftpproxy - tftpproxy.run(sys.argv[1:], command_path = base) -except ImportError: - print("Incorrect RTEMS Tools installation", file = sys.stderr) - sys.exit(1) +all = ['boot'] diff --git a/misc/tools/boot.py b/misc/tools/boot.py index 265d1b3..6e8065a 100644 --- a/misc/tools/boot.py +++ b/misc/tools/boot.py @@ -1,6 +1,6 @@ # # RTEMS Tools Project (http://www.rtems.org/) -# Copyright 2019 Chris Johns (chrisj@rtems.org) +# Copyright 2019, 2020 Chris Johns (chrisj@rtems.org) # All rights reserved. # # This file is part of the RTEMS Tools package in 'rtems-tools'. diff --git a/misc/tools/tftpproxy.py b/misc/tools/tftpproxy.py index a815584..c0aebb0 100644 --- a/misc/tools/tftpproxy.py +++ b/misc/tools/tftpproxy.py @@ -1,5 +1,5 @@ # -# Copyright 2019 Chris Johns (chris@contemporary.software) +# Copyright 2019, 2020 Chris Johns (chris@contemporary.software) # All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any @@ -39,7 +39,7 @@ from rtemstoolkit import error from rtemstoolkit import log from rtemstoolkit import version -import getmac +import misc.tools.getmac def host_port_split(ip_port): ips = ip_port.split(':') @@ -226,7 +226,7 @@ class udp_handler(socketserver.BaseRequestHandler): client, host)) else: - mac = getmac.get_mac_address(ip = client_ip) + mac = misc.tools.getmac.get_mac_address(ip = client_ip) log.trace(' . request: host not found: %s (%s)' % (client, mac)) class udp_server(socketserver.ThreadingMixIn, socketserver.UDPServer): diff --git a/misc/wscript b/misc/wscript index b3faf7b..521eddf 100644 --- a/misc/wscript +++ b/misc/wscript @@ -1,6 +1,6 @@ # # RTEMS Tools Project (http://www.rtems.org/) -# Copyright 2014-2016 Chris Johns (chrisj@rtems.org) +# Copyright 2014, 2020 Chris Johns (chrisj@rtems.org) # Copyright 2018 embedded brains GmbH # All rights reserved. # @@ -74,9 +74,9 @@ def build(bld): # Install the boot image code. # bld(features = 'py', - source = ['tools/boot.py', - 'tools/cmd-boot-image.py', - 'tools/cmd-tftpproxy.py', + source = ['__init__.py', + 'tools/__init__.py', + 'tools/boot.py', 'tools/tftpproxy.py', 'tools/getmac/__init__.py', 'tools/getmac/getmac.py'], |