Skip to content

Commit 6beaaf3

Browse files
committed
Cleaned comments and unused content from toolchain
1 parent 91b6e07 commit 6beaaf3

File tree

1 file changed

+4
-94
lines changed

1 file changed

+4
-94
lines changed

pythonforandroid/toolchain.py

Lines changed: 4 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -522,21 +522,14 @@ def get_env(self):
522522
hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)
523523

524524
# AND: This hardcodes python version 2.7, needs fixing
525-
# AND: This also hardcodes armeabi, which isn't even correct,
526-
# don't forget to fix!
527525
env['BUILDLIB_PATH'] = join(
528526
hostpython_recipe.get_build_dir(self.arch),
529527
'build', 'lib.linux-{}-2.7'.format(uname()[-1]))
530528

531529
env['PATH'] = environ['PATH']
532530

533-
# AND: This stuff is set elsewhere in distribute.sh. Does that matter?
534531
env['ARCH'] = self.arch
535532

536-
# env['LIBLINK_PATH'] = join(
537-
# self.ctx.build_dir, 'other_builds', 'objects')
538-
# ensure_dir(env['LIBLINK_PATH']) # AND: This should be elsewhere
539-
540533
return env
541534

542535
class ArchARM(Arch):
@@ -917,8 +910,6 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
917910
'it with the SDK android tool.').format(android_api))
918911
warning('Exiting.')
919912
exit(1)
920-
# AND: If the android api target doesn't exist, we should
921-
# offer to install it here
922913

923914
# Find the Android NDK
924915
# Could also use ANDROID_NDK, but doesn't look like many tools use this
@@ -1080,8 +1071,6 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
10801071
toolchain_version=toolchain_version,
10811072
py_platform=py_platform, path=environ.get('PATH'))
10821073

1083-
# AND: Are these necessary? Where to check for and and ndk-build?
1084-
# check the basic tools
10851074
for executable in ("pkg-config", "autoconf", "automake", "libtoolize",
10861075
"tar", "bzip2", "unzip", "make", "gcc", "g++"):
10871076
if not sh.which(executable):
@@ -1165,7 +1154,6 @@ def get_site_packages_dir(self, arch=None):
11651154
def get_libs_dir(self, arch):
11661155
'''The libs dir for a given arch.'''
11671156
ensure_dir(join(self.libs_dir, arch))
1168-
# AND: See warning:
11691157
return join(self.libs_dir, arch)
11701158

11711159

@@ -1341,10 +1329,7 @@ def get_distributions(cls, ctx, extra_dist_dirs=[]):
13411329
with open(join(folder, 'dist_info.json')) as fileh:
13421330
dist_info = json.load(fileh)
13431331
dist = cls(ctx)
1344-
dist.name = folder.split('/')[-1] # AND: also equal to
1345-
# # dist_info['dist_name']
1346-
# # ... Which one should we
1347-
# # use?
1332+
dist.name = folder.split('/')[-1]
13481333
dist.dist_dir = folder
13491334
dist.needs_build = False
13501335
dist.recipes = dist_info['recipes']
@@ -1456,11 +1441,6 @@ def run_distribute(self):
14561441
'recipes': self.ctx.recipe_build_order},
14571442
fileh)
14581443

1459-
# AND: This method must be replaced by manual dir setting, in
1460-
# order to allow for user dirs
1461-
# def get_bootstrap_dir(self):
1462-
# return(dirname(__file__))
1463-
14641444
@classmethod
14651445
def list_bootstraps(cls):
14661446
'''Find all the available bootstraps and return them.'''
@@ -1932,7 +1912,6 @@ def unpack(self, arch):
19321912
filename = shprint(
19331913
sh.basename, self.versioned_url).stdout[:-1].decode('utf-8')
19341914

1935-
# AND: TODO: Use tito's better unpacking method
19361915
with current_directory(build_dir):
19371916
directory_name = self.get_build_dir(arch)
19381917

@@ -1992,46 +1971,6 @@ def get_recipe_env(self, arch=None):
19921971
arch = self.filtered_archs[0]
19931972
return arch.get_env()
19941973

1995-
# @property
1996-
# def archive_root(self):
1997-
# key = "{}.archive_root".format(self.name)
1998-
# value = self.ctx.state.get(key)
1999-
# if not key:
2000-
# value = self.get_archive_rootdir(self.archive_fn)
2001-
# self.ctx.state[key] = value
2002-
# return value
2003-
2004-
# def execute(self):
2005-
# if self.custom_dir:
2006-
# self.ctx.state.remove_all(self.name)
2007-
# self.download()
2008-
# self.extract()
2009-
# self.build_all()
2010-
2011-
# AND: Will need to change how this works
2012-
# @property
2013-
# def custom_dir(self):
2014-
# """Check if there is a variable name to specify a custom version /
2015-
# directory to use instead of the current url.
2016-
# """
2017-
# d = environ.get("P4A_{}_DIR".format(self.name.lower()))
2018-
# if not d:
2019-
# return
2020-
# if not exists(d):
2021-
# return
2022-
# return d
2023-
2024-
# def prebuild(self):
2025-
# self.prebuild_arch(self.ctx.archs[0]) # AND: Need to change
2026-
# # this to support
2027-
# # multiple archs
2028-
2029-
# def build(self):
2030-
# self.build_arch(self.ctx.archs[0]) # Same here!
2031-
2032-
# def postbuild(self):
2033-
# self.postbuild_arch(self.ctx.archs[0])
2034-
20351974
def prebuild_arch(self, arch):
20361975
'''Run any pre-build tasks for the Recipe. By default, this checks if
20371976
any prebuild_archname methods exist for the archname of the current
@@ -2047,7 +1986,6 @@ def should_build(self, arch):
20471986
building again.
20481987
20491988
'''
2050-
# AND: This should take arch as an argument!
20511989
return True
20521990

20531991
def build_arch(self, arch):
@@ -2212,9 +2150,6 @@ def hostpython_location(self):
22122150
return self.ctx.hostpython
22132151

22142152
def should_build(self, arch):
2215-
# AND: This should be different for each arch and use some
2216-
# kind of data store to know what has been built in a given
2217-
# python env
22182153
print('name is', self.site_packages_name, type(self))
22192154
name = self.site_packages_name
22202155
if name is None:
@@ -2273,12 +2208,7 @@ def build_arch(self, arch):
22732208
'''Build any cython components, then install the Python module by
22742209
calling setup.py install with the target Python dir.
22752210
'''
2276-
Recipe.build_arch(self, arch) # AND: Having to directly call the
2277-
# # method like this is nasty...could
2278-
# # use tito's method of having an
2279-
# # install method that always runs
2280-
# # after everything else but isn't
2281-
# # used by a normal recipe.
2211+
Recipe.build_arch(self, arch)
22822212
self.build_compiled_components(arch)
22832213
self.install_python_package(arch)
22842214

@@ -2302,17 +2232,11 @@ def build_arch(self, arch):
23022232
'''Build any cython components, then install the Python module by
23032233
calling setup.py install with the target Python dir.
23042234
'''
2305-
Recipe.build_arch(self, arch) # AND: Having to directly call the
2306-
# # method like this is nasty...could
2307-
# # use tito's method of having an
2308-
# # install method that always runs
2309-
# # after everything else but isn't
2310-
# # used by a normal recipe.
2235+
Recipe.build_arch(self, arch)
23112236
self.build_cython_components(arch)
23122237
self.install_python_package(arch)
23132238

23142239
def build_cython_components(self, arch):
2315-
# AND: Should we use tito's cythonize methods? How do they work?
23162240
info('Cythonizing anything necessary in {}'.format(self.name))
23172241
env = self.get_recipe_env(arch)
23182242
with current_directory(self.get_build_dir(arch.arch)):
@@ -2424,7 +2348,7 @@ def build_recipes(build_order, python_modules, ctx):
24242348
.format(recipe.name))
24252349

24262350
# 4) biglink everything
2427-
# AND: Should make this optional (could use
2351+
# AND: Should make this optional
24282352
info_main('# Biglinking object files')
24292353
biglink(ctx, arch)
24302354

@@ -2492,8 +2416,6 @@ def biglink(ctx, arch):
24922416
files.append(obj_dir)
24932417
shprint(sh.cp, '-r', *files)
24942418

2495-
# AND: Shouldn't hardcode Arch! In reality need separate
2496-
# build dirs for each arch
24972419
env = arch.get_env()
24982420
env['LDFLAGS'] = env['LDFLAGS'] + ' -L{}'.format(
24992421
join(ctx.bootstrap.build_dir, 'obj', 'local', arch.arch))
@@ -3039,18 +2961,6 @@ def clean_download_cache(self, args):
30392961
if exists(ctx.packages_path):
30402962
shutil.rmtree(ctx.packages_path)
30412963

3042-
# def status(self, args):
3043-
# parser = argparse.ArgumentParser(
3044-
# description="Give a status of the build")
3045-
# args = parser.parse_args(args)
3046-
# ctx = Context()
3047-
# # AND: TODO
3048-
3049-
# print('This isn\'t implemented yet, but should list all '
3050-
# 'currently existing distributions, the modules they '
3051-
# 'include, and all the build caches.')
3052-
# exit(1)
3053-
30542964
@require_prebuilt_dist
30552965
def export_dist(self, args):
30562966
'''Copies a created dist to an output dir.

0 commit comments

Comments
 (0)