@@ -684,8 +684,8 @@ def get_distribution(cls, ctx, name=None, recipes=[], allow_download=True,
684684 if force_build :
685685 continue
686686 if (set (dist .recipes ) == set (recipes ) or
687- (set (recipes ).issubset (set (dist .recipes ) and not require_perfect_match ) )):
688- info ('{} has exactly the right recipes, using this one' )
687+ (set (recipes ).issubset (set (dist .recipes )) and not require_perfect_match )):
688+ info ('{} has exactly the right recipes, using this one' . format ( dist . name ) )
689689 return dist
690690
691691 assert len (possible_dists ) < 2
@@ -894,33 +894,57 @@ def get_bootstrap(cls, name, ctx):
894894
895895
896896class Recipe (object ):
897- version = None
898897 url = None
898+ '''The address from which the recipe may be downloaded. This is not
899+ essential, it may be omitted if the source is available some other
900+ way, such as via the :class:`IncludedFilesBehaviour` mixin.
901+
902+ If the url includes the version, you may (and probably should)
903+ replace this with ``{version}``, which will automatically be
904+ replaced by the :attr:`version` string during download.
905+
906+ .. note:: Methods marked (internal) are used internally and you
907+ probably don't need to call them, but they are available
908+ if you want.
909+ '''
910+
911+ version = None
912+ '''A string giving the version of the software the recipe describes,
913+ e.g. ``2.0.3`` or ``master``.'''
914+
915+
899916 md5sum = None
917+ '''The md5sum of the source from the :attr:`url`. Non-essential, but
918+ you should try to include this, it is used to check that the download
919+ finished correctly.
920+ '''
921+
900922 depends = []
923+ '''A list containing the names of any recipes that this recipe depends on.
924+ '''
925+
901926 conflicts = []
902-
903- name = None # name for the recipe dir
927+ # AND: Not currently used
928+ '''A list containing the names of any recipes that are known to be
929+ incompatible with this one.'''
930+
931+ # name = None # name for the recipe dir
904932
905933 archs = ['armeabi' ] # will android use this?
906934
907- # library = None
908- # libraries = []
909- # include_dir = None
910- # include_per_arch = False
911- # frameworks = []
912- # sources = []
913935
914936 @property
915937 def versioned_url (self ):
938+ '''A property returning the url of the recipe with ``{version}``
939+ replaced by the :attr:`url`. If accessing the url, you should use this
940+ property, *not* access the url directly.'''
916941 if self .url is None :
917942 return None
918943 return self .url .format (version = self .version )
919944
920- # API available for recipes
921945 def download_file (self , url , filename , cwd = None ):
922946 """
923- Download an `url` to `outfn`
947+ (internal) Download an `` url`` to a ``filename``.
924948 """
925949 if not url :
926950 return
@@ -944,7 +968,7 @@ def report_hook(index, blksize, size):
944968
945969 def extract_file (self , filename , cwd ):
946970 """
947- Extract the `filename` into the directory `cwd`.
971+ (internal) Extract the `filename` into the directory `cwd`.
948972 """
949973 if not filename :
950974 return
@@ -961,7 +985,7 @@ def extract_file(self, filename, cwd):
961985 zf .close ()
962986
963987 else :
964- warning ("Error: cannot extract, unreconized extension for {}" .format (
988+ warning ("Error: cannot extract, unrecognized extension for {}" .format (
965989 filename ))
966990 raise Exception ()
967991
@@ -1206,25 +1230,25 @@ def get_recipe_env(self, arch=None):
12061230 # self.ctx.state[key] = value
12071231 # return value
12081232
1209- def execute (self ):
1210- if self .custom_dir :
1211- self .ctx .state .remove_all (self .name )
1212- self .download ()
1213- self .extract ()
1214- self .build_all ()
1233+ # def execute(self):
1234+ # if self.custom_dir:
1235+ # self.ctx.state.remove_all(self.name)
1236+ # self.download()
1237+ # self.extract()
1238+ # self.build_all()
12151239
12161240 # AND: Will need to change how this works
1217- @property
1218- def custom_dir (self ):
1219- """Check if there is a variable name to specify a custom version /
1220- directory to use instead of the current url.
1221- """
1222- d = environ .get ("P4A_{}_DIR" .format (self .name .lower ()))
1223- if not d :
1224- return
1225- if not exists (d ):
1226- return
1227- return d
1241+ # @property
1242+ # def custom_dir(self):
1243+ # """Check if there is a variable name to specify a custom version /
1244+ # directory to use instead of the current url.
1245+ # """
1246+ # d = environ.get("P4A_{}_DIR".format(self.name.lower()))
1247+ # if not d:
1248+ # return
1249+ # if not exists(d):
1250+ # return
1251+ # return d
12281252
12291253 # def prebuild(self):
12301254 # self.prebuild_arch(self.ctx.archs[0]) # AND: Need to change
@@ -1738,6 +1762,7 @@ def dist_from_args(ctx, dist_args):
17381762def split_argument_list (l ):
17391763 return re .split (r'[ ,]*' , l )
17401764
1765+
17411766class ToolchainCL (object ):
17421767 def __init__ (self ):
17431768 parser = argparse .ArgumentParser (
@@ -1926,13 +1951,14 @@ def create(self, args):
19261951
19271952 print ('dists are' , Distribution .get_distributions (ctx ))
19281953 dist = dist_from_args (ctx , self .dist_args )
1929- info ('Ready to create dist {}, contains recipes {}' .format (
1930- dist .name , ', ' .join (dist .recipes )))
19311954 if not dist .needs_build :
1932- info ('This dist already exists! If you dont\' t want to use '
1933- 'it, you must delete it and rebuild with the new set of '
1934- 'recipes, or create your new dist with a different name.' )
1955+ info ('You asked to create a distribution, but a dist with this name '
1956+ 'already exists. If you don\' t want to use '
1957+ 'it, you must delete it and rebuild, or create your '
1958+ 'new dist with a different name.' )
19351959 exit (1 )
1960+ info ('Ready to create dist {}, contains recipes {}' .format (
1961+ dist .name , ', ' .join (dist .recipes )))
19361962
19371963 bs = Bootstrap .get_bootstrap (args .bootstrap , ctx )
19381964 info_main ('# Creating dist with with {} bootstrap' .format (bs .name ))
0 commit comments