Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use conda-build=3 #5274

Merged
merged 22 commits into from
Apr 11, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ environment:

# Workaround for https://github.com/conda/conda-build/issues/636
PYTHONIOENCODING: "UTF-8"
CONDA_INSTALL_LOCN: "C:\\Miniconda36-x64"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to leave this as Miniconda3-x64 - that's a symlink to the current miniconda3 install on appveyor. It'll be better to keep up-to-date that way (fewer updates, potentially)


matrix:
- TARGET_ARCH: "x86"
CONDA_INSTALL_LOCN: "C:\\Miniconda36"
- PLATFORM: "32"

- TARGET_ARCH: "x64"
CONDA_INSTALL_LOCN: "C:\\Miniconda-x64"
- PLATFORM: "64"

artifacts:
# Store built conda packages as artifacts
Expand Down Expand Up @@ -48,15 +47,14 @@ install:
- cmd: conda config --set show_channel_urls true
- cmd: appveyor-retry conda update --yes --quiet conda

- cmd: appveyor-retry conda install --yes --quiet conda-build-all
- cmd: appveyor-retry conda install --yes --quiet conda-forge-build-setup
- cmd: appveyor-retry conda install --yes --quiet conda-forge-pinning conda-forge-ci-setup=1.* networkx
- cmd: appveyor-retry run_conda_forge_build_setup

# Skip .NET project specific build phase.
build: off

test_script:
- conda build-all recipes --matrix-conditions "numpy >=1.11" "python >=2.7,<3|>=3.5" "r-base ==3.3.2|==3.4.1"
- python .ci_support\build_all.py recipes --arch %PLATFORM%
# copy any newly created conda packages into the conda_packages dir
- cmd: mkdir conda_packages
# Uncomment the following two lines to make any conda packages created
Expand Down
55 changes: 55 additions & 0 deletions .ci_support/build_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import conda_build.conda_interface
import networkx as nx
import conda_build.api
from compute_build_graph import construct_graph
import argparse
import os

def build_all(recipes_dir, arch):
channel_urls=['local', 'conda-forge', 'defaults']
index = conda_build.conda_interface.get_index(channel_urls=channel_urls)
conda_resolve = conda_build.conda_interface.Resolve(index)

exclusive_config_file = os.path.join(conda_build.conda_interface.root_dir, 'conda_build_config.yaml')
platform = get_host_platform()
variant_config_files = []
if platform == 'win':
script_dir = os.path.dirname(os.path.realpath(__file__))
variant_config_files = [os.path.join(script_dir, 'win{}.yaml'.format(arch))]

config = conda_build.api.Config(variant_config_files=variant_config_files, arch=arch,
exclusive_config_file=exclusive_config_file,
channel_urls=channel_urls)

worker={'platform': platform, 'arch': arch, 'label': platform}

G = construct_graph(recipes_dir, worker=worker, run='build', conda_resolve=conda_resolve,
folders=os.listdir(recipes_dir), config=config)

order = list(nx.topological_sort(G))
order.reverse()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the build order reversed? (wouldn't this build the bottom of the graph first?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be that I build the graph backward when adding the nodes. I have considered going back and reversing it, but haven't found time. When I have tried, it ended up exploding in my face.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on how the edge direction is defined. reverse here gives the order that I need


print('Building packages')
print('\n'.join(order))

for node in order:
conda_build.api.build(G.node[node]['meta'])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msarahan, for building recipes with multiple outputs, what should I do? Get the recipe paths from the meta data above, put it into a OrderedSet and pass the path to conda_build.api.build

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's basically correct. It's the collapsing that happens in https://github.com/conda/conda-concourse-ci/blob/master/conda_concourse_ci/compute_build_graph.py#L274

It's not perfect, mind you. There are still some dependency relationships that are not properly handled. See anaconda-graveyard/conda-concourse-ci#69

It would be worth giving your proposal a try, to see how well it works. I suspect that there might be some crummy corner cases that mess things up, but your idea should work most of the time.



def get_host_platform():
from sys import platform
if platform == "linux" or platform == "linux2":
return "linux"
elif platform == "darwin":
return "osx"
elif platform == "win32":
return "win"


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('recipes_dir', default=os.getcwd(), help='Directory where the recipes are')
parser.add_argument('--arch', default='64', help='target architecture (64 or 32)')
args = parser.parse_args()
build_all(args.recipes_dir, args.arch)

Loading