diff options
author | bradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-04 06:10:23 +0000 |
---|---|---|
committer | bradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-04 06:10:23 +0000 |
commit | 1283ba4fe600d3c8cb32b494cbba96fb1eb106e4 (patch) | |
tree | 984323cbc7d5db84ecb9317f1c5e10dd07874026 /site_scons/site_tools/publish.py | |
parent | 7199517ad5241497f9571f93b1f71b95aea95e0b (diff) | |
download | chromium_src-1283ba4fe600d3c8cb32b494cbba96fb1eb106e4.zip chromium_src-1283ba4fe600d3c8cb32b494cbba96fb1eb106e4.tar.gz chromium_src-1283ba4fe600d3c8cb32b494cbba96fb1eb106e4.tar.bz2 |
Adding in new software construction toolkit version.
Review URL: http://codereview.chromium.org/9094
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4566 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'site_scons/site_tools/publish.py')
-rw-r--r-- | site_scons/site_tools/publish.py | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/site_scons/site_tools/publish.py b/site_scons/site_tools/publish.py index ebd6acf..bf6a737 100644 --- a/site_scons/site_tools/publish.py +++ b/site_scons/site_tools/publish.py @@ -31,7 +31,10 @@ """Publish tool for SCons.""" -__published = {} # List of published resources +# List of published resources. This is a dict indexed by group name. Each +# item in this dict is a dict indexed by resource type. Items in that dict +# are lists of files for that resource. +__published = {} #------------------------------------------------------------------------------ @@ -54,13 +57,13 @@ class PublishItem(object): #------------------------------------------------------------------------------ -def _InitializePublish(self): +def _InitializePublish(env): """Re-initializes published resources. Args: - self: Parent environment + env: Parent environment """ - self=self # Silence gpylint + env=env # Silence gpylint # Clear the dict of published resources __published.clear() @@ -87,10 +90,10 @@ def ReplicatePublished(self, target, group_name, resource_type): target_path = self.Dir(target).abspath dest_nodes = [] - for group in self.Flatten(group_name): - for resource in self.Flatten(resource_type): + for group in self.SubstList2(group_name): + for resource in self.SubstList2(resource_type): # Get items for publish group and resource type - items = __published.get(self.subst(group), {}).get(resource, []) + items = __published.get(group, {}).get(resource, []) for i in items: if i.subdir: dest_nodes += self.Replicate(target_path + '/' + i.subdir, i.source) @@ -113,10 +116,10 @@ def GetPublished(self, group_name, resource_type): no matching resources. """ source_list = [] - for group in self.Flatten(group_name): + for group in self.SubstList2(group_name): # Get items for publish group and resource type - for resource in self.Flatten(resource_type): - items = __published.get(self.subst(group), {}).get(resource, []) + for resource in self.SubstList2(resource_type): + items = __published.get(group, {}).get(resource, []) for i in items: source_list.append(i.source) @@ -141,13 +144,17 @@ def Publish(self, group_name, resource_type, source, subdir=None): subdir = '' # Make string so we can append to it # Evaluate SCons variables in group name + # TODO(rspangler): Should Publish() be able to take a list of group names + # and publish the resource to all of them? group_name = self.subst(group_name) # Get list of sources items = [] for source_entry in self.Flatten(source): - if type(source_entry) == str: + if isinstance(source_entry, str): # Search for matches for each source entry + # TODO(rspangler): If there are no wildcard chars in the source entry, + # should generate an error if there were no matches? source_nodes = self.Glob(source_entry) else: # Source entry is already a file or directory node; no need to glob it @@ -179,7 +186,10 @@ def generate(env): # NOTE: SCons requires the use of this name, which fails gpylint. """SCons entry point for this tool.""" - env.AddMethod(_InitializePublish) + # Defer initializing publish, but do before building SConscripts + env.Defer(_InitializePublish) + env.Defer('BuildEnvironmentSConscripts', after=_InitializePublish) + env.AddMethod(GetPublished) env.AddMethod(Publish) env.AddMethod(ReplicatePublished) |