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

pythonforandroid/recipes/android/src/android/_android_billing.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class BillingService(object):
1515
BILLING_TYPE_SUBSCRIPTION = 'subs'
1616

1717
def __init__(self, callback):
18-
super(BillingService, self).__init__()
18+
super().__init__()
1919
self.callback = callback
2020
self.purchased_items = None
2121
android_billing_service_start()

pythonforandroid/recipes/android/src/android/activity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class NewIntentListener(PythonJavaClass):
1414
__javacontext__ = 'app'
1515

1616
def __init__(self, callback, **kwargs):
17-
super(NewIntentListener, self).__init__(**kwargs)
17+
super().__init__(**kwargs)
1818
self.callback = callback
1919

2020
@java_method('(Landroid/content/Intent;)V')
@@ -27,7 +27,7 @@ class ActivityResultListener(PythonJavaClass):
2727
__javacontext__ = 'app'
2828

2929
def __init__(self, callback):
30-
super(ActivityResultListener, self).__init__()
30+
super().__init__()
3131
self.callback = callback
3232

3333
@java_method('(IILandroid/content/Intent;)V')

pythonforandroid/recipes/android/src/android/broadcast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def onReceive(self, context, intent):
2020
self.callback(context, intent)
2121

2222
def __init__(self, callback, actions=None, categories=None):
23-
super(BroadcastReceiver, self).__init__()
23+
super().__init__()
2424
self.callback = callback
2525

2626
if not actions and not categories:

pythonforandroid/recipes/android/src/android/runnable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Runnable(PythonJavaClass):
2020
__runnables__ = []
2121

2222
def __init__(self, func):
23-
super(Runnable, self).__init__()
23+
super().__init__()
2424
self.func = func
2525

2626
def __call__(self, *args, **kwargs):

pythonforandroid/recipes/apsw/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def build_arch(self, arch):
2020
'build_ext',
2121
'--enable=fts4', _env=env)
2222
# Install python bindings
23-
super(ApswRecipe, self).build_arch(arch)
23+
super().build_arch(arch)
2424

2525
def get_recipe_env(self, arch):
26-
env = super(ApswRecipe, self).get_recipe_env(arch)
26+
env = super().get_recipe_env(arch)
2727
sqlite_recipe = self.get_recipe('sqlite3', self.ctx)
2828
env['CFLAGS'] += ' -I' + sqlite_recipe.get_build_dir(arch.arch)
2929
env['LDFLAGS'] += ' -L' + sqlite_recipe.get_lib_dir(arch)

pythonforandroid/recipes/audiostream/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class AudiostreamRecipe(CythonRecipe):
1010
depends = ['python3', 'sdl2', 'pyjnius']
1111

1212
def get_recipe_env(self, arch):
13-
env = super(AudiostreamRecipe, self).get_recipe_env(arch)
13+
env = super().get_recipe_env(arch)
1414
sdl_include = 'SDL2'
1515
sdl_mixer_include = 'SDL2_mixer'
1616
env['USE_SDL2'] = 'True'

pythonforandroid/recipes/bcrypt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class BCryptRecipe(CompiledComponentsPythonRecipe):
99
call_hostpython_via_targetpython = False
1010

1111
def get_recipe_env(self, arch):
12-
env = super(BCryptRecipe, self).get_recipe_env(arch)
12+
env = super().get_recipe_env(arch)
1313

1414
openssl_recipe = Recipe.get_recipe('openssl', self.ctx)
1515
env['CFLAGS'] += openssl_recipe.include_flags(arch)

pythonforandroid/recipes/boost/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def should_build(self, arch):
6060
return not exists(join(self.get_build_dir(arch.arch), 'b2'))
6161

6262
def prebuild_arch(self, arch):
63-
super(BoostRecipe, self).prebuild_arch(arch)
63+
super().prebuild_arch(arch)
6464
env = self.get_recipe_env(arch)
6565
with current_directory(self.get_build_dir(arch.arch)):
6666
# Set custom configuration
@@ -70,7 +70,7 @@ def prebuild_arch(self, arch):
7070
)
7171

7272
def build_arch(self, arch):
73-
super(BoostRecipe, self).build_arch(arch)
73+
super().build_arch(arch)
7474
env = self.get_recipe_env(arch)
7575
env['PYTHON_HOST'] = self.ctx.hostpython
7676
with current_directory(self.get_build_dir(arch.arch)):

pythonforandroid/recipes/cdecimal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class CdecimalRecipe(CompiledComponentsPythonRecipe):
1313
'cross-compile.patch']
1414

1515
def prebuild_arch(self, arch):
16-
super(CdecimalRecipe, self).prebuild_arch(arch)
16+
super().prebuild_arch(arch)
1717
if not is_darwin():
1818
if '64' in arch.arch:
1919
machine = 'ansi64'

pythonforandroid/recipes/cffi/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ class CffiRecipe(CompiledComponentsPythonRecipe):
1919

2020
def get_hostrecipe_env(self, arch=None):
2121
# fixes missing ffi.h on some host systems (e.g. gentoo)
22-
env = super(CffiRecipe, self).get_hostrecipe_env(arch)
22+
env = super().get_hostrecipe_env(arch)
2323
libffi = self.get_recipe('libffi', self.ctx)
2424
includes = libffi.get_include_dirs(arch)
2525
env['FFI_INC'] = ",".join(includes)
2626
return env
2727

2828
def get_recipe_env(self, arch=None):
29-
env = super(CffiRecipe, self).get_recipe_env(arch)
29+
env = super().get_recipe_env(arch)
3030
libffi = self.get_recipe('libffi', self.ctx)
3131
includes = libffi.get_include_dirs(arch)
3232
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes)

pythonforandroid/recipes/cryptography/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CryptographyRecipe(CompiledComponentsPythonRecipe):
1010
call_hostpython_via_targetpython = False
1111

1212
def get_recipe_env(self, arch):
13-
env = super(CryptographyRecipe, self).get_recipe_env(arch)
13+
env = super().get_recipe_env(arch)
1414

1515
openssl_recipe = Recipe.get_recipe('openssl', self.ctx)
1616
env['CFLAGS'] += openssl_recipe.include_flags(arch)

pythonforandroid/recipes/enum34/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def should_build(self, arch):
1616
# attribute `depends` because otherwise we will not be able to
1717
# build the cryptography recipe.
1818
return False
19-
return super(Enum34Recipe, self).should_build(arch)
19+
return super().should_build(arch)
2020

2121

2222
recipe = Enum34Recipe()

pythonforandroid/recipes/evdev/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class EvdevRecipe(CompiledComponentsPythonRecipe):
1717
'evdev-permissions.patch']
1818

1919
def get_recipe_env(self, arch=None):
20-
env = super(EvdevRecipe, self).get_recipe_env(arch)
20+
env = super().get_recipe_env(arch)
2121
env['NDKPLATFORM'] = self.ctx.ndk_platform
2222
return env
2323

pythonforandroid/recipes/ffmpeg/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def prebuild_arch(self, arch):
1919
self.apply_patches(arch)
2020

2121
def get_recipe_env(self, arch):
22-
env = super(FFMpegRecipe, self).get_recipe_env(arch)
22+
env = super().get_recipe_env(arch)
2323
env['NDK'] = self.ctx.ndk_dir
2424
return env
2525

pythonforandroid/recipes/ffpyplayer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class FFPyPlayerRecipe(CythonRecipe):
1010
opt_depends = ['openssl', 'ffpyplayer_codecs']
1111

1212
def get_recipe_env(self, arch, with_flags_in_cc=True):
13-
env = super(FFPyPlayerRecipe, self).get_recipe_env(arch)
13+
env = super().get_recipe_env(arch)
1414

1515
build_dir = Recipe.get_recipe('ffmpeg', self.ctx).get_build_dir(arch.arch)
1616
env["FFMPEG_INCLUDE_DIR"] = join(build_dir, "include")

pythonforandroid/recipes/freetype/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class FreetypeRecipe(Recipe):
2929
built_libraries = {'libfreetype.so': 'objs/.libs'}
3030

3131
def get_recipe_env(self, arch=None, with_harfbuzz=False):
32-
env = super(FreetypeRecipe, self).get_recipe_env(arch)
32+
env = super().get_recipe_env(arch)
3333
if with_harfbuzz:
3434
harfbuzz_build = self.get_recipe(
3535
'harfbuzz', self.ctx

pythonforandroid/recipes/genericndkbuild/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ def should_build(self, arch):
1414
return True
1515

1616
def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=True):
17-
env = super(GenericNDKBuildRecipe, self).get_recipe_env(
18-
arch=arch, with_flags_in_cc=with_flags_in_cc, with_python=with_python)
17+
env = super().get_recipe_env(
18+
arch=arch, with_flags_in_cc=with_flags_in_cc,
19+
with_python=with_python,
20+
)
1921
env['APP_ALLOW_MISSING_DEPS'] = 'true'
2022
return env
2123

pythonforandroid/recipes/harfbuzz/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class HarfbuzzRecipe(Recipe):
2626
built_libraries = {'libharfbuzz.so': 'src/.libs'}
2727

2828
def get_recipe_env(self, arch=None):
29-
env = super(HarfbuzzRecipe, self).get_recipe_env(arch)
29+
env = super().get_recipe_env(arch)
3030
if 'freetype' in self.ctx.recipe_build_order:
3131
freetype = self.get_recipe('freetype', self.ctx)
3232
freetype_install = join(

0 commit comments

Comments
 (0)