Skip to content

Introduces linting (tox/flake8) #1283

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 2 commits into from
May 21, 2018
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
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ services:
- docker

before_install:
- docker build --tag=p4a .
- sudo apt-get update -qq
- sudo apt-get install -qq python-tox

env:
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk'
Expand All @@ -16,5 +17,10 @@ env:
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/crystax-ndk'
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/crystax-ndk --requirements python3crystax,setuptools,android'

before_script:
# we want to fail fast on tox errors without having to `docker build` first
- tox

script:
- docker build --tag=p4a .
- docker run p4a /bin/sh -c "$COMMAND"
12 changes: 6 additions & 6 deletions pythonforandroid/recipes/babel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@


class BabelRecipe(PythonRecipe):
name = 'babel'
version = '2.1.1'
url = 'https://pypi.python.org/packages/source/B/Babel/Babel-{version}.tar.gz'
name = 'babel'
version = '2.1.1'
url = 'https://pypi.python.org/packages/source/B/Babel/Babel-{version}.tar.gz'

depends = [('python2', 'python3crystax'), 'setuptools', 'pytz']
depends = [('python2', 'python3crystax'), 'setuptools', 'pytz']

call_hostpython_via_targetpython = False
install_in_hostpython = True
call_hostpython_via_targetpython = False
install_in_hostpython = True


recipe = BabelRecipe()
46 changes: 23 additions & 23 deletions pythonforandroid/recipes/cffi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@


class CffiRecipe(CompiledComponentsPythonRecipe):
name = 'cffi'
version = '1.4.2'
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'

depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi']

patches = ['disable-pkg-config.patch']

# call_hostpython_via_targetpython = False
install_in_hostpython = True

def get_recipe_env(self, arch=None):
env = super(CffiRecipe, self).get_recipe_env(arch)
libffi = self.get_recipe('libffi', self.ctx)
includes = libffi.get_include_dirs(arch)
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes)
env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' +
self.ctx.get_libs_dir(arch.arch))
env['PYTHONPATH'] = ':'.join([
self.ctx.get_site_packages_dir(),
env['BUILDLIB_PATH'],
])
return env
name = 'cffi'
version = '1.4.2'
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'

depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi']

patches = ['disable-pkg-config.patch']

# call_hostpython_via_targetpython = False
install_in_hostpython = True

def get_recipe_env(self, arch=None):
env = super(CffiRecipe, self).get_recipe_env(arch)
libffi = self.get_recipe('libffi', self.ctx)
includes = libffi.get_include_dirs(arch)
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes)
env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' +
self.ctx.get_libs_dir(arch.arch))
env['PYTHONPATH'] = ':'.join([
self.ctx.get_site_packages_dir(),
env['BUILDLIB_PATH'],
])
return env


recipe = CffiRecipe()
12 changes: 6 additions & 6 deletions pythonforandroid/recipes/dateutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@


class DateutilRecipe(PythonRecipe):
name = 'dateutil'
version = '2.6.0'
url = 'https://pypi.python.org/packages/51/fc/39a3fbde6864942e8bb24c93663734b74e281b984d1b8c4f95d64b0c21f6/python-dateutil-2.6.0.tar.gz'
name = 'dateutil'
version = '2.6.0'
url = 'https://pypi.python.org/packages/51/fc/39a3fbde6864942e8bb24c93663734b74e281b984d1b8c4f95d64b0c21f6/python-dateutil-2.6.0.tar.gz'

depends = ['python2', "setuptools"]
call_hostpython_via_targetpython = False
install_in_hostpython = True
depends = ['python2', "setuptools"]
call_hostpython_via_targetpython = False
install_in_hostpython = True


recipe = DateutilRecipe()
10 changes: 5 additions & 5 deletions pythonforandroid/recipes/idna/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@


class IdnaRecipe(PythonRecipe):
name = 'idna'
version = '2.0'
url = 'https://pypi.python.org/packages/source/i/idna/idna-{version}.tar.gz'
name = 'idna'
version = '2.0'
url = 'https://pypi.python.org/packages/source/i/idna/idna-{version}.tar.gz'

depends = [('python2', 'python3crystax'), 'setuptools']
depends = [('python2', 'python3crystax'), 'setuptools']

call_hostpython_via_targetpython = False
call_hostpython_via_targetpython = False


recipe = IdnaRecipe()
8 changes: 4 additions & 4 deletions pythonforandroid/recipes/ipaddress/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@


class IpaddressRecipe(PythonRecipe):
name = 'ipaddress'
version = '1.0.16'
url = 'https://pypi.python.org/packages/source/i/ipaddress/ipaddress-{version}.tar.gz'
name = 'ipaddress'
version = '1.0.16'
url = 'https://pypi.python.org/packages/source/i/ipaddress/ipaddress-{version}.tar.gz'

depends = ['python2']
depends = ['python2']


recipe = IpaddressRecipe()
48 changes: 24 additions & 24 deletions pythonforandroid/recipes/jpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@


class JpegRecipe(NDKRecipe):
name = 'jpeg'
version = 'linaro-android'
url = 'git://git.linaro.org/people/tomgall/libjpeg-turbo/libjpeg-turbo.git'

patches = ['build-static.patch']

generated_libraries = ['libjpeg.a']

def prebuild_arch(self, arch):
super(JpegRecipe, self).prebuild_arch(arch)

build_dir = self.get_build_dir(arch.arch)
app_mk = join(build_dir, 'Application.mk')
if not exists(app_mk):
shprint(sh.cp, join(self.get_recipe_dir(), 'Application.mk'), app_mk)
jni_ln = join(build_dir, 'jni')
if not exists(jni_ln):
shprint(sh.ln, '-s', build_dir, jni_ln)

def build_arch(self, arch):
super(JpegRecipe, self).build_arch(arch)
with current_directory(self.get_lib_dir(arch)):
shprint(sh.mv, 'libjpeg.a', 'libjpeg-orig.a')
shprint(sh.ar, '-rcT', 'libjpeg.a', 'libjpeg-orig.a', 'libsimd.a')
name = 'jpeg'
version = 'linaro-android'
url = 'git://git.linaro.org/people/tomgall/libjpeg-turbo/libjpeg-turbo.git'

patches = ['build-static.patch']

generated_libraries = ['libjpeg.a']

def prebuild_arch(self, arch):
super(JpegRecipe, self).prebuild_arch(arch)

build_dir = self.get_build_dir(arch.arch)
app_mk = join(build_dir, 'Application.mk')
if not exists(app_mk):
shprint(sh.cp, join(self.get_recipe_dir(), 'Application.mk'), app_mk)
jni_ln = join(build_dir, 'jni')
if not exists(jni_ln):
shprint(sh.ln, '-s', build_dir, jni_ln)

def build_arch(self, arch):
super(JpegRecipe, self).build_arch(arch)
with current_directory(self.get_lib_dir(arch)):
shprint(sh.mv, 'libjpeg.a', 'libjpeg-orig.a')
shprint(sh.ar, '-rcT', 'libjpeg.a', 'libjpeg-orig.a', 'libsimd.a')


recipe = JpegRecipe()
100 changes: 50 additions & 50 deletions pythonforandroid/recipes/libmysqlclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,62 @@


class LibmysqlclientRecipe(Recipe):
name = 'libmysqlclient'
version = 'master'
url = 'https://github.com/0x-ff/libmysql-android/archive/{version}.zip'
# version = '5.5.47'
# url = 'http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-{version}.tar.gz'
#
# depends = ['ncurses']
#
name = 'libmysqlclient'
version = 'master'
url = 'https://github.com/0x-ff/libmysql-android/archive/{version}.zip'
# version = '5.5.47'
# url = 'http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-{version}.tar.gz'
#
# depends = ['ncurses']
#

# patches = ['add-custom-platform.patch']
# patches = ['add-custom-platform.patch']

patches = ['disable-soversion.patch']
patches = ['disable-soversion.patch']

def should_build(self, arch):
return not self.has_libs(arch, 'libmysql.so')
def should_build(self, arch):
return not self.has_libs(arch, 'libmysql.so')

def build_arch(self, arch):
env = self.get_recipe_env(arch)
with current_directory(join(self.get_build_dir(arch.arch), 'libmysqlclient')):
shprint(sh.cp, '-t', '.', join(self.get_recipe_dir(), 'p4a.cmake'))
# shprint(sh.mkdir, 'Platform')
# shprint(sh.cp, '-t', 'Platform', join(self.get_recipe_dir(), 'Linux.cmake'))
shprint(sh.rm, '-f', 'CMakeCache.txt')
shprint(sh.cmake, '-G', 'Unix Makefiles',
# '-DCMAKE_MODULE_PATH=' + join(self.get_build_dir(arch.arch), 'libmysqlclient'),
'-DCMAKE_INSTALL_PREFIX=./install',
'-DCMAKE_TOOLCHAIN_FILE=p4a.cmake', _env=env)
shprint(sh.make, _env=env)
def build_arch(self, arch):
env = self.get_recipe_env(arch)
with current_directory(join(self.get_build_dir(arch.arch), 'libmysqlclient')):
shprint(sh.cp, '-t', '.', join(self.get_recipe_dir(), 'p4a.cmake'))
# shprint(sh.mkdir, 'Platform')
# shprint(sh.cp, '-t', 'Platform', join(self.get_recipe_dir(), 'Linux.cmake'))
shprint(sh.rm, '-f', 'CMakeCache.txt')
shprint(sh.cmake, '-G', 'Unix Makefiles',
# '-DCMAKE_MODULE_PATH=' + join(self.get_build_dir(arch.arch), 'libmysqlclient'),
'-DCMAKE_INSTALL_PREFIX=./install',
'-DCMAKE_TOOLCHAIN_FILE=p4a.cmake', _env=env)
shprint(sh.make, _env=env)

self.install_libs(arch, join('libmysql', 'libmysql.so'))
self.install_libs(arch, join('libmysql', 'libmysql.so'))

# def get_recipe_env(self, arch=None):
# env = super(LibmysqlclientRecipe, self).get_recipe_env(arch)
# env['WITHOUT_SERVER'] = 'ON'
# ncurses = self.get_recipe('ncurses', self)
# # env['CFLAGS'] += ' -I' + join(ncurses.get_build_dir(arch.arch),
# # 'include')
# env['CURSES_LIBRARY'] = join(self.ctx.get_libs_dir(arch.arch), 'libncurses.so')
# env['CURSES_INCLUDE_PATH'] = join(ncurses.get_build_dir(arch.arch),
# 'include')
# return env
#
# def build_arch(self, arch):
# env = self.get_recipe_env(arch)
# with current_directory(self.get_build_dir(arch.arch)):
# # configure = sh.Command('./configure')
# # TODO: should add openssl as an optional dep and compile support
# # shprint(configure, '--enable-shared', '--enable-assembler',
# # '--enable-thread-safe-client', '--with-innodb',
# # '--without-server', _env=env)
# # shprint(sh.make, _env=env)
# shprint(sh.cmake, '.', '-DCURSES_LIBRARY=' + env['CURSES_LIBRARY'],
# '-DCURSES_INCLUDE_PATH=' + env['CURSES_INCLUDE_PATH'], _env=env)
# shprint(sh.make, _env=env)
#
# self.install_libs(arch, 'libmysqlclient.so')
# def get_recipe_env(self, arch=None):
# env = super(LibmysqlclientRecipe, self).get_recipe_env(arch)
# env['WITHOUT_SERVER'] = 'ON'
# ncurses = self.get_recipe('ncurses', self)
# # env['CFLAGS'] += ' -I' + join(ncurses.get_build_dir(arch.arch),
# # 'include')
# env['CURSES_LIBRARY'] = join(self.ctx.get_libs_dir(arch.arch), 'libncurses.so')
# env['CURSES_INCLUDE_PATH'] = join(ncurses.get_build_dir(arch.arch),
# 'include')
# return env
#
# def build_arch(self, arch):
# env = self.get_recipe_env(arch)
# with current_directory(self.get_build_dir(arch.arch)):
# # configure = sh.Command('./configure')
# # TODO: should add openssl as an optional dep and compile support
# # shprint(configure, '--enable-shared', '--enable-assembler',
# # '--enable-thread-safe-client', '--with-innodb',
# # '--without-server', _env=env)
# # shprint(sh.make, _env=env)
# shprint(sh.cmake, '.', '-DCURSES_LIBRARY=' + env['CURSES_LIBRARY'],
# '-DCURSES_INCLUDE_PATH=' + env['CURSES_INCLUDE_PATH'], _env=env)
# shprint(sh.make, _env=env)
#
# self.install_libs(arch, 'libmysqlclient.so')


recipe = LibmysqlclientRecipe()
Loading