From 8d59c0efade50ba5d58d08cdf0c83d2922af2804 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sat, 5 Sep 2009 11:10:14 +0000 Subject: [PATCH] Various fixes. example/libraries now runs, though the includes are messed [SVN r56031] --- src/build/project.py | 33 ++++++++++++++++++++++++--------- src/build/property.py | 2 +- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/build/project.py b/src/build/project.py index 4e7486c20..e0af3c36c 100644 --- a/src/build/project.py +++ b/src/build/project.py @@ -255,7 +255,7 @@ class ProjectRegistry: self.dir2jamfile[dir] = jamfile jamfile_glob = jamfile - if len(jamfile_glob): + if len(jamfile_glob) > 1: # Multiple Jamfiles found in the same place. Warn about this. # And ensure we use only one of them. # As a temporary convenience measure, if there's Jamfile.v2 amount @@ -266,8 +266,10 @@ class ProjectRegistry: if len(v2_jamfiles) == 1: jamfile_glob = v2_jamfiles else: - print """warning: Found multiple Jamfiles at '%s'! -Loading the first one: '%s'.""" % (dir, jamfile_glob[0]) + print """warning: Found multiple Jamfiles at '%s'!""" % (dir) + for j in jamfile_glob: + print " -", j + print "Loading the first one" # Could not find it, error. if not no_errors and not jamfile_glob: @@ -390,7 +392,7 @@ actual value %s""" % (jamfile_module, saved_project, self.current_project)) self.module2attributes[module_name] = attributes if location: - attributes.set("source-location", location, exact=1) + attributes.set("source-location", [location], exact=1) else: attributes.set("source-location", "", exact=1) @@ -510,12 +512,22 @@ actual value %s""" % (jamfile_module, saved_project, self.current_project)) """Returns the value of the specified attribute in the specified jamfile module.""" return self.module2attributes[project].get(attribute) + try: + return self.module2attributes[project].get(attribute) + except: + print "Sucks", project, attribute + raise "Sucks" + + def attributeDefault(self, project, attribute, default): + """Returns the value of the specified attribute in the + specified jamfile module.""" + return self.module2attributes[project].getDefault(attribute, default) def target(self, project_module): """Returns the project target corresponding to the 'project-module'.""" - if not self.module2target[project_module]: + if not self.module2target.has_key(project_module): self.module2target[project_module] = \ - ProjectTarget(project_module, project_module, + b2.build.targets.ProjectTarget(project_module, project_module, self.attribute(project_module, "requirements")) return self.module2target[project_module] @@ -524,12 +536,12 @@ actual value %s""" % (jamfile_module, saved_project, self.current_project)) # Use/load a project. saved_project = self.current_project project_module = self.load(location) - declared_id = self.attribute(project_module, "id") + declared_id = self.attributeDefault(project_module, "id", "") if not declared_id or declared_id != id: # The project at 'location' either have no id or # that id is not equal to the 'id' parameter. - if self.id2module[id] and self.id2module[id] != project_module: + if self.id2module.has_key(id) and self.id2module[id] != project_module: self.manager.errors()( """Attempt to redeclare already existing project id '%s'""" % id) self.id2module[id] = project_module @@ -743,6 +755,9 @@ for project at '%s'""" % (attribute, self.location)) def get(self, attribute): return self.__dict__[attribute] + def getDefault(self, attribute, default): + return self.__dict__.get(attribute, default) + def dump(self): """Prints the project attributes.""" id = self.get("id") @@ -905,7 +920,7 @@ attribute is allowed only for top-level 'project' invocations""") # See comment in 'load' for explanation why we record the # parameters as opposed to loading the project now. m = self.registry.current().project_module(); - self.registry.used_projects[m].append((id, where)) + self.registry.used_projects[m].append((id[0], where[0])) def build_project(self, dir): assert(isinstance(dir, list)) diff --git a/src/build/property.py b/src/build/property.py index bc91cc243..7858618ff 100644 --- a/src/build/property.py +++ b/src/build/property.py @@ -162,7 +162,7 @@ def translate_paths (properties, path): t = [os.path.join(path, v) for v in values] t = '&&'.join (t) - tp = backslashes_to_slashes (replace_grist (t, get_grist (p))) + tp = replace_grist (t, get_grist (p)).replace("\\", "/") result.append (condition + tp) else: