| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/python2.4 | |
| 2 # | |
| 3 # Copyright 2009 Google Inc. | |
| 4 # | |
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 # you may not use this file except in compliance with the License. | |
| 7 # You may obtain a copy of the License at | |
| 8 # | |
| 9 # http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 # | |
| 11 # Unless required by applicable law or agreed to in writing, software | |
| 12 # distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 # See the License for the specific language governing permissions and | |
| 15 # limitations under the License. | |
| 16 # ======================================================================== | |
| 17 | |
| 18 """A Hammer-specific wrapper for generate_group_policy_template.""" | |
| 19 | |
| 20 from omaha.enterprise import generate_group_policy_template | |
| 21 | |
| 22 | |
| 23 def BuildGroupPolicyTemplate(env, target, apps, apps_file_path=None): | |
| 24 """Builds a Group Policy ADM template file, handling dependencies. | |
| 25 | |
| 26 Causes WriteGroupPolicyTemplate() to be called at build time instead of as | |
| 27 part of the processing stage. | |
| 28 | |
| 29 Args: | |
| 30 env: The environment. | |
| 31 target: ADM output file. | |
| 32 apps: A list of tuples containing information about each app. See | |
| 33 generate_group_policy_template for details. | |
| 34 apps_file_path: Optional path to the file that defines apps. Used to enforce | |
| 35 dependencies. | |
| 36 """ | |
| 37 | |
| 38 def _WriteAdmFile(target, source, env): | |
| 39 """Called during the build phase to generate and write the ADM file.""" | |
| 40 source = source # Avoid PyLint warning. | |
| 41 generate_group_policy_template.WriteGroupPolicyTemplate( | |
| 42 env.File(target[0]).abspath, | |
| 43 env['public_apps']) | |
| 44 return 0 | |
| 45 | |
| 46 adm_output = env.Command( | |
| 47 target=target, | |
| 48 source=[], | |
| 49 action=_WriteAdmFile, | |
| 50 public_apps=apps | |
| 51 ) | |
| 52 | |
| 53 # Force ADM file to rebuild whenever the script or apps data change. | |
| 54 dependencies = ['$MAIN_DIR/enterprise/generate_group_policy_template.py'] | |
| 55 if apps_file_path: | |
| 56 dependencies.append(apps_file_path) | |
| 57 env.Depends(adm_output, dependencies) | |
| OLD | NEW |