Changeset 334c22c in rtems-source-builder


Ignore:
Timestamp:
Mar 8, 2016, 11:23:01 AM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.9, master
Children:
29f23e0
Parents:
9bae339
git-author:
Chris Johns <chrisj@…> (03/08/16 11:23:01)
git-committer:
Chris Johns <chrisj@…> (03/08/16 11:27:10)
Message:

sb: Add support to GDB to select a specific Python.

Detect a suitable Python version on Windows.

Update #2619.

Location:
source-builder
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source-builder/config/gdb-7-1.cfg

    r9bae339 r334c22c  
    6161
    6262#
     63# The --with-python option is either the default which is auto or the path to
     64# the specific python to be used.
     65#
     66%if %{defined with_python_path}
     67  %define with_python_option --with-python=%{with_python_path}
     68%else
     69  %define with_python_option --with-python
     70%endif
     71
     72#
    6373#
    6474# Prepare the source code.
     
    105115    --without-zlib \
    106116    --with-expat \
    107     %{!?without_python:--with-python} \
     117    %{!?without_python:%{with_python_option}} \
    108118    --prefix=%{_prefix} --bindir=%{_bindir} \
    109119    --exec-prefix=%{_exec_prefix} \
  • source-builder/sb/windows.py

    r9bae339 r334c22c  
    2525import pprint
    2626import os
     27import sys
    2728
    2829import execute
     
    126127        '___setup_shell':    ('exe',     'required', '%{__sh}')
    127128        }
     129
     130    #
     131    # Locate a suitable python to use with GDB. Python Windows is more
     132    # complicated than most hosts. There are 7 possible pythons on Windows and
     133    # we can use only 4 which are split on machine size. The types are:
     134    #
     135    #  1. Python27 - python.org, cannot use cause built with MSVC.
     136    #  2. Python35 - python.org, cannot use cause built with MSVC.
     137    #  3. MSYS/Python - MSYS2, cannot use cause it is a MSYS executable.
     138    #  4. W64/Python2 - Ok if machsize is 64
     139    #  5. W64/Python3 - gdb-7.9 needs python2.
     140    #  6. W64/Python2 - Ok if machsize is 32
     141    #  7. W64/Python3 - gdb-7.9 needs python2.
     142    #
     143    if sys.platform == 'win32' and 'MSC' in sys.version:
     144        raise error.general('python.org Pythons are built with MSC and cannot be linked with GDB')
     145
     146    #
     147    # Search the MSYS2 install tree for a suitable python.
     148    #
     149    if sys.platform == 'msys':
     150        e = execute.capture_execution()
     151        exit_code, proc, output = e.shell("sh -c mount")
     152        if exit_code != 0:
     153            raise error.general('cannot get MSYS mount points')
     154        install_point = None
     155        for l in output.split('\n'):
     156            if ' on / ' in l:
     157                install_point = l.split()[0]
     158                break
     159        if install_point is None:
     160            raise error.general('cannot locate MSYS root mount point')
     161        if install_point[1] != ':':
     162            raise error.general('invalid MSYS root mount point: %s' % install_point)
     163        install_point = '/%s%s' % (install_point[0], install_point[2:])
     164        bin = '/mingw%s/bin' % (machsize)
     165        bin_list = os.listdir(bin)
     166        exe = None
     167        for python in ['python2.exe']:
     168            for f in bin_list:
     169                if f == python:
     170                    exe = install_point + os.path.join(bin, f)
     171                    break;
     172            if exe is not None:
     173                break
     174        if exe is None:
     175            raise error.general('no valid python found; you need a mingw%s python2 installed' % (machsize))
     176        defines['with_python_path'] = exe
     177
     178
    128179    return defines
    129180
Note: See TracChangeset for help on using the changeset viewer.