Re: Support for Tools via a pip package / python module in sys path

Bill Deegan <bill-cJFiu+DHMVC5azolltMz9laTQe2KTcn/@public.gmane.org>
Newsgroups gmane.comp.programming.tools.scons.devel
Message-ID <CAEyG4CEjBEE=AiZ4zpspPCLFvLPt8OyjZ5bmpkG+NimWhTs4FQ__524.054587777023$1500577531$gmane$org@mail.gmail.com>
Wouldn't this work and not require any changes?
Or if it doesn't already work, wouldn't that be easier syntax? no
additional arguments, if it's got a '.' in it then you know it's part of a
package?

toollist = ['scons_toollib_example.TestBuilder1']
env = Environment(ENV = os.environ, tools = toollist)
env.TestBuilder1('testdest1.txt', 'testsrc1.txt')

How would you handle overloaded tool names in a module?
For example
scons_toollib_example has a gcc tool?

-Bill



On Thu, Jul 20, 2017 at 2:53 PM, RW via Scons-dev <[email protected]>
wrote:

> Hi,
> One of the features I'm interested in is the ability to have tools loaded
> externally via a package installed via pip.
> This way if you wanted to, you could ether install tools as a separate
> repo via pip, or move some of the existing tools into separate repo's
>
> I think I've come up with a way to do it which doesn't involve much code.
> But before I add in any tests or additions to the man page / user docs I
> wanted to check if this is an okay way to implement this
>
> I've put the commit here:
> https://bitbucket.org/grbd/scons/commits/af3ea9f2d4468479f7f7be73afd455
> b0f2067409
>
> With this method there's an additional option on the environment
> constructor called toolmods
>
> ```
> toollist = ['TestBuilder1']
> env = Environment(ENV = os.environ, tools = toollist, toolmods =
> ['scons_toollib_example'])
> env.TestBuilder1('testdest1.txt', 'testsrc1.txt')
> ```
>
> This option looks up the directory where the module is located in the sys
> path and adds it to the toolpath
> (e.g. C:\Python27\Lib\site-packages\scons_toollib_example)
>
> A side effect is that the module file gets imported at the same time
> (scons_toollib_example\__init__.py is run)
> I just do this to get the full path to the module when adding to the
> toolpath, although you could probably use that to modify scons or do
> something else when the tool is referenced if you wanted to.
>
> Is this implementation is a good idea? if so I'll look into adding some
> tests and user doc entries for it before doing a pull request
>
> Many Thanks
> Richard
>
> _______________________________________________
> Scons-dev mailing list
> [email protected]
> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>
>

_______________________________________________
Scons-dev mailing list
[email protected]
https://pairlist2.pair.net/mailman/listinfo/scons-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.