8000 :fire: Move to python3 `super` calls (#2106) · opacam/python-for-android@e02541f · GitHub
[go: up one dir, main page]

Skip to content

Commit e02541f

Browse files
opacaminclement
andauthored
🔥 Move to python3 super calls (kivy#2106)
Co-authored-by: Alexander Taylor <alexanderjohntaylor@gmail.com>
1 parent 2b33eae commit e02541f

File tree

70 files changed

+106
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+106
-104
lines changed

pythonforandroid/archs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Arch(object):
4646
]
4747

4848
def __init__(self, ctx):
49-
super(Arch, self).__init__()
49+
super().__init__()
5050
self.ctx = ctx
5151

5252
# Allows injecting additional linker paths used by any recipe.
@@ -309,6 +309,6 @@ class ArchAarch_64(Arch):
309309
# NDK r19 build system, because it seems that we don't need it anymore,
310310
# do we need them?
311311
# def get_env(self, with_flags_in_cc=True):
312-
# env = super(ArchAarch_64, self).get_env(with_flags_in_cc)
312+
# env = super().get_env(with_flags_in_cc)
313313
# env['EXTRA_CFLAGS'] = self.arch_cflags[-1]
314314
# return env

pythonforandroid/bootstraps/sdl2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def run_distribute(self):
4949

5050
self.strip_libraries(arch)
5151
self.fry_eggs(site_packages_dir)
52-
super(SDL2GradleBootstrap, self).run_distribute()
52+
super().run_distribute()
5353

5454

5555
bootstrap = SDL2GradleBootstrap()

pythonforandroid/bootstraps/service_only/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run_distribute(self):
4747

4848
self.strip_libraries(arch)
4949
self.fry_eggs(site_packages_dir)
50-
super(ServiceOnlyBootstrap, self).run_distribute()
50+
super().run_distribute()
5151

5252

5353
bootstrap = ServiceOnlyBootstrap()

pythonforandroid/bootstraps/webview/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def run_distribute(self):
4444

4545
self.strip_libraries(arch)
4646
self.fry_eggs(site_packages_dir)
47-
super(WebViewBootstrap, self).run_distribute()
47+
super().run_distribute()
4848

4949

5050
bootstrap = WebViewBootstrap()

pythonforandroid/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def prepare_build_environment(self,
435435
'python-for-android cannot continue due to the missing executables above')
436436

437437
def __init__(self):
438-
super(Context, self).__init__()
438+
super().__init__()
439439
self.include_dirs = []
440440

441441
self._build_env_prepared = False

pythonforandroid/logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def format(self, record):
4242
record.msg = '{}{}[DEBUG]{}{}: '.format(
4343
Err_Style.BRIGHT, Err_Fore.LIGHTBLACK_EX, Err_Fore.RESET,
4444
Err_Style.RESET_ALL) + record.msg
45-
return super(LevelDifferentiatingFormatter, self).format(record)
45+
return super().format(record)
4646

4747

4848
logger = logging.getLogger('p4a')

pythonforandroid/python.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class GuestPythonRecipe(TargetPythonRecipe):
103103

104104
def __init__(self, *args, **kwargs):
105105
self._ctx = None
106-
super(GuestPythonRecipe, self).__init__(*args, **kwargs)
106+
super().__init__(*args, **kwargs)
107107

108108
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
109109
env = environ.copy()
@@ -216,7 +216,7 @@ def should_build(self, arch):
216216
return not isfile(join(self.link_root(arch.arch), self._libpython))
217217

218218
def prebuild_arch(self, arch):
219-
super(TargetPythonRecipe, self).prebuild_arch(arch)
219+
super().prebuild_arch(arch)
220220
self.ctx.python_recipe = self
221221

222222
def build_arch(self, arch):

pythonforandroid/recipe.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __new__(cls, name, bases, dct):
5252
if 'version' in dct:
5353
dct['_version'] = dct.pop('version')
5454

55-
return super(RecipeMeta, cls).__new__(cls, name, bases, dct)
55+
return super().__new__(cls, name, bases, dct)
5656

5757

5858
class Recipe(with_metaclass(RecipeMeta)):
@@ -769,8 +769,7 @@ def get_jni_dir(self):
769769
return join(self.ctx.bootstrap.build_dir, 'jni')
770770

771771
def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=False):
772-
env = super(BootstrapNDKRecipe, self).get_recipe_env(
773-
arch, with_flags_in_cc)
772+
env = super().get_recipe_env(arch, with_flags_in_cc)
774773
if not with_python:
775774
return env
776775

@@ -804,7 +803,7 @@ def get_jni_dir(self, arch):
804803
return join(self.get_build_dir(arch.arch), 'jni')
805804

806805
def build_arch(self, arch, *extra_args):
807-
super(NDKRecipe, self).build_arch(arch)
806+
super().build_arch(arch)
808807

809808
env = self.get_recipe_env(arch)
810809
with current_directory(self.get_build_dir(arch.arch)):
@@ -856,7 +855,8 @@ class PythonRecipe(Recipe):
856855
'''
857856

858857
def __init__(self, *args, **kwargs):
859-
super(PythonRecipe, self).__init__(*args, **kwargs)
858+
super().__init__(*args, **kwargs)
859+
860860
if 'python3' not in self.depends:
861861
# We ensure here that the recipe depends on python even it overrode
862862
# `depends`. We only do this if it doesn't already depend on any
@@ -868,7 +868,7 @@ def __init__(self, *args, **kwargs):
868868
self.depends = depends
869869

870870
def clean_build(self, arch=None):
871-
super(PythonRecipe, self).clean_build(arch=arch)
871+
super().clean_build(arch=arch)
872872
name = self.folder_name
873873
python_install_dirs = glob.glob(join(self.ctx.python_installs_dir, '*'))
874874
for python_install in python_install_dirs:
@@ -905,7 +905,7 @@ def folder_name(self):
905905
return name
906906

907907
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
908-
env = super(PythonRecipe, self).get_recipe_env(arch, with_flags_in_cc)
908+
env = super().get_recipe_env(arch, with_flags_in_cc)
909909

910910
env['PYTHONNOUSERSITE'] = '1'
911911

@@ -950,7 +950,7 @@ def should_build(self, arch):
950950
def build_arch(self, arch):
951951
'''Install the Python module by calling setup.py install with
952952
the target Python dir.'''
953-
super(PythonRecipe, self).build_arch(arch)
953+
super().build_arch(arch)
954954
self.install_python_package(arch)
955955

956956
def install_python_package(self, arch, name=None, env=None, is_dir=True):
@@ -1020,7 +1020,7 @@ def build_compiled_components(self, arch):
10201020
def install_hostpython_package(self, arch):
10211021
env = self.get_hostrecipe_env(arch)
10221022
self.rebuild_compiled_components(arch, env)
1023-
super(CompiledComponentsPythonRecipe, self).install_hostpython_package(arch)
1023+
super().install_hostpython_package(arch)
10241024

10251025
def rebuild_compiled_components(self, arch, env):
10261026
info('Rebuilding compiled components in {}'.format(self.name))
@@ -1122,7 +1122,7 @@ def cythonize_build(self, env, build_dir="."):
11221122
self.cythonize_file(env, build_dir, join(root, filename))
11231123

11241124
def get_recipe_env(self, arch, with_flags_in_cc=True):
1125-
env = super(CythonRecipe, self).get_recipe_env(arch, with_flags_in_cc)
1125+
env = super().get_recipe_env(arch, with_flags_in_cc)
11261126
env['LDFLAGS'] = env['LDFLAGS'] + ' -L{} '.format(
11271127
self.ctx.get_libs_dir(arch.arch) +
11281128
' -L{} '.format(self.ctx.libs_dir) +
@@ -1152,10 +1152,10 @@ class TargetPythonRecipe(Recipe):
11521152

11531153
def __init__(self, *args, **kwargs):
11541154
self._ctx = None
1155-
super(TargetPythonRecipe, self).__init__(*args, **kwargs)
1155+
super().__init__(*args, **kwargs)
11561156

11571157
def prebuild_arch(self, arch):
1158-
super(TargetPythonRecipe, self).prebuild_arch(arch)
1158+
super().prebuild_arch(arch)
11591159
self.ctx.python_recipe = self
11601160

11611161
def include_root(self, arch):

pythonforandroid/recipes/Pillow/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class PillowRecipe(CompiledComponentsPythonRecipe):
1313
call_hostpython_via_targetpython = False
1414

1515
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
16-
env = super(PillowRecipe, self).get_recipe_env(arch, with_flags_in_cc)
16+
env = super().get_recipe_env(arch, with_flags_in_cc)
1717

1818
env['ANDROID_ROOT'] = join(self.ctx.ndk_platform, 'usr')
1919
ndk_lib_dir = join(self.ctx.ndk_platform, 'usr', 'lib')

pythonforandroid/recipes/android/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ class AndroidRecipe(IncludedFilesBehaviour, CythonRecipe):
1818
config_env = {}
1919

2020
def get_recipe_env(self, arch):
21-
env = super(AndroidRecipe, self).get_recipe_env(arch)
21+
env = super().get_recipe_env(arch)
2222
env.update(self.config_env)
2323
return env
2424

2525
def prebuild_arch(self, arch):
26-
super(AndroidRecipe, self).prebuild_arch(arch)
26+
super().prebuild_arch(arch)
2727
ctx_bootstrap = self.ctx.bootstrap.name
2828

2929
# define macros for Cython, C, Python

0 commit comments

Comments
 (0)
0