Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/docs/bin/generate_docs.py

Issue 29345242: Noissue - Adapt quotes for compliance with our coding style in sitescripts (Closed)
Patch Set: Fixed raw string Created May 30, 2016, 8:47 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sitescripts/docs/bin/generate_docs.py
===================================================================
--- a/sitescripts/docs/bin/generate_docs.py
+++ b/sitescripts/docs/bin/generate_docs.py
@@ -24,12 +24,12 @@
def read_projects(config):
projects = {}
- for key, value in config.items("docs"):
- key_parts = key.split("_", 1)
+ for key, value in config.items('docs'):
+ key_parts = key.split('_', 1)
if len(key_parts) < 2:
continue
project_name, field_name = key_parts
- if field_name not in {"repository", "target_directory", "command"}:
+ if field_name not in {'repository', 'target_directory', 'command'}:
continue
projects.setdefault(project_name, {})[field_name] = value
return projects
@@ -37,15 +37,15 @@
def sync_sources(sources_dir, repository_url):
if os.path.exists(sources_dir):
- subprocess.check_call(["hg", "pull", "--quiet",
- "--rev", "master",
- "--repository", sources_dir])
- subprocess.check_call(["hg", "update", "--quiet",
- "--rev", "master",
- "--repository", sources_dir])
+ subprocess.check_call(['hg', 'pull', '--quiet',
+ '--rev', 'master',
+ '--repository', sources_dir])
+ subprocess.check_call(['hg', 'update', '--quiet',
+ '--rev', 'master',
+ '--repository', sources_dir])
else:
- subprocess.check_call(["hg", "clone", "--quiet",
- "--updaterev", "master",
+ subprocess.check_call(['hg', 'clone', '--quiet',
+ '--updaterev', 'master',
repository_url, sources_dir])
@@ -58,7 +58,7 @@
pass
os.rename(source_dir, target_dir)
else:
- old_target_dir = target_dir.rstrip(os.path.sep) + ".old"
+ old_target_dir = target_dir.rstrip(os.path.sep) + '.old'
shutil.rmtree(old_target_dir, ignore_errors=True)
os.rename(target_dir, old_target_dir)
os.rename(source_dir, target_dir)
@@ -72,7 +72,7 @@
def generate_docs(projects, config):
- temp_directory = config.get("docs", "temp_directory")
+ temp_directory = config.get('docs', 'temp_directory')
try:
os.makedirs(temp_directory)
except OSError:
@@ -80,12 +80,12 @@
for name, data in projects.iteritems():
sources_dir = os.path.join(temp_directory, name)
- sync_sources(sources_dir, data["repository"])
- output_dir = sources_dir.rstrip(os.path.sep) + ".docs"
- run_generation_command(data["command"], sources_dir, output_dir)
- replace_dir(output_dir, data["target_directory"])
+ sync_sources(sources_dir, data['repository'])
+ output_dir = sources_dir.rstrip(os.path.sep) + '.docs'
+ run_generation_command(data['command'], sources_dir, output_dir)
+ replace_dir(output_dir, data['target_directory'])
-if __name__ == "__main__":
+if __name__ == '__main__':
config = get_config()
projects = read_projects(config)
generate_docs(projects, config)

Powered by Google App Engine
This is Rietveld