From 7c05e50ca77e4fff0388e6554800f470c1211d5b Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Sun, 3 May 2020 11:50:34 +0200 Subject: [PATCH] Do not build known broken recipes Recipes known to be broken should be part of `BROKEN_RECIPES` and have a dedicated issue. Demonstrates with `distribute` recipe that was modified but will be skipped. Refs: #466, #467 and #468 --- .ci/constants.py | 19 +++++++++++++++++++ .ci/rebuild_updated_recipes.py | 33 ++++++++++++++++++++++++++------- recipes/distribute/__init__.py | 1 - 3 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 .ci/constants.py diff --git a/.ci/constants.py b/.ci/constants.py new file mode 100644 index 0000000..a004dcb --- /dev/null +++ b/.ci/constants.py @@ -0,0 +1,19 @@ +BROKEN_RECIPES = set( + [ + # no attribute 'SourceFileLoader' + # https://github.com/kivy/kivy-ios/issues/466 + "distribute", + # 'distutils.core' is not a package + # https://github.com/kivy/kivy-ios/issues/467 + "markupsafe", + # depends on markupsafe + # https://github.com/kivy/kivy-ios/issues/466 + "jinja2", + # bad install directory or PYTHONPATH + # https://github.com/kivy/kivy-ios/issues/468 + "werkzeug", + ] +) + +# recipes that were already built will be skipped +CORE_RECIPES = set(["kivy", "hostpython3", "python3"]) diff --git a/.ci/rebuild_updated_recipes.py b/.ci/rebuild_updated_recipes.py index 5018464..fbf3d9c 100644 --- a/.ci/rebuild_updated_recipes.py +++ b/.ci/rebuild_updated_recipes.py @@ -1,9 +1,19 @@ +#!/usr/bin/env python +""" +Continuous Integration helper script. +Automatically detects recipes modified in a changeset (compares with master) +and recompiles them. + +Current limitations: +- will fail on conflicting requirements +""" import sh import subprocess from fnmatch import fnmatch +from constants import CORE_RECIPES, BROKEN_RECIPES -def modified_recipes(branch='origin/master'): +def modified_recipes(branch="origin/master"): """ Returns a set of modified recipes between the current branch and the one in param. @@ -12,18 +22,27 @@ def modified_recipes(branch='origin/master'): # with a bunch of fixes, e.g. disabled TTY, see: # https://stackoverflow.com/a/20128598/185510 sh.contrib.git.fetch("origin", "master") - git_diff = sh.contrib.git.diff('--name-only', branch) + git_diff = sh.contrib.git.diff("--name-only", branch) recipes = set() for file_path in git_diff: if fnmatch(file_path, "recipes/*/__init__.py\n"): - recipe = file_path.split('/')[1] + recipe = file_path.split("/")[1] recipes.add(recipe) return recipes -if __name__ == "__main__": - updated_recipes = " ".join(modified_recipes()) - if updated_recipes != '': - subprocess.run(f"python3 toolchain.py build {updated_recipes}", shell=True, check=True) +def main(): + recipes = modified_recipes() + recipes -= CORE_RECIPES + recipes -= BROKEN_RECIPES + updated_recipes = " ".join(recipes) + if updated_recipes != "": + subprocess.run( + f"python3 toolchain.py build {updated_recipes}", shell=True, check=True + ) else: print("Nothing to do. No updated recipes.") + + +if __name__ == "__main__": + main() diff --git a/recipes/distribute/__init__.py b/recipes/distribute/__init__.py index 469855f..fad28b6 100644 --- a/recipes/distribute/__init__.py +++ b/recipes/distribute/__init__.py @@ -6,7 +6,6 @@ import os class DistributeRecipe(PythonRecipe): version = "0.7.3" - # url = "https://github.com/mitsuhiko/click/archive/{version}.zip" url = "https://pypi.python.org/packages/source/d/distribute/distribute-{version}.zip" depends = ["python"]