-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Use conda-build=3 #5274
Changes from 8 commits
0187910
89fd608
6243d84
3974c84
e5900c7
74034b3
184c082
c64bac8
d58d275
75fadb5
1218a47
b4baa4c
4fe3032
a5d951c
75f3816
6a9b111
81b90c2
60177b7
6cbeae8
a2e7490
2c13096
542fe7e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
There was a problem hiding this comment.
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)