@@ -1291,6 +1291,7 @@ def append_file(self, filename, dest):
1291
1291
1292
1292
@property
1293
1293
def name (self ):
1294
+ '''The name of the recipe, the same as the folder containing it.'''
1294
1295
modname = self .__class__ .__module__
1295
1296
return modname .split ("." , 2 )[- 1 ]
1296
1297
@@ -1335,7 +1336,7 @@ def ensure_build_container_dir(self):
1335
1336
1336
1337
build_dir = self .get_build_container_dir ('armeabi' )
1337
1338
ensure_dir (build_dir )
1338
-
1339
+
1339
1340
def download_if_necessary (self ):
1340
1341
info_main ('Downloading {}' .format (self .name ))
1341
1342
user_dir = environ .get ('P4A_{}_DIR' .format (self .name .lower ()))
@@ -1344,7 +1345,7 @@ def download_if_necessary(self):
1344
1345
self .name , self .name ))
1345
1346
return
1346
1347
self .download ()
1347
-
1348
+
1348
1349
def download (self ):
1349
1350
if self .url is None :
1350
1351
info ('Skipping {} download as no URL is set' .format (self .name ))
@@ -1450,10 +1451,10 @@ def unpack(self, arch):
1450
1451
else :
1451
1452
raise Exception ('Could not extract {} download, it must be .zip, '
1452
1453
'.tar.gz or .tar.bz2' )
1453
-
1454
+
1454
1455
else :
1455
1456
info ('{} is already unpacked, skipping' .format (self .name ))
1456
-
1457
+
1457
1458
1458
1459
def get_recipe_env (self , arch = None ):
1459
1460
"""Return the env specialized for the recipe
@@ -1503,6 +1504,9 @@ def get_recipe_env(self, arch=None):
1503
1504
# self.postbuild_arch(self.ctx.archs[0])
1504
1505
1505
1506
def prebuild_arch (self , arch ):
1507
+ '''Run any pre-build tasks for the Recipe. By default, this checks if
1508
+ any prebuild_archname methods exist for the archname of the current
1509
+ architecture, and runs them if so.'''
1506
1510
prebuild = "prebuild_{}" .format (arch .arch )
1507
1511
if hasattr (self , prebuild ):
1508
1512
getattr (self , prebuild )()
@@ -1518,11 +1522,18 @@ def should_build(self):
1518
1522
return True
1519
1523
1520
1524
def build_arch (self , arch ):
1525
+ '''Run any build tasks for the Recipe. By default, this checks if
1526
+ any build_archname methods exist for the archname of the current
1527
+ architecture, and runs them if so.'''
1521
1528
build = "build_{}" .format (arch .arch )
1522
1529
if hasattr (self , build ):
1523
1530
getattr (self , build )()
1524
1531
1525
1532
def postbuild_arch (self , arch ):
1533
+ '''Run any post-build tasks for the Recipe. By default, this checks if
1534
+ any postbuild_archname methods exist for the archname of the
1535
+ current architecture, and runs them if so.
1536
+ '''
1526
1537
postbuild = "postbuild_{}" .format (arch .arch )
1527
1538
if hasattr (self , postbuild ):
1528
1539
getattr (self , postbuild )()
@@ -1548,6 +1559,7 @@ def list_recipes(cls):
1548
1559
1549
1560
@classmethod
1550
1561
def get_recipe (cls , name , ctx ):
1562
+ '''Returns the Recipe with the given name, if it exists.'''
1551
1563
if not hasattr (cls , "recipes" ):
1552
1564
cls .recipes = {}
1553
1565
if name in cls .recipes :
@@ -1628,7 +1640,6 @@ def should_build(self):
1628
1640
if exists (join (self .ctx .get_site_packages_dir (), name )):
1629
1641
info ('Python package already exists in site-packages' )
1630
1642
return False
1631
- print ('site packages' , self .ctx .get_site_packages_dir ())
1632
1643
info ('{} apparently isn\' t already in site-packages' .format (name ))
1633
1644
return True
1634
1645
@@ -1660,43 +1671,6 @@ def install_python_package(self, name=None, env=None, is_dir=True):
1660
1671
1661
1672
shprint (hostpython , 'setup.py' , 'install' , '-O2' , _env = env )
1662
1673
1663
- # def install_python_package(self, name=None, env=None, is_dir=True):
1664
- # """Automate the installation of a Python package into the target
1665
- # site-packages.
1666
-
1667
- # It will works with the first filtered_archs, and the name of the recipe.
1668
- # """
1669
- # arch = self.filtered_archs[0]
1670
- # if name is None:
1671
- # name = self.name
1672
- # if env is None:
1673
- # env = self.get_recipe_env(arch)
1674
-
1675
- # print("Install {} into the site-packages".format(name))
1676
- # build_dir = self.get_build_dir(arch.arch)
1677
- # chdir(build_dir)
1678
- # hostpython = sh.Command(self.ctx.hostpython)
1679
- # iosbuild = join(build_dir, "iosbuild")
1680
- # shprint(hostpython, "setup.py", "install", "-O2",
1681
- # "--prefix", iosbuild,
1682
- # _env=env)
1683
- # dest_dir = join(self.ctx.site_packages_dir, name)
1684
- # if is_dir:
1685
- # if exists(dest_dir):
1686
- # shutil.rmtree(dest_dir)
1687
- # func = shutil.copytree
1688
- # else:
1689
- # func = shutil.copy
1690
- # func(
1691
- # join(iosbuild, "lib",
1692
- # self.ctx.python_ver_dir, "site-packages", name),
1693
- # dest_dir)
1694
-
1695
- # def reduce_python_package(self):
1696
- # """Feel free to remove things you don't want in the final
1697
- # site-packages.
1698
- # """
1699
- # pass
1700
1674
1701
1675
class CompiledComponentsPythonRecipe (PythonRecipe ):
1702
1676
pre_build_ext = False
0 commit comments