From 1f2c4d920348d499133b892b7189c56204d96624 Mon Sep 17 00:00:00 2001 From: Ilan Schnell Date: Wed, 11 May 2016 22:17:29 -0500 Subject: [PATCH 1/3] simplify file writing --- conda_build/build.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/conda_build/build.py b/conda_build/build.py index 9d13054302..4f2fa5c79c 100644 --- a/conda_build/build.py +++ b/conda_build/build.py @@ -20,7 +20,6 @@ import conda.config as cc import conda.plan as plan from conda.api import get_index -from conda.compat import PY3 from conda.fetch import fetch_index from conda.install import prefix_placeholder, linked, move_to_trash from conda.lock import Locked @@ -218,13 +217,11 @@ def create_info_files(m, files, include_recipe=True): info_index['depends'] = [' '.join(dist.rsplit('-', 2)) for dist in dists] - # Deal with Python 2 and 3's different json module type reqs - mode_dict = {'mode': 'w', 'encoding': 'utf-8'} if PY3 else {'mode': 'wb'} - with open(join(config.info_dir, 'index.json'), **mode_dict) as fo: + with open(join(config.info_dir, 'index.json'), 'w') as fo: json.dump(info_index, fo, indent=2, sort_keys=True) if include_recipe: - with open(join(config.info_dir, 'recipe.json'), **mode_dict) as fo: + with open(join(config.info_dir, 'recipe.json'), 'w') as fo: json.dump(m.meta, fo, indent=2, sort_keys=True) if sys.platform == 'win32': From c1de28872c16fae5642d348fd7a0f683ea64a209 Mon Sep 17 00:00:00 2001 From: Ilan Schnell Date: Wed, 11 May 2016 22:24:19 -0500 Subject: [PATCH 2/3] add info/about.json --- conda_build/build.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/conda_build/build.py b/conda_build/build.py index 4f2fa5c79c..fea7f384ed 100644 --- a/conda_build/build.py +++ b/conda_build/build.py @@ -220,6 +220,15 @@ def create_info_files(m, files, include_recipe=True): with open(join(config.info_dir, 'index.json'), 'w') as fo: json.dump(info_index, fo, indent=2, sort_keys=True) + with open(join(config.info_dir, 'about.json'), 'w') as fo: + d = {} + for key in ('home', 'dev_url', 'doc_url', 'license_url', + 'license', 'summary', 'description', 'license_family'): + value = m.get_value('about/%s' % key) + if value: + d[key] = value + json.dump(d, fo, indent=2, sort_keys=True) + if include_recipe: with open(join(config.info_dir, 'recipe.json'), 'w') as fo: json.dump(m.meta, fo, indent=2, sort_keys=True) From 2457c8eaa4d7743d441968404ba9441b74c7a510 Mon Sep 17 00:00:00 2001 From: Ilan Schnell Date: Fri, 3 Jun 2016 16:28:41 -0500 Subject: [PATCH 3/3] Revert "simplify file writing" This reverts commit 1f2c4d920348d499133b892b7189c56204d96624. --- conda_build/build.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/conda_build/build.py b/conda_build/build.py index edb72c6ff4..fe5b407533 100644 --- a/conda_build/build.py +++ b/conda_build/build.py @@ -20,6 +20,7 @@ import conda.config as cc import conda.plan as plan from conda.api import get_index +from conda.compat import PY3 from conda.fetch import fetch_index from conda.install import prefix_placeholder, linked, move_to_trash from conda.lock import Locked @@ -237,7 +238,9 @@ def create_info_files(m, files, include_recipe=True): info_index['depends'] = [' '.join(dist.rsplit('-', 2)) for dist in dists] - with open(join(config.info_dir, 'index.json'), 'w') as fo: + # Deal with Python 2 and 3's different json module type reqs + mode_dict = {'mode': 'w', 'encoding': 'utf-8'} if PY3 else {'mode': 'wb'} + with open(join(config.info_dir, 'index.json'), **mode_dict) as fo: json.dump(info_index, fo, indent=2, sort_keys=True) with open(join(config.info_dir, 'about.json'), 'w') as fo: @@ -250,7 +253,7 @@ def create_info_files(m, files, include_recipe=True): json.dump(d, fo, indent=2, sort_keys=True) if include_recipe: - with open(join(config.info_dir, 'recipe.json'), 'w') as fo: + with open(join(config.info_dir, 'recipe.json'), **mode_dict) as fo: json.dump(m.meta, fo, indent=2, sort_keys=True) if sys.platform == 'win32':