@@ -729,20 +729,14 @@ class PythonRecipe(Recipe):
729
729
730
730
depends = [('python2' , 'python3' )]
731
731
'''
732
- .. note:: it's important to keep this depends as a class attribute, outside
733
- `__init__` because, sometimes, we only initialize the object, so
734
- the `__init__` call it won't be called, which will lead to not
735
- have the python versions as a dependencies and it will cause a
736
- tremendous `test_graph` error (difficult to track) and also, the
737
- build order for dependencies will not be computed as expected (if
738
- computed...). So be very careful with this line!!
739
-
740
- .. warning:: this `depends` may be overwrote in inherited classes of
741
- `PythonRecipe`, so we make sure that any sub class will
742
- contain python as a dependency. We do this by checking the
743
- dependencies in meth:`PythonRecipe.__init__` method and adding
744
- them again in case that is necessary, so don't forget to call
745
- `super` in any inherited class of this class.
732
+ .. note:: it's important to keep this depends as a class attribute outside
733
+ `__init__` because sometimes we only initialize the class, so the
734
+ `__init__` call won't be called and the deps would be missing
735
+ (which breaks the dependency graph computation)
736
+
737
+ .. warning:: don't forget to call `super().__init__()` in any recipe's
738
+ `__init__`, or otherwise it may not be ensured that it depends
739
+ on python2 or python3 which can break the dependency graph
746
740
'''
747
741
748
742
def __init__ (self , * args , ** kwargs ):
@@ -754,11 +748,10 @@ def __init__(self, *args, **kwargs):
754
748
if d in self .depends
755
749
]
756
750
):
757
- # we overwrote `depends` in inherited recipe, so we must add it
758
- # again the python versions as dependencies, but we only do this in
759
- # case that the sub classes recipe does not contain any python
760
- # version as dependency because it may be some recipes only
761
- # compatible with a single version of python
751
+ # We ensure here that the recipe depends on python even it overrode
752
+ # `depends`. We only do this if it doesn't already depend on any
753
+ # python, since some recipes intentionally don't depend on/work
754
+ # with all python variants
762
755
depends = self .depends
763
756
depends .append (('python2' , 'python3' ))
764
757
depends = list (set (depends ))
0 commit comments