[Scons-users] Node.FS get_path not working correctly?

Daniel Moody dmoody256 at gmail.com
Mon May 28 19:23:51 EDT 2018


I am not sure what specifically you are referring to.

The jar binary has the -C option which means the next argument is treated
relative to the -C value passed. SCons jar.py tool tries to give jar what
it wants by using get_path to get a relative path from the directory that
will passed to jar to be relative to. The issue is that in some cases,
get_path does not return a relative path.

On Mon, May 28, 2018 at 7:17 PM, Bill Deegan <bill at baddogconsulting.com>
wrote:

> Is that behavior still true about jar ?
>
> On Mon, May 28, 2018 at 4:15 PM, Daniel Moody <dmoody256 at gmail.com> wrote:
>
>> The test makes itself not fail by writing t.class in two different
>> places, which doesn't make sense and is solely to make the test not fail
>> (as described in the comment).
>>
>> On Mon, May 28, 2018 at 7:11 PM, Bill Deegan <bill at baddogconsulting.com>
>> wrote:
>>
>>> Is the test failing?
>>>
>>> On Mon, May 28, 2018 at 4:04 PM, Daniel Moody <dmoody256 at gmail.com>
>>> wrote:
>>>
>>>> Well specifically I am looking at this the test/Java/JARCHDIR.py test,
>>>> where there is a comment that seems to be running into this issue:
>>>> https://github.com/SCons/scons/blob/master/test/Java/
>>>> JARCHDIR.py#L86-L99
>>>>
>>>> Looking at the jar.py tool: https://github.com/SCons
>>>> /scons/blob/master/src/engine/SCons/Tool/jar.py#L64-L68
>>>>
>>>> jar.py assumes that it will get a relative path from get_path(dir), but
>>>> it doesn't always as is the case in the JARCHDIR test.
>>>>
>>>>
>>>>
>>>> On Mon, May 28, 2018 at 6:56 PM, Bill Deegan <bill at baddogconsulting.com
>>>> > wrote:
>>>>
>>>>> I mean relative..
>>>>>
>>>>> On Mon, May 28, 2018 at 3:56 PM, Bill Deegan <
>>>>> bill at baddogconsulting.com> wrote:
>>>>>
>>>>>> Do you need an absolute path for your use case?
>>>>>>
>>>>>> On Mon, May 28, 2018 at 3:47 PM, Daniel Moody <dmoody256 at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Ok but that's not the case in my example. Seems like it should have
>>>>>>> a special case if it's on another drive, which then it does return the
>>>>>>> abspath, because there is no relative path.
>>>>>>>
>>>>>>> On Mon, May 28, 2018, 5:36 PM Bill Deegan <bill at baddogconsulting.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> That's the expected behavior. (Remember you could have a path on
>>>>>>>> windows which is on a different drive for which there is no relative path..)
>>>>>>>>
>>>>>>>> On Sun, May 27, 2018 at 9:18 PM, Daniel Moody <dmoody256 at gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> It seems if I use get path with a file this is outside of the base
>>>>>>>>> build dir or I try to get a path relative to a dir that is in the base
>>>>>>>>> build dir, get_path just returns the abspath?
>>>>>>>>>
>>>>>>>>> The function comment seems to suggest it would be relative:
>>>>>>>>>
>>>>>>>>> def get_path(self, dir=None):
>>>>>>>>>     """Return path relative to the current working directory of the
>>>>>>>>>     Node.FS.Base object that owns us."""
>>>>>>>>>
>>>>>>>>> Let SConstruct be:
>>>>>>>>>
>>>>>>>>> import os
>>>>>>>>>
>>>>>>>>> env = Environment()
>>>>>>>>> test_file1_node = env.File(os.path.abspath('../o
>>>>>>>>> uter/testFile1.txt'))
>>>>>>>>> test_file2_node = env.File(os.path.abspath('./in
>>>>>>>>> ner/testFile2.txt'))
>>>>>>>>> test_file3_node = env.File(os.path.abspath('./in
>>>>>>>>> ner2/testFile3.txt'))
>>>>>>>>> print(test_file1_node.get_path())
>>>>>>>>> print(test_file2_node.get_path())
>>>>>>>>> print(test_file3_node.get_path('./inner2'))
>>>>>>>>>
>>>>>>>>> I get this as output:
>>>>>>>>>
>>>>>>>>> scons: Reading SConscript files ...
>>>>>>>>> C:\Users\Daniel\workspace\test\outer\testFile1.txt
>>>>>>>>> inner\testFile2.txt
>>>>>>>>> C:\Users\Daniel\workspace\test\base\inner2\testFile3.txt
>>>>>>>>> scons: done reading SConscript files.
>>>>>>>>> scons: Building targets ...
>>>>>>>>> scons: `.' is up to date.
>>>>>>>>> scons: done building targets.
>>>>>>>>>
>>>>>>>>> Any ideas? I have a pull request to fix it if it is a bug.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Scons-users mailing list
>>>>>>>>> Scons-users at scons.org
>>>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>>>
>>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Scons-users mailing list
>>>>>>>> Scons-users at scons.org
>>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Scons-users mailing list
>>>>>>> Scons-users at scons.org
>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Scons-users mailing list
>>>>> Scons-users at scons.org
>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-users at scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180528/5ddd1a23/attachment.html>


More information about the Scons-users mailing list