Skip to content

Commit b9478f7

Browse files
committed
Checked and mostly removed many old debug comments
1 parent 9242bea commit b9478f7

File tree

16 files changed

+17
-74
lines changed

16 files changed

+17
-74
lines changed

pythonforandroid/archs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def get_env(self, with_flags_in_cc=True):
121121

122122
hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)
123123

124-
# AND: This hardcodes python version 2.7, needs fixing
124+
# This hardcodes python version 2.7, needs fixing
125125
env['BUILDLIB_PATH'] = join(
126126
hostpython_recipe.get_build_dir(self.arch),
127127
'build', 'lib.linux-{}-2.7'.format(uname()[-1]))

pythonforandroid/bootstrap.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ def get_bootstrap(cls, name, ctx):
178178
This is the only way you should access a bootstrap class, as
179179
it sets the bootstrap directory correctly.
180180
'''
181-
# AND: This method will need to check user dirs, and access
182-
# bootstraps in a slightly different way
183181
if name is None:
184182
return None
185183
if not hasattr(cls, 'bootstraps'):

pythonforandroid/bootstraps/pygame/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def run_distribute(self):
4646

4747
info('Copying python distribution')
4848
hostpython = sh.Command(self.ctx.hostpython)
49-
# AND: This *doesn't* need to be in arm env?
5049
try:
5150
shprint(hostpython, '-OO', '-m', 'compileall', self.ctx.get_python_install_dir(),
5251
_tail=10, _filterout="^Listing")
@@ -64,7 +63,6 @@ def run_distribute(self):
6463
shprint(sh.cp, '-a', join('python-install', 'lib'), 'private')
6564
shprint(sh.mkdir, '-p', join('private', 'include', 'python2.7'))
6665

67-
# AND: Copylibs stuff should go here
6866
shprint(sh.mv, join('libs', arch.arch, 'libpymodules.so'), 'private/')
6967
shprint(sh.cp, join('python-install', 'include' , 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/'))
7068

pythonforandroid/bootstraps/sdl2/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def run_distribute(self):
6969
shprint(sh.mkdir, "-p",
7070
join("private", "include", "python2.7"))
7171

72-
# AND: Copylibs stuff should go here
7372
libpymodules_fn = join("libs", arch.arch, "libpymodules.so")
7473
if exists(libpymodules_fn):
7574
shprint(sh.mv, libpymodules_fn, 'private/')

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ def make_package(args):
237237
# construct a python27.zip
238238
make_python_zip()
239239

240-
# Package up the private and public data.
241-
# AND: Just private for now
240+
# Package up the private data (public not supported).
242241
tar_dirs = [args.private]
243242
if exists('private'):
244243
tar_dirs.append('private')

pythonforandroid/bootstraps/service_only/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def run_distribute(self):
6161
shprint(sh.cp, '-a', join('python-install', 'lib'), 'private')
6262
shprint(sh.mkdir, '-p', join('private', 'include', 'python2.7'))
6363

64-
# AND: Copylibs stuff should go here
6564
if exists(join('libs', arch.arch, 'libpymodules.so')):
6665
shprint(sh.mv, join('libs', arch.arch, 'libpymodules.so'), 'private/')
6766
shprint(sh.cp, join('python-install', 'include', 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/'))

pythonforandroid/bootstraps/service_only/build/build.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
# pyc/py
4141
'*.pyc',
42-
# '*.py', # AND: Need to fix this to add it back
42+
# '*.py',
4343

4444
# temp files
4545
'~',
@@ -204,7 +204,7 @@ def compile_dir(dfn):
204204
Compile *.py in directory `dfn` to *.pyo
205205
'''
206206

207-
return # AND: Currently leaving out the compile to pyo step because it's somehow broken
207+
return # Currently leaving out the compile to pyo step because it's somehow broken
208208
# -OO = strip docstrings
209209
subprocess.call([PYTHON, '-OO', '-m', 'compileall', '-f', dfn])
210210

@@ -230,8 +230,7 @@ def make_package(args):
230230
# construct a python27.zip
231231
make_python_zip()
232232

233-
# Package up the private and public data.
234-
# AND: Just private for now
233+
# Package up the private data (public not supported).
235234
tar_dirs = [args.private]
236235
if exists('private'):
237236
tar_dirs.append('private')

pythonforandroid/bootstraps/webview/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def run_distribute(self):
5757
shprint(sh.cp, '-a', join('python-install', 'lib'), 'private')
5858
shprint(sh.mkdir, '-p', join('private', 'include', 'python2.7'))
5959

60-
# AND: Copylibs stuff should go here
6160
if exists(join('libs', arch.arch, 'libpymodules.so')):
6261
shprint(sh.mv, join('libs', arch.arch, 'libpymodules.so'), 'private/')
6362
shprint(sh.cp, join('python-install', 'include' , 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/'))

pythonforandroid/bootstraps/webview/build/build.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# pyc/py
4040
'*.pyc',
41-
# '*.py', # AND: Need to fix this to add it back
41+
# '*.py',
4242

4343
# temp files
4444
'~',
@@ -203,7 +203,7 @@ def compile_dir(dfn):
203203
Compile *.py in directory `dfn` to *.pyo
204204
'''
205205

206-
return # AND: Currently leaving out the compile to pyo step because it's somehow broken
206+
return # Currently leaving out the compile to pyo step because it's somehow broken
207207
# -OO = strip docstrings
208208
subprocess.call([PYTHON, '-OO', '-m', 'compileall', '-f', dfn])
209209

@@ -229,8 +229,7 @@ def make_package(args):
229229
# construct a python27.zip
230230
make_python_zip()
231231

232-
# Package up the private and public data.
233-
# AND: Just private for now
232+
# Package up the private data (public not supported).
234233
tar_dirs = [args.private]
235234
if exists('private'):
236235
tar_dirs.append('private')

pythonforandroid/build.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
173173
if self._build_env_prepared:
174174
return
175175

176-
# AND: This needs revamping to carefully check each dependency
177-
# in turn
178176
ok = True
179177

180178
# Work out where the Android SDK is
@@ -186,7 +184,7 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
186184
if sdk_dir is None: # This seems used more conventionally
187185
sdk_dir = environ.get('ANDROID_HOME', None)
188186
if sdk_dir is None: # Checks in the buildozer SDK dir, useful
189-
# # for debug tests of p4a
187+
# for debug tests of p4a
190188
possible_dirs = glob.glob(expanduser(join(
191189
'~', '.buildozer', 'android', 'platform', 'android-sdk-*')))
192190
possible_dirs = [d for d in possible_dirs if not
@@ -325,8 +323,9 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
325323
warning('If the NDK dir result is correct, you don\'t '
326324
'need to manually set the NDK ver.')
327325
if ndk_ver is None:
328-
warning('Android NDK version could not be found, exiting.')
329-
exit(1)
326+
warning('Android NDK version could not be found. This probably'
327+
'won\'t cause any problems, but if necessary you can'
328+
'set it with `--ndk-version=...`.')
330329
self.ndk_ver = ndk_ver
331330

332331
info('Using {} NDK {}'.format(self.ndk.capitalize(), self.ndk_ver))
@@ -361,7 +360,7 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
361360
ok = False
362361
warning("Missing requirement: cython is not installed")
363362

364-
# AND: need to change if supporting multiple archs at once
363+
# This would need to be changed if supporting multiarch APKs
365364
arch = self.archs[0]
366365
platform_dir = arch.platform_dir
367366
toolchain_prefix = arch.toolchain_prefix
@@ -498,7 +497,7 @@ def get_site_packages_dir(self, arch=None):
498497
dir.
499498
'''
500499

501-
# AND: This *must* be replaced with something more general in
500+
# This needs to be replaced with something more general in
502501
# order to support multiple python versions and/or multiple
503502
# archs.
504503
if self.python_recipe.from_crystax:
@@ -577,7 +576,6 @@ def build_recipes(build_order, python_modules, ctx):
577576
.format(recipe.name))
578577

579578
# 4) biglink everything
580-
# AND: Should make this optional
581579
info_main('# Biglinking object files')
582580
if not ctx.python_recipe or not ctx.python_recipe.from_crystax:
583581
biglink(ctx, arch)

pythonforandroid/distribution.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ def get_distribution(cls, ctx, name=None, recipes=[],
7070
correct set of recipes.
7171
'''
7272

73-
# AND: This whole function is a bit hacky, it needs checking
74-
# properly to make sure it follows logically correct
75-
# possibilities
76-
7773
existing_dists = Distribution.get_distributions(ctx)
7874

7975
needs_build = True # whether the dist needs building, will be returned

pythonforandroid/recipe.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ def get_build_dir(self, arch):
329329
return join(self.get_build_container_dir(arch), self.name)
330330

331331
def get_recipe_dir(self):
332-
# AND: Redundant, an equivalent property is already set by get_recipe
333332
return join(self.ctx.root_dir, 'recipes', self.name)
334333

335334
# Public Recipe API to be subclassed if needed
@@ -404,8 +403,6 @@ def unpack(self, arch):
404403
if user_dir is not None:
405404
info('P4A_{}_DIR exists, symlinking instead'.format(
406405
self.name.lower()))
407-
# AND: Currently there's something wrong if I use ln, fix this
408-
warning('Using cp -a instead of symlink...fix this!')
409406
if exists(self.get_build_dir(arch)):
410407
return
411408
shprint(sh.rm, '-rf', build_dir)
@@ -425,7 +422,6 @@ def unpack(self, arch):
425422
with current_directory(build_dir):
426423
directory_name = self.get_build_dir(arch)
427424

428-
# AND: Could use tito's get_archive_rootdir here
429425
if not exists(directory_name) or not isdir(directory_name):
430426
extraction_filename = join(
431427
self.ctx.packages_path, self.name, filename)
@@ -820,26 +816,11 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
820816

821817

822818
if self.ctx.python_recipe.from_crystax:
823-
# hppath = join(dirname(self.hostpython_location), 'Lib',
824-
# 'site-packages')
825819
hpenv = env.copy()
826-
# if 'PYTHONPATH' in hpenv:
827-
# hpenv['PYTHONPATH'] = ':'.join([hppath] +
828-
# hpenv['PYTHONPATH'].split(':'))
829-
# else:
830-
# hpenv['PYTHONPATH'] = hppath
831-
# hpenv['PYTHONHOME'] = self.ctx.get_python_install_dir()
832-
# shprint(hostpython, 'setup.py', 'build',
833-
# _env=hpenv, *self.setup_extra_args)
834820
shprint(hostpython, 'setup.py', 'install', '-O2',
835821
'--root={}'.format(self.ctx.get_python_install_dir()),
836822
'--install-lib=.',
837-
# AND: will need to unhardcode the 3.5 when adding 2.7 (and other crystax supported versions)
838823
_env=hpenv, *self.setup_extra_args)
839-
# site_packages_dir = self.ctx.get_site_packages_dir()
840-
# built_files = glob.glob(join('build', 'lib*', '*'))
841-
# for filen in built_files:
842-
# shprint(sh.cp, '-r', filen, join(site_packages_dir, split(filen)[-1]))
843824
elif self.call_hostpython_via_targetpython:
844825
shprint(hostpython, 'setup.py', 'install', '-O2', _env=env,
845826
*self.setup_extra_args)
@@ -856,7 +837,6 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
856837
'--root={}'.format(self.ctx.get_python_install_dir()),
857838
'--install-lib=lib/python2.7/site-packages',
858839
_env=hpenv, *self.setup_extra_args)
859-
# AND: Hardcoded python2.7 needs fixing
860840

861841
# If asked, also install in the hostpython build dir
862842
if self.install_in_hostpython:

pythonforandroid/recipes/numpy/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class NumpyRecipe(CompiledComponentsPythonRecipe):
1818
def prebuild_arch(self, arch):
1919
super(NumpyRecipe, self).prebuild_arch(arch)
2020

21-
# AND: Fix this warning!
2221
warning('Numpy is built assuming the archiver name is '
2322
'arm-linux-androideabi-ar, which may not always be true!')
2423

pythonforandroid/recipes/pygame/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
from pythonforandroid.recipe import Recipe
33
from pythonforandroid.util import current_directory, ensure_dir
4-
from pythonforandroid.logger import debug, shprint, info
4+
from pythonforandroid.logger import debug, shprint, info, warning
55
from os.path import exists, join
66
import sh
77
import glob
@@ -39,8 +39,6 @@ def prebuild_arch(self, arch):
3939
join(self.get_build_dir(arch.arch), 'Setup'))
4040

4141
def build_arch(self, arch):
42-
# AND: I'm going to ignore any extra pythonrecipe or cythonrecipe behaviour for now
43-
4442
env = self.get_recipe_env(arch)
4543

4644
env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/png -I{jni_path}/jpeg'.format(
@@ -71,8 +69,7 @@ def build_arch(self, arch):
7169
env['STRIP'], '{}', ';')
7270

7371
python_install_path = join(self.ctx.build_dir, 'python-install')
74-
# AND: Should do some deleting here!
75-
print('Should remove pygame tests etc. here, but skipping for now')
72+
warning('Should remove pygame tests etc. here, but skipping for now')
7673

7774

7875
recipe = PygameRecipe()

pythonforandroid/recipes/python2/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ def do_python_build(self, arch):
8383

8484
env = arch.get_env()
8585

86-
# AND: Should probably move these to get_recipe_env for
87-
# neatness, but the whole recipe needs tidying along these
88-
# lines
8986
env['HOSTARCH'] = 'arm-eabi'
9087
env['BUILDARCH'] = shprint(sh.gcc, '-dumpmachine').stdout.decode('utf-8').split('\n')[0]
9188
env['CFLAGS'] = ' '.join([env['CFLAGS'], '-DNO_MALLINFO'])
@@ -114,7 +111,6 @@ def do_python_build(self, arch):
114111
# NDK has langinfo.h but doesn't define nl_langinfo()
115112
env['ac_cv_header_langinfo_h'] = 'no'
116113
configure = sh.Command('./configure')
117-
# AND: OFLAG isn't actually set, should it be?
118114
shprint(configure,
119115
'--host={}'.format(env['HOSTARCH']),
120116
'--build={}'.format(env['BUILDARCH']),
@@ -125,7 +121,7 @@ def do_python_build(self, arch):
125121
'--disable-framework',
126122
_env=env)
127123

128-
# AND: tito left this comment in the original source. It's still true!
124+
# tito left this comment in the original source. It's still true!
129125
# FIXME, the first time, we got a error at:
130126
# python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
131127
# /home/tito/code/python-for-android/build/python/Python-2.7.2/python: 1: Syntax error: word unexpected (expecting ")")

pythonforandroid/toolchain.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,6 @@ def __init__(self):
279279
help=('Primary storage directory for downloads and builds '
280280
'(default: {})'.format(default_storage_dir)))
281281

282-
# AND: This option doesn't really fit in the other categories, the
283-
# arg structure needs a rethink
284282
generic_parser.add_argument(
285283
'--arch',
286284
help='The archs to build for, separated by commas.',
@@ -313,11 +311,6 @@ def __init__(self):
313311
default=False,
314312
description='Whether to force compilation of a new distribution:')
315313

316-
generic_parser.add_argument(
317-
'--extra-dist-dirs', '--extra_dist_dirs',
318-
dest='extra_dist_dirs', default='',
319-
help='Directories in which to look for distributions')
320-
321314
add_boolean_option(
322315
generic_parser, ["require-perfect-match"],
323316
default=False,
@@ -513,12 +506,6 @@ def add_parser(subparsers, *args, **kwargs):
513506

514507
self._archs = split_argument_list(args.arch)
515508

516-
# AND: Fail nicely if the args aren't handled yet
517-
if args.extra_dist_dirs:
518-
warning('Received --extra_dist_dirs but this arg currently is not '
519-
'handled, exiting.')
520-
exit(1)
521-
522509
self.ctx.local_recipes = args.local_recipes
523510
self.ctx.copy_libs = args.copy_libs
524511

0 commit comments

Comments
 (0)