[Scons-dev] g++.py tool mapping to gxx.py

Jason Kenny dragon512 at live.com
Tue Dec 20 23:47:19 EST 2016


Hi William,

The issue I would like to address it make it easy to import other tools when it is needed to do so.

Importing the g++ tools in “hard” as we cannot just “import g++”  but have to do something more complex with importlib ( now that we are python 2.7 and better)

I am fine with making this patch. I was more trying to give a heads up to see if some had issue with changing g++ to gxx and making g++ a proxy.

For a more terse detail of the issue, a user was asking questions as the it went along needed an example on how Parts could be extended to find an arm version of gcc. So he could say “scons all –target-arm” and have it work. When I made the sample I hit the issue of importing g++ again. I felt that instead of me fixing this in Parts alone this is an easy and useful fix in core SCons. The sample I made (attached)

Requires one to write code like:

import importlib
gxx_module = importlib.import_module('parts.tools.g++')
globals().update(gxx_module.__dict__)


instead of something expected for gcc:

from parts.tools.gcc import *

The suggestion here is a change to lower the bar for user that might need to do more advance stuff by avoiding the need for them to use importlib module to import tools.

Hope that is quick and to the point ☺  Just want to check that no one has an concern with such a change?

Jason


From: Scons-dev [mailto:scons-dev-bounces at scons.org] On Behalf Of William Blevins
Sent: Tuesday, December 20, 2016 10:30 PM
To: SCons developer list <scons-dev at scons.org>
Subject: Re: [Scons-dev] g++.py tool mapping to gxx.py

Jason,
I don't see a technical reason that this cannot be done, but I am not sure I understand the problem that this aims to solve. Can you give me a TR;DR version? I skimmed the link above but I didn't see the immediate issue.
V/R,
William

On Tue, Dec 20, 2016 at 11:18 PM, Jason Kenny <dragon512 at live.com<mailto:dragon512 at live.com>> wrote:

Hi guys,

I was just helping someone with a sample to get parts to select gcc version of the arm cross compiler. I need to add the core code Part proper for arm. However, the point of the e-mail was me noticing again the issue with g++ tool in scons. The sample you can find in this issue here: https://bitbucket.org/sconsparts/parts/issues/12/how-do-i-use-include_parts-for-including has to import the g++ tool. I almost forgot the pain this has caused me in the past. The code to import file looks like:

import importlib
gxx_module = importlib.import_module('parts.tools.g++')

which unless you are are really good with python is not so obvious.

I was thinking it would be a good idea to:

•       make a gxx.py tool

•       move g++.py content into gxx.py

•       change g++.py to be a proxy to gxx.py. ie “from gxx import *” so nothing breaks

Does anyone have any concerns about such a pull request being made?


Thanks
Jason

_______________________________________________
Scons-dev mailing list
Scons-dev at scons.org<mailto:Scons-dev at scons.org>
https://pairlist2.pair.net/mailman/listinfo/scons-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20161221/13bf3f69/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-custom-gcc.7z
Type: application/octet-stream
Size: 1128 bytes
Desc: hello-custom-gcc.7z
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20161221/13bf3f69/attachment-0001.obj>


More information about the Scons-dev mailing list