From fbc05935f5e6d3cb8e37bc1892bf26746ab51da1 Mon Sep 17 00:00:00 2001 From: shadow_walker Date: Sun, 23 Oct 2016 15:26:19 -0500 Subject: [PATCH 1/4] bldpkg_path_wrapper() --- recipe/upload_or_check_non_existence.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/recipe/upload_or_check_non_existence.py b/recipe/upload_or_check_non_existence.py index 34215b3..2157304 100755 --- a/recipe/upload_or_check_non_existence.py +++ b/recipe/upload_or_check_non_existence.py @@ -16,6 +16,16 @@ from conda_build.config import Config +def bldpkg_path_wrapper(meta): + try: + config = Config() + fname = bldpkg_path(meta, config) + except TypeError: + # conda-build < 2.0.0 takes a single config argument + fname = bldpkg_path(meta) + + return fname + def built_distribution_already_exists(cli, meta, owner): """ Checks to see whether the built recipe (aka distribution) already @@ -23,12 +33,7 @@ def built_distribution_already_exists(cli, meta, owner): """ distro_name = '{}/{}.tar.bz2'.format(conda.config.subdir, meta.dist()) - try: - config = Config() - fname = bldpkg_path(meta, config) - except TypeError: - # conda-build < 2.0.0 takes a single config argument - fname = bldpkg_path(meta) + fname = bldpkg_path_wrapper(meta) try: dist_info = cli.distribution(owner, meta.name(), meta.version(), distro_name) @@ -56,7 +61,7 @@ def upload(cli, meta, owner, channels): with open('binstar.token', 'w') as fh: fh.write(cli.token) subprocess.check_call(['anaconda', '--quiet', '-t', 'binstar.token', - 'upload', bldpkg_path(meta), + 'upload', bldpkg_path_wrapper(meta), '--user={}'.format(owner), '--channel={}'.format(channels)], env=os.environ) @@ -122,14 +127,14 @@ def main(): on_channel = distribution_exists_on_channel(cli, meta, owner, channel) if not exists: upload(cli, meta, owner, channel) - print('Uploaded {}'.format(bldpkg_path(meta))) + print('Uploaded {}'.format(bldpkg_path_wrapper(meta))) elif not on_channel: print('Adding distribution {} to {}\'s {} channel' - ''.format(bldpkg_path(meta), owner, channel)) + ''.format(bldpkg_path_wrapper(meta), owner, channel)) add_distribution_to_channel(cli, meta, owner, channel) else: print('Distribution {} already \nexists on {}\'s {} channel.' - ''.format(bldpkg_path(meta), owner, channel)) + ''.format(bldpkg_path_wrapper(meta), owner, channel)) else: print("No BINSTAR_TOKEN present, so no upload is taking place. " "The distribution just built {} already available on {}'s " From b89ca05a146ab19734d3ceb24293ec9307fef611 Mon Sep 17 00:00:00 2001 From: shadow_walker Date: Tue, 10 Jan 2017 12:33:38 -0600 Subject: [PATCH 2/4] use get_output_file_path for conda-build 2, use bldpkg_path as fallback --- recipe/upload_or_check_non_existence.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipe/upload_or_check_non_existence.py b/recipe/upload_or_check_non_existence.py index 2157304..77ea304 100755 --- a/recipe/upload_or_check_non_existence.py +++ b/recipe/upload_or_check_non_existence.py @@ -13,13 +13,14 @@ from conda.api import get_index from conda_build.metadata import MetaData from conda_build.build import bldpkg_path +from conda_build.api import get_output_file_path from conda_build.config import Config def bldpkg_path_wrapper(meta): try: config = Config() - fname = bldpkg_path(meta, config) + fname = get_output_file_path(meta, config) except TypeError: # conda-build < 2.0.0 takes a single config argument fname = bldpkg_path(meta) From 1cde78782ddb47581f8abe53499b46056603175b Mon Sep 17 00:00:00 2001 From: shadow_walker Date: Tue, 10 Jan 2017 12:46:46 -0600 Subject: [PATCH 3/4] remove bldpkg_path_wrapper --- recipe/upload_or_check_non_existence.py | 26 +++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/recipe/upload_or_check_non_existence.py b/recipe/upload_or_check_non_existence.py index 77ea304..d924057 100755 --- a/recipe/upload_or_check_non_existence.py +++ b/recipe/upload_or_check_non_existence.py @@ -12,20 +12,12 @@ import conda.config from conda.api import get_index from conda_build.metadata import MetaData -from conda_build.build import bldpkg_path -from conda_build.api import get_output_file_path -from conda_build.config import Config +try: + from conda_build.api import get_output_file_path +except ImportError: + from conda_build.build import bldpkg_path as get_output_file_path -def bldpkg_path_wrapper(meta): - try: - config = Config() - fname = get_output_file_path(meta, config) - except TypeError: - # conda-build < 2.0.0 takes a single config argument - fname = bldpkg_path(meta) - - return fname def built_distribution_already_exists(cli, meta, owner): """ @@ -34,7 +26,7 @@ def built_distribution_already_exists(cli, meta, owner): """ distro_name = '{}/{}.tar.bz2'.format(conda.config.subdir, meta.dist()) - fname = bldpkg_path_wrapper(meta) + fname = get_output_file_path(meta) try: dist_info = cli.distribution(owner, meta.name(), meta.version(), distro_name) @@ -62,7 +54,7 @@ def upload(cli, meta, owner, channels): with open('binstar.token', 'w') as fh: fh.write(cli.token) subprocess.check_call(['anaconda', '--quiet', '-t', 'binstar.token', - 'upload', bldpkg_path_wrapper(meta), + 'upload', get_output_file_path(meta), '--user={}'.format(owner), '--channel={}'.format(channels)], env=os.environ) @@ -128,14 +120,14 @@ def main(): on_channel = distribution_exists_on_channel(cli, meta, owner, channel) if not exists: upload(cli, meta, owner, channel) - print('Uploaded {}'.format(bldpkg_path_wrapper(meta))) + print('Uploaded {}'.format(get_output_file_path(meta))) elif not on_channel: print('Adding distribution {} to {}\'s {} channel' - ''.format(bldpkg_path_wrapper(meta), owner, channel)) + ''.format(get_output_file_path(meta), owner, channel)) add_distribution_to_channel(cli, meta, owner, channel) else: print('Distribution {} already \nexists on {}\'s {} channel.' - ''.format(bldpkg_path_wrapper(meta), owner, channel)) + ''.format(get_output_file_path(meta), owner, channel)) else: print("No BINSTAR_TOKEN present, so no upload is taking place. " "The distribution just built {} already available on {}'s " From 020127d1587eebc789b65c6a32cb057260a341b5 Mon Sep 17 00:00:00 2001 From: shadow_walker Date: Tue, 10 Jan 2017 23:56:21 -0600 Subject: [PATCH 4/4] trigger CI