State container for information about a distribution (i.e. an Android project). This is separate from a Bootstrap because the Bootstrap is concerned with building and populating the dist directory, whereas the dist itself could also come from e.g. a binary download.
| 9 | |
| 10 | |
| 11 | class Distribution: |
| 12 | '''State container for information about a distribution (i.e. an |
| 13 | Android project). |
| 14 | |
| 15 | This is separate from a Bootstrap because the Bootstrap is |
| 16 | concerned with building and populating the dist directory, whereas |
| 17 | the dist itself could also come from e.g. a binary download. |
| 18 | ''' |
| 19 | ctx = None |
| 20 | |
| 21 | name = None # A name identifying the dist. May not be None. |
| 22 | needs_build = False # Whether the dist needs compiling |
| 23 | url = None |
| 24 | dist_dir = None # Where the dist dir ultimately is. Should not be None. |
| 25 | ndk_api = None |
| 26 | |
| 27 | archs = [] |
| 28 | '''The names of the arch targets that the dist is built for.''' |
| 29 | |
| 30 | recipes = [] |
| 31 | |
| 32 | description = '' # A long description |
| 33 | |
| 34 | def __init__(self, ctx): |
| 35 | self.ctx = ctx |
| 36 | |
| 37 | def __str__(self): |
| 38 | return '<Distribution: name {} with recipes ({})>'.format( |
| 39 | # self.name, ', '.join([recipe.name for recipe in self.recipes])) |
| 40 | self.name, ', '.join(self.recipes)) |
| 41 | |
| 42 | def __repr__(self): |
| 43 | return str(self) |
| 44 | |
| 45 | @classmethod |
| 46 | def get_distribution( |
| 47 | cls, |
| 48 | ctx, |
| 49 | *, |
| 50 | archs, # required keyword argument: there is no sensible default |
| 51 | name=None, |
| 52 | recipes=[], |
| 53 | ndk_api=None, |
| 54 | force_build=False, |
| 55 | extra_dist_dirs=[], |
| 56 | require_perfect_match=False, |
| 57 | allow_replace_dist=True |
| 58 | ): |
| 59 | '''Takes information about the distribution, and decides what kind of |
| 60 | distribution it will be. |
| 61 | |
| 62 | If parameters conflict (e.g. a dist with that name already |
| 63 | exists, but doesn't have the right set of recipes), |
| 64 | an error is thrown. |
| 65 | |
| 66 | Parameters |
| 67 | ---------- |
| 68 | name : str |
no outgoing calls