From b4563f0efcef5fe05ebba84f3921160c64f286b4 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 18 Oct 2011 08:59:38 +0000 Subject: [PATCH] Fix prebuilt generators. The prebuilt.py test now passes with Python port. [SVN r75034] --- v2/tools/builtin.py | 35 +++++++++++++++++------------------ v2/tools/unix.py | 8 ++++---- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/v2/tools/builtin.py b/v2/tools/builtin.py index 5c32903c6..58cb7f33c 100644 --- a/v2/tools/builtin.py +++ b/v2/tools/builtin.py @@ -399,7 +399,7 @@ class LibGenerator (generators.Generator): SHARED_LIB. """ - def __init__(self, id = 'LibGenerator', composing = True, source_types = [], target_types_and_names = ['LIB'], requirements = []): + def __init__(self, id, composing = True, source_types = [], target_types_and_names = ['LIB'], requirements = []): generators.Generator.__init__(self, id, composing, source_types, target_types_and_names, requirements) def run(self, project, name, prop_set, sources): @@ -432,7 +432,9 @@ class LibGenerator (generators.Generator): def viable_source_types(self): return ['*'] -generators.register(LibGenerator()) +generators.register(LibGenerator("builtin.lib-generator")) + +generators.override("builtin.prebuilt", "builtin.lib-generator") def lib(names, sources=[], requirements=[], default_build=[], usage_requirements=[]): """The implementation of the 'lib' rule. Beyond standard syntax that rule allows @@ -508,22 +510,19 @@ class SearchedLibGenerator (generators.Generator): generators.register (SearchedLibGenerator ()) -### class prebuilt-lib-generator : generator -### { -### rule __init__ ( * : * ) -### { -### generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; -### } -### -### rule run ( project name ? : prop_set : sources * : multiple ? ) -### { -### local f = [ $(prop_set).get ] ; -### return $(f) $(sources) ; -### } -### } -### -### generators.register -### [ new prebuilt-lib-generator builtin.prebuilt : : LIB : ] ; +class PrebuiltLibGenerator(generators.Generator): + + def __init__(self, id, composing, source_types, target_types_and_names, requirements): + generators.Generator.__init__ (self, id, composing, source_types, target_types_and_names, requirements) + + def run(self, project, name, properties, sources): + f = properties.get("file") + return f + sources + +generators.register(PrebuiltLibGenerator("builtin.prebuilt", False, [], + ["LIB"], [""])) + +generators.override("builtin.prebuilt", "builtin.lib-generator") class CompileAction (virtual_target.Action): diff --git a/v2/tools/unix.py b/v2/tools/unix.py index d409c2e46..34758f57b 100644 --- a/v2/tools/unix.py +++ b/v2/tools/unix.py @@ -58,8 +58,8 @@ class UnixSearchedLibGenerator (builtin.SearchedLibGenerator): def optional_properties (self): return self.requirements () - def run (self, project, name, prop_set, sources, multiple): - result = SearchedLibGenerator.run (project, name, prop_set, sources, multiple) + def run (self, project, name, prop_set, sources): + result = SearchedLibGenerator.run (project, name, prop_set, sources) set_library_order (sources, prop_set, result) @@ -69,10 +69,10 @@ class UnixPrebuiltLibGenerator (generators.Generator): def __init__ (self, id, composing, source_types, target_types_and_names, requirements): generators.Generator.__init__ (self, id, composing, source_types, target_types_and_names, requirements) - def run (self, project, name, prop_set, sources, multiple): + def run (self, project, name, prop_set, sources): f = prop_set.get ('') set_library_order_aux (f, sources) - return (f, sources) + return f + sources ### # The derived toolset must specify their own rules and actions. # FIXME: restore?