Hi,
currently in GRASS 6 PGM variable must be set including python file
extension, in GRASS 7 not, e.g.
PGM=v.krige.py in GRASS6
PGM=v.krige in GRASS7
Would be possible to change building system in GRASS 6 to unify it with GRASS 7.
Thanks in advance, Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
On Sun, Jul 5, 2009 at 5:37 PM, Martin Landa<landa.martin@gmail.com> wrote:
Hi,
currently in GRASS 6 PGM variable must be set including python file
extension, in GRASS 7 not, e.g.
PGM=v.krige.py in GRASS6
PGM=v.krige in GRASS7
A similar case are "description.html" versus "modulename.html".
Would be possible to change building system in GRASS 6 to unify it with GRASS 7.
Perhaps with a workaround for "description.html" to avoid renaming.
Since we have the GRASS version accessible in Makefile (AFAIK) it
could be conditionalized.
Markus
Martin Landa wrote:
currently in GRASS 6 PGM variable must be set including python file
extension, in GRASS 7 not, e.g.
PGM=v.krige.py in GRASS6
PGM=v.krige in GRASS7
Would be possible to change building system in GRASS 6 to unify it with GRASS 7.
GRASS 7 now *only* allows Python scripts, so I don't think you want to
unify it quite that far.
The main issue is that, on Windows, make needs to know whether it's
supposed to be creating $(SCRIPTDIR)/$(PGM).py or
$(SCRIPTDIR)/$(PGM).sh. Once you know what the target is, it's easy
enought to create it.
The problem doesn't exist on Unix, as you always want to create
$(SCRIPTDIR)/$(PGM); you can just provide multiple rules to create it
from either %.py or %, and make will use whichever is available.
Actually, if you use $(BIN)/$(PGM).bat as the ultimate target, you can
then add two rules to create that from either $(SCRIPTDIR)/$(PGM).py
or $(SCRIPTDIR)/$(PGM).sh, i.e.:
ifdef MINGW
script: $(BIN)/$(PGM).bat
else
script: $(SCRIPTDIR)/$(PGM)
endif
$(BIN)/%.bat: $(SCRIPTDIR)/%.py
# generate .bat file to run .py file
$(BIN)/%.bat: $(SCRIPTDIR)/%.sh
# generate .bat file to run .sh file
$(SCRIPTDIR)/%.py: %.py
$(INSTALL) $< $@
$(SCRIPTDIR)/%.sh: %
$(INSTALL) $< $@
$(SCRIPTDIR)/%: %.py
$(INSTALL) $< $@
$(SCRIPTDIR)/%: %
$(INSTALL) $< $@
--
Glynn Clements <glynn@gclements.plus.com>
Hi,
2009/7/6 Glynn Clements <glynn@gclements.plus.com>:
currently in GRASS 6 PGM variable must be set including python file
extension, in GRASS 7 not, e.g.
PGM=v.krige.py in GRASS6
PGM=v.krige in GRASS7
Would be possible to change building system in GRASS 6 to unify it with GRASS 7.
GRASS 7 now *only* allows Python scripts, so I don't think you want to
unify it quite that far.
Probably I was unclear, I would like just to avoid having two separate
Makefiles for one Python script, one for GRASS7 with `PGM=module` and
the second for GRASS6 with `PGM=module.py`. Nothing more.
Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
Martin Landa wrote:
>> currently in GRASS 6 PGM variable must be set including python file
>> extension, in GRASS 7 not, e.g.
>>
>> PGM=v.krige.py in GRASS6
>> PGM=v.krige in GRASS7
>>
>> Would be possible to change building system in GRASS 6 to unify it with GRASS 7.
>
> GRASS 7 now *only* allows Python scripts, so I don't think you want to
> unify it quite that far.
Probably I was unclear, I would like just to avoid having two separate
Makefiles for one Python script, one for GRASS7 with `PGM=module` and
the second for GRASS6 with `PGM=module.py`. Nothing more.
Regardless, make needs to know which file it's supposed to be
creating. If you want to autodect this, it requires new code; current
or previous practice in GRASS 7 won't help.
--
Glynn Clements <glynn@gclements.plus.com>
Hi,
2009/7/6 Glynn Clements <glynn@gclements.plus.com>:
[...]
Probably I was unclear, I would like just to avoid having two separate
Makefiles for one Python script, one for GRASS7 with `PGM=module` and
the second for GRASS6 with `PGM=module.py`. Nothing more.
Regardless, make needs to know which file it's supposed to be
creating. If you want to autodect this, it requires new code; current
or previous practice in GRASS 7 won't help.
Probably it would make sense to add support to the building system for
shell scripts again - some users have a lot of such scripts. Then PGM
should always contain file extension.
Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
Martin Landa wrote:
>> Probably I was unclear, I would like just to avoid having two separate
>> Makefiles for one Python script, one for GRASS7 with `PGM=module` and
>> the second for GRASS6 with `PGM=module.py`. Nothing more.
>
> Regardless, make needs to know which file it's supposed to be
> creating. If you want to autodect this, it requires new code; current
> or previous practice in GRASS 7 won't help.
Probably it would make sense to add support to the building system for
shell scripts again - some users have a lot of such scripts.
Users scripts aren't relevant to the GRASS build system.
Then PGM should always contain file extension.
No, because the file extension is removed on Unix, and it doesn't
appear in the name of the manpage or HTML file. PGM is the *name* of
the module or script, not necessarily its filename.
--
Glynn Clements <glynn@gclements.plus.com>
Hi,
2009/7/7 Glynn Clements <glynn@gclements.plus.com>:
>> Probably I was unclear, I would like just to avoid having two separate
>> Makefiles for one Python script, one for GRASS7 with `PGM=module` and
>> the second for GRASS6 with `PGM=module.py`. Nothing more.
>
> Regardless, make needs to know which file it's supposed to be
> creating. If you want to autodect this, it requires new code; current
> or previous practice in GRASS 7 won't help.
Probably it would make sense to add support to the building system for
shell scripts again - some users have a lot of such scripts.
Users scripts aren't relevant to the GRASS build system.
Probably users are important for us 
Then PGM should always contain file extension.
No, because the file extension is removed on Unix, and it doesn't
appear in the name of the manpage or HTML file. PGM is the *name* of
the module or script, not necessarily its filename.
That is what I was asking for. So how to avoid python file extension
in Makefiles for GRASS 6. Currently, e.g.
PGM=v.krige
fails, must be
PGM=v.krige.py
Thanks, Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
Martin Landa wrote:
>> Then PGM should always contain file extension.
>
> No, because the file extension is removed on Unix, and it doesn't
> appear in the name of the manpage or HTML file. PGM is the *name* of
> the module or script, not necessarily its filename.
That is what I was asking for. So how to avoid python file extension
in Makefiles for GRASS 6. Currently, e.g.
PGM=v.krige
fails, must be
PGM=v.krige.py
I described one solution in reply to the original post. Another
solution is to have separate "script" and "pyscript" targets.
--
Glynn Clements <glynn@gclements.plus.com>