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

Daniel Moody dmoody256 at gmail.com
Mon May 28 19:04:18 EDT 2018


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('../outer/testFile1.txt'))
>>>>> test_file2_node = env.File(os.path.abspath('./inner/testFile2.txt'))
>>>>> test_file3_node = env.File(os.path.abspath('./inner2/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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180528/6d5b13d1/attachment.html>


More information about the Scons-users mailing list