Skip to content

Commit 54a444b

Browse files
authored
Merge pull request #1283 from AndreMiras/feature/tox_flake8_testing
Introduces linting (tox/flake8)
2 parents 45c26bd + 1a650de commit 54a444b

File tree

15 files changed

+233
-212
lines changed

15 files changed

+233
-212
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ services:
66
- docker
77

88
before_install:
9-
- docker build --tag=p4a .
9+
- sudo apt-get update -qq
10+
- sudo apt-get install -qq python-tox
1011

1112
env:
1213
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk'
@@ -16,5 +17,10 @@ env:
1617
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/crystax-ndk'
1718
- 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'
1819

20+
before_script:
21+
# we want to fail fast on tox errors without having to `docker build` first
22+
- tox
23+
1924
script:
25+
- docker build --tag=p4a .
2026
- docker run p4a /bin/sh -c "$COMMAND"

pythonforandroid/recipes/babel/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33

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

9-
depends = [('python2', 'python3crystax'), 'setuptools', 'pytz']
9+
depends = [('python2', 'python3crystax'), 'setuptools', 'pytz']
1010

11-
call_hostpython_via_targetpython = False
12-
install_in_hostpython = True
11+
call_hostpython_via_targetpython = False
12+
install_in_hostpython = True
1313

1414

1515
recipe = BabelRecipe()

pythonforandroid/recipes/cffi/__init__.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33

44
class CffiRecipe(CompiledComponentsPythonRecipe):
5-
name = 'cffi'
6-
version = '1.4.2'
7-
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'
8-
9-
depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi']
10-
11-
patches = ['disable-pkg-config.patch']
12-
13-
# call_hostpython_via_targetpython = False
14-
install_in_hostpython = True
15-
16-
def get_recipe_env(self, arch=None):
17-
env = super(CffiRecipe, self).get_recipe_env(arch)
18-
libffi = self.get_recipe('libffi', self.ctx)
19-
includes = libffi.get_include_dirs(arch)
20-
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes)
21-
env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' +
22-
self.ctx.get_libs_dir(arch.arch))
23-
env['PYTHONPATH'] = ':'.join([
24-
self.ctx.get_site_packages_dir(),
25-
env['BUILDLIB_PATH'],
26-
])
27-
return env
5+
name = 'cffi'
6+
version = '1.4.2'
7+
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'
8+
9+
depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi']
10+
11+
patches = ['disable-pkg-config.patch']
12+
13+
# call_hostpython_via_targetpython = False
14+
install_in_hostpython = True
15+
16+
def get_recipe_env(self, arch=None):
17+
env = super(CffiRecipe, self).get_recipe_env(arch)
18+
libffi = self.get_recipe('libffi', self.ctx)
19+
includes = libffi.get_include_dirs(arch)
20+
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes)
21+
env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' +
22+
self.ctx.get_libs_dir(arch.arch))
23+
env['PYTHONPATH'] = ':'.join([
24+
self.ctx.get_site_packages_dir(),
25+
env['BUILDLIB_PATH'],
26+
])
27+
return env
2828

2929

3030
recipe = CffiRecipe()

pythonforandroid/recipes/dateutil/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33

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

9-
depends = ['python2', "setuptools"]
10-
call_hostpython_via_targetpython = False
11-
install_in_hostpython = True
9+
depends = ['python2', "setuptools"]
10+
call_hostpython_via_targetpython = False
11+
install_in_hostpython = True
1212

1313

1414
recipe = DateutilRecipe()

pythonforandroid/recipes/idna/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33

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

9-
depends = [('python2', 'python3crystax'), 'setuptools']
9+
depends = [('python2', 'python3crystax'), 'setuptools']
1010

11-
call_hostpython_via_targetpython = False
11+
call_hostpython_via_targetpython = False
1212

1313

1414
recipe = IdnaRecipe()

pythonforandroid/recipes/ipaddress/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33

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

9-
depends = ['python2']
9+
depends = ['python2']
1010

1111

1212
recipe = IpaddressRecipe()

pythonforandroid/recipes/jpeg/__init__.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@
66

77

88
class JpegRecipe(NDKRecipe):
9-
name = 'jpeg'
10-
version = 'linaro-android'
11-
url = 'git://git.linaro.org/people/tomgall/libjpeg-turbo/libjpeg-turbo.git'
12-
13-
patches = ['build-static.patch']
14-
15-
generated_libraries = ['libjpeg.a']
16-
17-
def prebuild_arch(self, arch):
18-
super(JpegRecipe, self).prebuild_arch(arch)
19-
20-
build_dir = self.get_build_dir(arch.arch)
21-
app_mk = join(build_dir, 'Application.mk')
22-
if not exists(app_mk):
23-
shprint(sh.cp, join(self.get_recipe_dir(), 'Application.mk'), app_mk)
24-
jni_ln = join(build_dir, 'jni')
25-
if not exists(jni_ln):
26-
shprint(sh.ln, '-s', build_dir, jni_ln)
27-
28-
def build_arch(self, arch):
29-
super(JpegRecipe, self).build_arch(arch)
30-
with current_directory(self.get_lib_dir(arch)):
31-
shprint(sh.mv, 'libjpeg.a', 'libjpeg-orig.a')
32-
shprint(sh.ar, '-rcT', 'libjpeg.a', 'libjpeg-orig.a', 'libsimd.a')
9+
name = 'jpeg'
10+
version = 'linaro-android'
11+
url = 'git://git.linaro.org/people/tomgall/libjpeg-turbo/libjpeg-turbo.git'
12+
13+
patches = ['build-static.patch']
14+
15+
generated_libraries = ['libjpeg.a']
16+
17+
def prebuild_arch(self, arch):
18+
super(JpegRecipe, self).prebuild_arch(arch)
19+
20+
build_dir = self.get_build_dir(arch.arch)
21+
app_mk = join(build_dir, 'Application.mk')
22+
if not exists(app_mk):
23+
shprint(sh.cp, join(self.get_recipe_dir(), 'Application.mk'), app_mk)
24+
jni_ln = join(build_dir, 'jni')
25+
if not exists(jni_ln):
26+
shprint(sh.ln, '-s', build_dir, jni_ln)
27+
28+
def build_arch(self, arch):
29+
super(JpegRecipe, self).build_arch(arch)
30+
with current_directory(self.get_lib_dir(arch)):
31+
shprint(sh.mv, 'libjpeg.a', 'libjpeg-orig.a')
32+
shprint(sh.ar, '-rcT', 'libjpeg.a', 'libjpeg-orig.a', 'libsimd.a')
3333

3434

3535
recipe = JpegRecipe()

pythonforandroid/recipes/libmysqlclient/__init__.py

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,62 +6,62 @@
66

77

88
class LibmysqlclientRecipe(Recipe):
9-
name = 'libmysqlclient'
10-
version = 'master'
11-
url = 'https://github.com/0x-ff/libmysql-android/archive/{version}.zip'
12-
# version = '5.5.47'
13-
# url = 'http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-{version}.tar.gz'
14-
#
15-
# depends = ['ncurses']
16-
#
9+
name = 'libmysqlclient'
10+
version = 'master'
11+
url = 'https://github.com/0x-ff/libmysql-android/archive/{version}.zip'
12+
# version = '5.5.47'
13+
# url = 'http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-{version}.tar.gz'
14+
#
15+
# depends = ['ncurses']
16+
#
1717

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

20-
patches = ['disable-soversion.patch']
20+
patches = ['disable-soversion.patch']
2121

22-
def should_build(self, arch):
23-
return not self.has_libs(arch, 'libmysql.so')
22+
def should_build(self, arch):
23+
return not self.has_libs(arch, 'libmysql.so')
2424

25-
def build_arch(self, arch):
26-
env = self.get_recipe_env(arch)
27-
with current_directory(join(self.get_build_dir(arch.arch), 'libmysqlclient')):
28-
shprint(sh.cp, '-t', '.', join(self.get_recipe_dir(), 'p4a.cmake'))
29-
# shprint(sh.mkdir, 'Platform')
30-
# shprint(sh.cp, '-t', 'Platform', join(self.get_recipe_dir(), 'Linux.cmake'))
31-
shprint(sh.rm, '-f', 'CMakeCache.txt')
32-
shprint(sh.cmake, '-G', 'Unix Makefiles',
33-
# '-DCMAKE_MODULE_PATH=' + join(self.get_build_dir(arch.arch), 'libmysqlclient'),
34-
'-DCMAKE_INSTALL_PREFIX=./install',
35-
'-DCMAKE_TOOLCHAIN_FILE=p4a.cmake', _env=env)
36-
shprint(sh.make, _env=env)
25+
def build_arch(self, arch):
26+
env = self.get_recipe_env(arch)
27+
with current_directory(join(self.get_build_dir(arch.arch), 'libmysqlclient')):
28+
shprint(sh.cp, '-t', '.', join(self.get_recipe_dir(), 'p4a.cmake'))
29+
# shprint(sh.mkdir, 'Platform')
30+
# shprint(sh.cp, '-t', 'Platform', join(self.get_recipe_dir(), 'Linux.cmake'))
31+
shprint(sh.rm, '-f', 'CMakeCache.txt')
32+
shprint(sh.cmake, '-G', 'Unix Makefiles',
33+
# '-DCMAKE_MODULE_PATH=' + join(self.get_build_dir(arch.arch), 'libmysqlclient'),
34+
'-DCMAKE_INSTALL_PREFIX=./install',
35+
'-DCMAKE_TOOLCHAIN_FILE=p4a.cmake', _env=env)
36+
shprint(sh.make, _env=env)
3737

38-
self.install_libs(arch, join('libmysql', 'libmysql.so'))
38+
self.install_libs(arch, join('libmysql', 'libmysql.so'))
3939

40-
# def get_recipe_env(self, arch=None):
41-
# env = super(LibmysqlclientRecipe, self).get_recipe_env(arch)
42-
# env['WITHOUT_SERVER'] = 'ON'
43-
# ncurses = self.get_recipe('ncurses', self)
44-
# # env['CFLAGS'] += ' -I' + join(ncurses.get_build_dir(arch.arch),
45-
# # 'include')
46-
# env['CURSES_LIBRARY'] = join(self.ctx.get_libs_dir(arch.arch), 'libncurses.so')
47-
# env['CURSES_INCLUDE_PATH'] = join(ncurses.get_build_dir(arch.arch),
48-
# 'include')
49-
# return env
50-
#
51-
# def build_arch(self, arch):
52-
# env = self.get_recipe_env(arch)
53-
# with current_directory(self.get_build_dir(arch.arch)):
54-
# # configure = sh.Command('./configure')
55-
# # TODO: should add openssl as an optional dep and compile support
56-
# # shprint(configure, '--enable-shared', '--enable-assembler',
57-
# # '--enable-thread-safe-client', '--with-innodb',
58-
# # '--without-server', _env=env)
59-
# # shprint(sh.make, _env=env)
60-
# shprint(sh.cmake, '.', '-DCURSES_LIBRARY=' + env['CURSES_LIBRARY'],
61-
# '-DCURSES_INCLUDE_PATH=' + env['CURSES_INCLUDE_PATH'], _env=env)
62-
# shprint(sh.make, _env=env)
63-
#
64-
# self.install_libs(arch, 'libmysqlclient.so')
40+
# def get_recipe_env(self, arch=None):
41+
# env = super(LibmysqlclientRecipe, self).get_recipe_env(arch)
42+
# env['WITHOUT_SERVER'] = 'ON'
43+
# ncurses = self.get_recipe('ncurses', self)
44+
# # env['CFLAGS'] += ' -I' + join(ncurses.get_build_dir(arch.arch),
45+
# # 'include')
46+
# env['CURSES_LIBRARY'] = join(self.ctx.get_libs_dir(arch.arch), 'libncurses.so')
47+
# env['CURSES_INCLUDE_PATH'] = join(ncurses.get_build_dir(arch.arch),
48+
# 'include')
49+
# return env
50+
#
51+
# def build_arch(self, arch):
52+
# env = self.get_recipe_env(arch)
53+
# with current_directory(self.get_build_dir(arch.arch)):
54+
# # configure = sh.Command('./configure')
55+
# # TODO: should add openssl as an optional dep and compile support
56+
# # shprint(configure, '--enable-shared', '--enable-assembler',
57+
# # '--enable-thread-safe-client', '--with-innodb',
58+
# # '--without-server', _env=env)
59+
# # shprint(sh.make, _env=env)
60+
# shprint(sh.cmake, '.', '-DCURSES_LIBRARY=' + env['CURSES_LIBRARY'],
61+
# '-DCURSES_INCLUDE_PATH=' + env['CURSES_INCLUDE_PATH'], _env=env)
62+
# shprint(sh.make, _env=env)
63+
#
64+
# self.install_libs(arch, 'libmysqlclient.so')
6565

6666

6767
recipe = LibmysqlclientRecipe()

0 commit comments

Comments
 (0)