Re: Issue with target names and data tool
- From: Dylan McCall <dylanmccall gmail com>
- To: Abderrahim Kitouni <a kitouni gmail com>
- Cc: buildj-list gnome org
- Subject: Re: Issue with target names and data tool
- Date: Wed, 11 May 2011 12:40:07 -0700
On Sun, Apr 10, 2011 at 3:04 PM, Abderrahim Kitouni <a kitouni gmail com> wrote:
> Hello,
> […]
>> 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
>
>
I should go through my starred messages more often :o
Thanks for your help, Abderrahim. I agree with you on all of those
points, and indeed I just made this fail with two targets that had the
same output name. (Can't believe I didn't test that!). So, I'm
attaching a newer patch that sets the name argument instead of playing
around with get_targets.
I should go read up more on Waf, I think :)
This does change the behaviour from what I described at first, since a
target under the "uses" section now (sensibly) refers to another
target's name; not its output.
--
Dylan
From ce1fc6a62f54529250d98121f59c3ba2e34420e2 Mon Sep 17 00:00:00 2001
From: Dylan McCall <dylanmccall gmail com>
Date: Wed, 11 May 2011 12:34:38 -0700
Subject: [PATCH] Fixed issue with multiple outputs given the same name.
Other targets referred to by target name instead of output name.
---
buildj.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/buildj.py b/buildj.py
index 9a42d7f..081d9bd 100644
--- a/buildj.py
+++ b/buildj.py
@@ -84,8 +84,8 @@ class ProjectFile:
return option_list
def get_targets (self):
- names = dict([(tgt.get_output(), tgt) for tgt in self._targets])
- deps = dict([(tgt.get_output(), tgt.get_uses()) for tgt in self._targets])
+ names = dict([(tgt.get_name(), tgt) for tgt in self._targets])
+ deps = dict([(tgt.get_name(), tgt.get_uses()) for tgt in self._targets])
S = [tgt for tgt in deps if not deps[tgt]]
targets = []
while S:
@@ -226,6 +226,7 @@ class ProjectTarget(object):
"WAF bld arguments dictionary"
args = {"features": self.get_features (),
"source": self.get_input (),
+ "name": self.get_name (),
"target": self.get_output ()}
return args
--
1.7.4.1
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]