Skip to content

Commit

Permalink
Merge pull request #8 from jjhelmus/dry_run
Browse files Browse the repository at this point in the history
Add --dry-run argument
  • Loading branch information
jakirkham authored Jun 18, 2017
2 parents e1e1683 + cf2572c commit ed4f103
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 11 additions & 2 deletions conda_build_all/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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):
"""
Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion conda_build_all/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down Expand Up @@ -86,7 +89,7 @@ def main():
inspection_directories,
artefact_destinations,
args.matrix_conditions,
max_n_versions)
max_n_versions, args.dry_run)
b.main()


Expand Down

0 comments on commit ed4f103

Please sign in to comment.