From cf2572ce2f74c8a14d03886d7d7f7be901b9c3cf Mon Sep 17 00:00:00 2001 From: Jonathan Helmus Date: Sat, 17 Jun 2017 11:27:38 -0500 Subject: [PATCH] Add --dry-run argument The --dry-run argument can be used to list what distributions would be built without actually performing the builds. --- conda_build_all/builder.py | 13 +++++++++++-- conda_build_all/cli.py | 5 ++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/conda_build_all/builder.py b/conda_build_all/builder.py index e4a0872..f677179 100644 --- a/conda_build_all/builder.py +++ b/conda_build_all/builder.py @@ -129,7 +129,8 @@ class Builder(object): def __init__(self, conda_recipes_directory, inspection_channels, inspection_directories, artefact_destinations, - matrix_conditions, matrix_max_n_major_minor_versions=(2, 2)): + matrix_conditions, matrix_max_n_major_minor_versions=(2, 2), + dry_run=False): """ Build a directory of conda recipes sequentially, if they don't already exist in the inspection locations. @@ -149,6 +150,9 @@ def __init__(self, conda_recipes_directory, The number of major and minor versions to preserve for each resolved recipe. For instance, if a recipe can be built against np 1.7, 1.8 and 1.9, and the number of minor versions is 2, the build matrix will prune the 1.7 option. + dry_run : bool + True to stop before building recipes but after determining which + recipes to build. """ self.conda_recipes_directory = conda_recipes_directory @@ -157,6 +161,7 @@ def __init__(self, conda_recipes_directory, self.artefact_destinations = artefact_destinations self.matrix_conditions = matrix_conditions self.matrix_max_n_major_minor_versions = matrix_max_n_major_minor_versions + self.dry_run = dry_run def fetch_all_metas(self, config): """ @@ -242,7 +247,7 @@ def main(self): build_config = conda_build.config.config # If it is not already defined with environment variables, we set the CONDA_NPY - # to the latest possible value. Since we compute a build matrix anyway, this is + # to the latest possible value. Since we compute a build matrix anyway, this is # useful to prevent conda-build bailing if the recipe depends on it (e.g. # ``numpy x.x``), and to ensure that recipes that don't care which version they want # at build/test time get a sensible version. @@ -265,6 +270,10 @@ def main(self): '\n\t'.join(['{} (will be built: {})'.format(meta.dist(), dist_locn is None) for meta, dist_locn in recipes_and_dist_locn]))) + if self.dry_run: + print('Dry run: no distributions built') + return + for meta, built_dist_location in recipes_and_dist_locn: was_built = built_dist_location is None if was_built: diff --git a/conda_build_all/cli.py b/conda_build_all/cli.py index 33fb93c..e8940c9 100644 --- a/conda_build_all/cli.py +++ b/conda_build_all/cli.py @@ -28,6 +28,9 @@ def main(): parser.add_argument('--no-inspect-conda-bld-directory', default=False, action='store_true', help='Do not add the conda-build directory to the inspection list.') + parser.add_argument('--dry-run', default=False, + action='store_true', + help='Skip all builds, just list what distribution would be built.') parser.add_argument('--artefact-directory', help='A directory for any newly built distributions to be placed.') @@ -86,7 +89,7 @@ def main(): inspection_directories, artefact_destinations, args.matrix_conditions, - max_n_versions) + max_n_versions, args.dry_run) b.main()