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

Unified Diff: ensure_dependencies.py

Issue 29359969: Issue 4569 - Make sure to add ignored directories without overwriting existing file content (Closed) Base URL: https://hg.adblockplus.org/buildtools
Patch Set: Created Oct. 26, 2016, 6:19 p.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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ensure_dependencies.py
===================================================================
--- a/ensure_dependencies.py
+++ b/ensure_dependencies.py
@@ -350,16 +350,17 @@ def resolve_deps(repodir, level=0, self_
logging.info('Restarting %s' % target)
os.execv(sys.executable, [sys.executable, target] + sys.argv[1:])
else:
logging.warning('Cannot restart %s automatically, please rerun' % target)
def _ensure_line_exists(path, pattern):
with open(path, 'a+') as f:
+ f.seek(0, os.SEEK_SET)
file_content = [l.strip() for l in f.readlines()]
if not pattern in file_content:
file_content.append(pattern)
f.seek(0, os.SEEK_SET)
f.truncate()
for l in file_content:
print >>f, l
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld