Re: Issue with target names and data tool



Hello,

                    في ج، 08-04-2011 عند 17:48 -0700 ، كتب Dylan McCall:
> On Thu, Apr 7, 2011 at 12:59 PM, Alberto Ruiz <aruiz gnome org> wrote:
> > Hello Dylan,
> >
> > Thank you very much for the interest!
> > I think that the solution would be to have an optional 'output'
> > parameter for targets.
> >
> > If 'output' is set then it should use that as the output name instead
> > of the target name.
> >
> > Have a look at the "get_build_arguments" method of the ProjecTarget
> > class. The patch should be pretty straightforward, I'm sure that you
> > can do it and be the third contributor to the project!
> 
> Thanks for the words of encouragement, Alberto :)
> 
> I'm attaching a patch with that and an example in cc/project.yaml.
I think it would be better to commit, and then generate a patch using
git format-patch. See below for my comments on your patch, but otherwise
looks good.

Regards,
Abderrahim



> diff --git a/buildj.py b/buildj.py
> old mode 100644
> new mode 100755

Why make it executable?

> index 5be4df2..9a42d7f
> --- a/buildj.py
> +++ b/buildj.py
> @@ -84,8 +84,8 @@ class ProjectFile:
>                 return option_list
>  
>         def get_targets (self):
> -               names = dict([(tgt.get_name(), tgt) for tgt in self._targets])
> -               deps = dict([(tgt.get_name(), tgt.get_uses()) for tgt in self._targets])
> +               names = dict([(tgt.get_output(), tgt) for tgt in self._targets])
> +               deps = dict([(tgt.get_output(), tgt.get_uses()) for tgt in self._targets])

This actually changes the way a target is referenced from another,
doesn't it? (I think it shouldn't)

>                 S = [tgt for tgt in deps if not deps[tgt]]
>                 targets = []
>                 while S:
> @@ -158,7 +158,12 @@ class ProjectTarget(object):
>  
>         def get_name (self):
>                 return str(self._name)
> -                                               
> +
> +       def get_output (self):
> +               if "output" in self._target:
> +                       return str(self._target["output"])
> +               return self.get_name()
> +
>         def get_tool (self):
>                 if "tool" not in self._target:
>                         return None
> @@ -221,7 +226,7 @@ class ProjectTarget(object):
>                 "WAF bld arguments dictionary"
>                 args = {"features": self.get_features (),
>                         "source":   self.get_input (),
> -                       "target":   self.get_name ()}
> +                       "target":   self.get_output ()}

I think you need to set both name and target (to get_name() and
get_output() respectively).

>                 
>                 return args
>  
> @@ -302,7 +307,7 @@ class DataTarget (ProjectTarget):
>                 return self.get_input ()
>  
>         def get_install_path (self):
> -               return "${PREFIX}/share/" + self.get_name ()
> +               return "${PREFIX}/share/" + self.get_output ()
>  
>  class ProjectRequirement:
>         def __init__ (self, name, requirement):
> diff --git a/cc/project.yaml b/cc/project.yaml
> index 231b445..18dded4 100644
> --- a/cc/project.yaml
> +++ b/cc/project.yaml
> @@ -36,6 +36,7 @@ targets:
>    
>    my_gtk_program:
>      type:      program
> +    output:    my_gtk_program_renamed
>      tool:      cc
>      input:
>        - gtk_program.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]