Skip to content

tox update and linter fixes #1674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ci/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class TargetPython(Enum):
'protobuf_cpp',
'xeddsa',
'x3dh',
# fatal error: crypt.h: No such file or directory
'pyleveldb',
'pynacl',
'doubleratchet',
'omemo',
Expand Down Expand Up @@ -77,6 +79,8 @@ class TargetPython(Enum):
# requires `libpq-dev` system dependency e.g. for `pg_config` binary
'psycopg2',
'netifaces',
# fatal error: crypt.h: No such file or directory
'pyleveldb',
'protobuf_cpp',
# most likely some setup in the Docker container, because it works in host
'pyjnius', 'pyopenal',
Expand Down
15 changes: 6 additions & 9 deletions ci/rebuild_updated_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,12 @@ def build(target_python, requirements):
requirements = ','.join(requirements)
logger.info('requirements: {}'.format(requirements))
with current_directory('testapps/'):
try:
# iterates to stream the output
for line in sh.python(
testapp, 'apk', '--sdk-dir', android_sdk_home,
'--ndk-dir', android_ndk_home, '--bootstrap', 'sdl2', '--requirements',
requirements, _err_to_out=True, _iter=True):
print(line)
except sh.ErrorReturnCode as e:
raise
# iterates to stream the output
for line in sh.python(
testapp, 'apk', '--sdk-dir', android_sdk_home,
'--ndk-dir', android_ndk_home, '--bootstrap', 'sdl2', '--requirements',
requirements, _err_to_out=True, _iter=True):
print(line)


def main():
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/bootstraps/common/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def make_package(args):
target = fileh.read().strip()
android_api = target.split('-')[1]
try:
android_api_int_test = int(android_api)
int(android_api)
except (ValueError, TypeError):
raise ValueError(
"failed to extract the Android API level from " +
Expand Down
4 changes: 2 additions & 2 deletions pythonforandroid/bootstraps/pygame/build/buildlib/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,7 @@ def _check_conflict(self, action):
def _handle_conflict_error(self, action, conflicting_actions):
message = _('conflicting option string(s): %s')
conflict_string = ', '.join([option_string
for option_string, action
for option_string, action # noqa F812
in conflicting_actions])
raise ArgumentError(action, message % conflict_string)

Expand Down Expand Up @@ -2071,7 +2071,7 @@ def _parse_optional(self, arg_string):
# if multiple actions match, the option string was ambiguous
if len(option_tuples) > 1:
options = ', '.join(
[option_string for action, option_string, explicit_arg in option_tuples])
[option_string for action, option_string, explicit_arg in option_tuples]) # noqa F812
tup = arg_string, options
self.error(_('ambiguous option: %s could match %s') % tup)

Expand Down
2 changes: 0 additions & 2 deletions pythonforandroid/bootstraps/sdl2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ def run_distribute(self):
info_main("# Creating Android project ({})".format(self.name))

arch = self.ctx.archs[0]
python_install_dir = self.ctx.get_python_install_dir()
from_crystax = self.ctx.python_recipe.from_crystax

if len(self.ctx.archs) > 1:
raise ValueError("SDL2/gradle support only one arch")
Expand Down
1 change: 0 additions & 1 deletion pythonforandroid/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ def not_has_package(self, name, arch=None):

def build_recipes(build_order, python_modules, ctx):
# Put recipes in correct build order
bs = ctx.bootstrap
info_notify("Recipe build order is {}".format(build_order))
if python_modules:
python_modules = sorted(set(python_modules))
Expand Down
2 changes: 0 additions & 2 deletions pythonforandroid/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ def get_distribution(cls, ctx, name=None, recipes=[],

existing_dists = Distribution.get_distributions(ctx)

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

possible_dists = existing_dists

name_match_dist = None
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def build_arch(self, arch):
shprint(sh.cp, join('Modules', 'Setup.dist'),
join(build_dir, 'Modules', 'Setup'))

result = shprint(sh.make, '-j', str(cpu_count()), '-C', build_dir)
shprint(sh.make, '-j', str(cpu_count()), '-C', build_dir)
else:
info('Skipping {name} ({version}) build, as it has already '
'been completed'.format(name=self.name, version=self.version))
Expand Down
1 change: 0 additions & 1 deletion pythonforandroid/recipes/pygame/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def build_arch(self, arch):
shprint(sh.find, build_lib[0], '-name', '*.o', '-exec',
env['STRIP'], '{}', ';')

python_install_path = join(self.ctx.build_dir, 'python-install')
warning('Should remove pygame tests etc. here, but skipping for now')


Expand Down
1 change: 0 additions & 1 deletion pythonforandroid/recipes/pyleveldb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class PyLevelDBRecipe(CompiledComponentsPythonRecipe):
site_packages_name = 'leveldb'

def build_arch(self, arch):
env = self.get_recipe_env(arch)
with current_directory(self.get_build_dir(arch.arch)):
# Remove source in this pypi package
sh.rm('-rf', 'leveldb', 'leveldb.egg-info', 'snappy')
Expand Down
16 changes: 8 additions & 8 deletions pythonforandroid/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def add_parser(subparsers, *args, **kwargs):
kwargs.pop('aliases')
return subparsers.add_parser(*args, **kwargs)

parser_recommendations = add_parser(
add_parser(
subparsers,
'recommendations',
parents=[generic_parser],
Expand Down Expand Up @@ -470,20 +470,20 @@ def add_parser(subparsers, *args, **kwargs):
'--signkeypw', dest='signkeypw', action='store', default=None,
help='Password for key alias')

parser_create = add_parser(
add_parser(
subparsers,
'create', help='Compile a set of requirements into a dist',
parents=[generic_parser])
parser_archs = add_parser(
add_parser(
subparsers,
'archs', help='List the available target architectures',
parents=[generic_parser])
parser_distributions = add_parser(
add_parser(
subparsers,
'distributions', aliases=['dists'],
help='List the currently available (compiled) dists',
parents=[generic_parser])
parser_delete_dist = add_parser(
add_parser(
subparsers,
'delete_dist', aliases=['delete-dist'], help='Delete a compiled dist',
parents=[generic_parser])
Expand All @@ -496,15 +496,15 @@ def add_parser(subparsers, *args, **kwargs):
parser_sdk_tools.add_argument(
'tool', help='The binary tool name to run')

parser_adb = add_parser(
add_parser(
subparsers,
'adb', help='Run adb from the given SDK',
parents=[generic_parser])
parser_logcat = add_parser(
add_parser(
subparsers,
'logcat', help='Run logcat from the given SDK',
parents=[generic_parser])
parser_build_status = add_parser(
add_parser(
subparsers,
'build_status', aliases=['build-status'],
help='Print some debug information about current built components',
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ ignore =
E123, E124, E126,
E226,
E402, E501,
F841, W503,
W503,
W504