Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
only write if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
eeue56 committed Oct 25, 2016
1 parent d1d061e commit 532e3ec
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions native_package_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ def update_elm_package(vendor_dir, configs, packages):
source_directories = data['source-directories']
path = '../' * config.count('/')

needs_save = False

for package in packages:
current_package_dirs = get_source_dirs(vendor_dir, package)

Expand All @@ -199,9 +201,11 @@ def update_elm_package(vendor_dir, configs, packages):

if relative_path not in data['source-directories']:
data['source-directories'].append(relative_path)
needs_save = True

with open(config, 'w') as f:
f.write(json.dumps(data, indent=4))
if needs_save:
with open(config, 'w') as f:
f.write(json.dumps(data, indent=4))

return repository

Expand Down

0 comments on commit 532e3ec

Please sign in to comment.