<div dir="ltr"><div><div>Hi,</div><div><br></div><div>when I'm in location "/data/dir/GRASS Data/nc_smp/" and I try to install addon module using `g.extension` I get the following error:</div><div><br></div><div>
$ g.extension extension=g.proj.all svnurl=<a href="http://svn.osgeo.org/grass/grass-addons/grass7">http://svn.osgeo.org/grass/grass-addons/grass7</a></div><div>Fetching <g.proj.all> from GRASS-Addons SVN (be patient)...</div>
<div>Compiling...</div><div>/grass/src/include/Make/Rules.make:15: target `/data/dir/GRASS'</div><div>given more than once in the same rule.</div><div>...</div><div>/grass/src/include/Make/HtmlRules.make:14: warning: overriding</div>
<div>commands for target `/data/dir/GRASS'</div><div>/grass/src/include/Make/Rules.make:16: warning: ignoring old</div><div>commands for target `/data/dir/GRASS'</div><div>...</div><div>make: *** No rule to make target `%', needed by</div>
<div>`/data/dir/GRASS'. Stop.</div><div>ERROR: Compilation failed, sorry. Please check above error messages.</div></div><div><br></div><div>There is an ticket #1178 closed as wontfix for this but it is for GRASS 6 shell script and MS Windows, I'm on Linux with GRASS 7 Python script.</div>
<div><br></div><div>Since it is a problem with Makefile, I'm not sure if it is possible to fix. Does GNU make support paths with spaces?</div><div><br></div><div>Anyway, there might be better way to fix it. <a href="http://g.extension.py">g.extension.py</a> is using</div>
<div><br></div><div> TMPDIR = grass.tempdir()</div><div><br></div><div>to create the temporary directory in which it runs compilation</div><div>
<p style="margin:0px"><br></p><p style="margin:0px"> os.chdir(TMPDIR)</p></div>
<div><br></div><div>and uses this dir for make variables:</div><div>
<p style="margin:0px"><br></p><p style="margin:0px"> os.path.join(TMPDIR, name, 'bin')</p><p style="margin:0px"> ...</p><p style="margin:0px">
</p><p style="margin:0px"> make ... 'BIN=%s' % dirs['bin']</p><p style="margin:0px"><br></p><p style="margin:0px">grass.script.core.tempdir()<br></p><p style="margin:0px"><br></p><p style="margin:0px">uses</p>
<p style="margin:0px"><br></p><p style="margin:0px">
</p><p style="margin:0px">grass.script.core.tempfile(create=False)</p><p style="margin:0px"><br></p><p style="margin:0px">which uses g.tempfile with -d flag.</p><p style="margin:0px"><br></p><p style="margin:0px">Isn't this just the misunderstanding of the purpose of `g.tempfile` which already occurred several times? Wouldn't the use of tempfile.mkdtemp() from Python library just solve the whole issue?</p>
<p style="margin:0px"><br></p><p style="margin:0px">- TMPDIR = grass.tempdir()</p><p style="margin:0px">+ TMPDIR = tempfile.mkdtemp()</p>
<p style="margin:0px"><br></p><p style="margin:0px">Do you think that this is correct? If so, I can commit this one liner and hopefully test it in next days, but honestly, it seems so clear that I would be very surprised if there is some issue. What do you think?</p>
<p style="margin:0px"><br></p><p style="margin:0px">Vaclav</p><p style="margin:0px"><br></p></div>[#1178] <a href="http://trac.osgeo.org/grass/ticket/1178">http://trac.osgeo.org/grass/ticket/1178</a><br><div>[g.extension] <a href="http://grass.osgeo.org/grass70/manuals/g.extension.html">http://grass.osgeo.org/grass70/manuals/g.extension.html</a><br>
</div><div>[g.tempfile] <a href="http://grass.osgeo.org/grass70/manuals/g.tempfile.html">http://grass.osgeo.org/grass70/manuals/g.tempfile.html</a></div><div>[mkdtemp] <a href="http://docs.python.org/2/library/tempfile.html#tempfile.mkdtemp">http://docs.python.org/2/library/tempfile.html#tempfile.mkdtemp</a></div>
<div><br></div><div>PS: I don't use spaces in file names. I discovered this issue by chance.</div></div>