diff --git a/conda/migrate.py b/conda/migrate.py index 37ac8bf06997f7a45b40065755551cdd8f99a5e3..184b7abba7c6db108695ddee2dcbf173ac89a92d 100755 --- a/conda/migrate.py +++ b/conda/migrate.py @@ -11,6 +11,10 @@ from conda_build.variants import parse_config_file from conda_build.conda_interface import PY3 import os +RUN_EXPORTS = [ + ' - libblitz\n', +] + def extract_requirements_text(path): text = "" @@ -68,6 +72,14 @@ def add_variant(doc, star=True): return doc +def extract_section(text, first, last): + i1 = text.find(first) + i2 = text.find(last, i1) + if i1 == -1 or i2 == -1: + return -1, -1, '' + return i1, i2, text[i1 + len(first):i2] + + def migrate(template_recipe_path, old_recipe_path, build_variant_path, output_folder): config = Config() @@ -87,32 +99,36 @@ def migrate(template_recipe_path, old_recipe_path, build_variant_path, final_recipe = final_recipe.replace( ' <ENTRY_POINTS_TEST>\n', entry_points_test) requirements_text = extract_requirements_text(old_recipe_path) - already_build = ['- python\n', - '- setuptools\n', - '- python {{ python }}\n', - '- setuptools {{ setuptools }}\n', - '- toolchain {{ toolchain }}\n'] - i1 = requirements_text.find('build:\n') + 7 - i2 = requirements_text.find('run:\n') - build_text = requirements_text[i1:i2] - requires_compilers = 'toolchain' in build_text + i1, i2, build_text = extract_section( + requirements_text, 'build:\n', 'host:\n') + i1, i2, host_text = extract_section(requirements_text, 'host:\n', 'run:\n') + already_build = [ + '- python\n', + '- setuptools\n', + '- python {{ python }}\n', + '- setuptools {{ setuptools }}\n', + '- toolchain {{ toolchain }}\n', + "- {{ compiler('c') }}\n", + "- {{ compiler('cxx') }}\n", + ] + requires_compilers = 'toolchain' in host_text or build_text for line in already_build: - build_text = build_text.replace(line, '') - build_text = build_text.strip() - if build_text: - build_text = ' ' + build_text + '\n' - build_text = add_variant(build_text, star=False) - final_recipe = final_recipe.replace(' <HOST_DEPS>\n', build_text) + host_text = host_text.replace(line, '') + host_text = host_text.strip() + if host_text: + host_text = ' ' + host_text + '\n' + host_text = add_variant(host_text, star=False) + final_recipe = final_recipe.replace(' <HOST_DEPS>\n', host_text) if requires_compilers: final_recipe = final_recipe.replace(' <BUILD_DEPS>\n', ''' build: - - {{ compiler('c')}} - - {{ compiler('cxx')}} + - {{ compiler('c')}} + - {{ compiler('cxx')}} ''') else: final_recipe = final_recipe.replace(' <BUILD_DEPS>\n', '') run_text = requirements_text[i2 + 5:] - for line in already_build[:2]: + for line in already_build[:2] + RUN_EXPORTS: run_text = run_text.replace(line, '') run_text = run_text.strip() run_text = ' ' + run_text + '\n' if run_text else run_text @@ -128,6 +144,9 @@ def migrate(template_recipe_path, old_recipe_path, build_variant_path, if test_requires: test_requires = ' ' + test_requires + '\n' test_requires = add_variant(test_requires) + if recipe.name() == 'bob.buildout': + final_recipe = final_recipe.replace( + ' - bob-devel {{ bob_devel }}.*\n', '') final_recipe = final_recipe.replace( ' <TEST_DEPS>\n', test_requires) final_recipe = final_recipe.replace( diff --git a/conda/migrate.sh b/conda/migrate.sh index 66512dd222c7d12d82793c26424044e97c337049..99142af81e45eab7c5bf3cd2ef825273bd274dd9 100755 --- a/conda/migrate.sh +++ b/conda/migrate.sh @@ -46,6 +46,7 @@ bob.ip.flandmark \ echo "record.txt" >> .gitignore subl conda/meta.yaml + export BOB_PACKAGE_VERSION=`cat version.txt | tr -d '\n'` conda build -m ../../gitlab/conda_build_config.yaml --python=2.7 conda git add -A diff --git a/gitlab/conda_build_config.yaml b/gitlab/conda_build_config.yaml index 7e8ba9b2e87f580cc0fd798487b2089120298cab..58c91c02f180f039f365720281b1ae41a7769faa 100644 --- a/gitlab/conda_build_config.yaml +++ b/gitlab/conda_build_config.yaml @@ -42,6 +42,8 @@ zip_keys: # expected in our conda build process. # Ideally we want to build and test against older versions of dependencies. # Most of the pin numbers come from the anaconda package. +bob_devel: + - 2018.01.16 ## the dependencies that we build against multiple versions # we build for an old version of numpy for forward compatibility diff --git a/templates/meta.yaml b/templates/meta.yaml index 58407caa9c41eac98ac02b854befb7531c136eef..c0ae4772e909dcc5304c041ec92e99c042a42a23 100644 --- a/templates/meta.yaml +++ b/templates/meta.yaml @@ -39,6 +39,7 @@ test: - conda inspect linkages -p $PREFIX {{ name }} # [not win] - conda inspect objects -p $PREFIX {{ name }} # [osx] requires: + - bob-devel {{ bob_devel }}.* - nose {{ nose }}.* - coverage {{ coverage }}.* - sphinx {{ sphinx }}.*