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
This commit is contained in:
Andre Miras 2020-05-03 11:50:34 +02:00
parent b7f5893066
commit 7c05e50ca7
3 changed files with 45 additions and 8 deletions

19
.ci/constants.py Normal file
View file

@ -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"])

View file

@ -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()

View file

@ -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"]