Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # This file is part of Adblock Plus <https://adblockplus.org/>, | 3 # This file is part of Adblock Plus <https://adblockplus.org/>, |
4 # Copyright (C) 2006-2016 Eyeo GmbH | 4 # Copyright (C) 2006-2016 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
(...skipping 17 matching lines...) Expand all Loading... | |
28 if len(key_parts) < 2: | 28 if len(key_parts) < 2: |
29 continue | 29 continue |
30 project_name, field_name = key_parts | 30 project_name, field_name = key_parts |
31 if field_name not in {"repository", "target_directory", "command"}: | 31 if field_name not in {"repository", "target_directory", "command"}: |
32 continue | 32 continue |
33 projects.setdefault(project_name, {})[field_name] = value | 33 projects.setdefault(project_name, {})[field_name] = value |
34 return projects | 34 return projects |
35 | 35 |
36 def sync_sources(sources_dir, repository_url): | 36 def sync_sources(sources_dir, repository_url): |
37 if os.path.exists(sources_dir): | 37 if os.path.exists(sources_dir): |
38 subprocess.check_call(["hg", "pull", "--quiet", "--update" | 38 subprocess.check_call(["hg", "pull", "--quiet", |
39 "--rev", "master", | |
39 "--repository", sources_dir]) | 40 "--repository", sources_dir]) |
Wladimir Palant
2016/02/09 10:44:28
You don't really want to call |hg pull --update|,
Felix Dahlke
2016/02/09 12:40:22
Done.
| |
41 subprocess.check_call(["hg", "update", "--quiet", | |
42 "--rev", "master"]) | |
40 else: | 43 else: |
41 subprocess.check_call(["hg", "clone", "--quiet", | 44 subprocess.check_call(["hg", "clone", "--quiet", |
42 "--updaterev", "master", | 45 "--updaterev", "master", |
43 repository_url, sources_dir]) | 46 repository_url, sources_dir]) |
44 | 47 |
45 def replace_dir(source_dir, target_dir): | 48 def replace_dir(source_dir, target_dir): |
46 if not os.path.exists(target_dir): | 49 if not os.path.exists(target_dir): |
47 parent_dir = os.path.dirname(target_dir) | 50 parent_dir = os.path.dirname(target_dir) |
48 try: | 51 try: |
49 os.makedirs(parent_dir) | 52 os.makedirs(parent_dir) |
(...skipping 23 matching lines...) Expand all Loading... | |
73 sources_dir = os.path.join(temp_directory, name) | 76 sources_dir = os.path.join(temp_directory, name) |
74 sync_sources(sources_dir, data["repository"]) | 77 sync_sources(sources_dir, data["repository"]) |
75 output_dir = sources_dir.rstrip(os.path.sep) + ".docs" | 78 output_dir = sources_dir.rstrip(os.path.sep) + ".docs" |
76 run_generation_command(data["command"], sources_dir, output_dir) | 79 run_generation_command(data["command"], sources_dir, output_dir) |
77 replace_dir(output_dir, data["target_directory"]) | 80 replace_dir(output_dir, data["target_directory"]) |
78 | 81 |
79 if __name__ == "__main__": | 82 if __name__ == "__main__": |
80 config = get_config() | 83 config = get_config() |
81 projects = read_projects(config) | 84 projects = read_projects(config) |
82 generate_docs(projects, config) | 85 generate_docs(projects, config) |
LEFT | RIGHT |