Skip to content

Commit d04d470

Browse files
authored
Merge pull request #919 from inclement/testapp_improvements
Testapp improvements
2 parents 7bee654 + 1f4e99f commit d04d470

File tree

12 files changed

+142
-167
lines changed

12 files changed

+142
-167
lines changed

pythonforandroid/toolchain.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -560,11 +560,13 @@ def clean_dists(self, args):
560560

561561
def clean_bootstrap_builds(self, args):
562562
'''Delete all the bootstrap builds.'''
563-
for bs in Bootstrap.list_bootstraps():
564-
bs = Bootstrap.get_bootstrap(bs, self.ctx)
565-
if bs.build_dir and exists(bs.build_dir):
566-
info('Cleaning build for {} bootstrap.'.format(bs.name))
567-
shutil.rmtree(bs.build_dir)
563+
if exists(join(self.ctx.build_dir, 'bootstrap_builds')):
564+
shutil.rmtree(join(self.ctx.build_dir, 'bootstrap_builds'))
565+
# for bs in Bootstrap.list_bootstraps():
566+
# bs = Bootstrap.get_bootstrap(bs, self.ctx)
567+
# if bs.build_dir and exists(bs.build_dir):
568+
# info('Cleaning build for {} bootstrap.'.format(bs.name))
569+
# shutil.rmtree(bs.build_dir)
568570

569571
def clean_builds(self, args):
570572
'''Delete all build caches for each recipe, python-install, java code
@@ -610,7 +612,7 @@ def clean_download_cache(self, args):
610612
This does *not* delete the build caches or final distributions.
611613
'''
612614
ctx = self.ctx
613-
if args.recipes:
615+
if hasattr(args, 'recipes') and args.recipes:
614616
for package in args.recipes:
615617
remove_path = join(ctx.packages_path, package)
616618
if exists(remove_path):

testapps/setup_keyboard.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
from distutils.core import setup
3+
from setuptools import find_packages
4+
5+
options = {'apk': {'debug': None,
6+
'requirements': 'sdl2,pyjnius,kivy,python2',
7+
'android-api': 19,
8+
'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2',
9+
'dist-name': 'bdisttest',
10+
'ndk-version': '10.3.2',
11+
'permission': 'VIBRATE',
12+
}}
13+
14+
package_data = {'': ['*.py',
15+
'*.png']
16+
}
17+
18+
packages = find_packages()
19+
print('packages are', packages)
20+
21+
setup(
22+
name='testapp_keyboard',
23+
version='1.1',
24+
description='p4a setup.py test',
25+
author='Alexander Taylor',
26+
author_email='[email protected]',
27+
packages=find_packages(),
28+
options=options,
29+
package_data={'setup_keyboard': ['*.py', '*.png']}
30+
)

testapps/setup_pygame.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
from distutils.core import setup
3+
from setuptools import find_packages
4+
5+
options = {'apk': {'debug': None,
6+
'requirements': 'pygame,pyjnius,kivy,python2',
7+
'android-api': 19,
8+
'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2',
9+
'dist-name': 'bdisttest_pygame',
10+
'orientation': 'portrait',
11+
'ndk-version': '10.3.2',
12+
'permission': 'VIBRATE',
13+
}}
14+
15+
package_data = {'': ['*.py',
16+
'*.png']
17+
}
18+
19+
packages = find_packages()
20+
print('packages are', packages)
21+
22+
setup(
23+
name='testapp_setup_pygame',
24+
version='1.1',
25+
description='p4a setup.py test with pygame',
26+
author='Alexander Taylor',
27+
author_email='[email protected]',
28+
packages=find_packages(),
29+
options=options,
30+
package_data={'testapp_pygame': ['*.py', '*.png']}
31+
)

testapps/testapp_setup/setup.py renamed to testapps/setup_testapp_python2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
print('packages are', packages)
2020

2121
setup(
22-
name='testapp_setup',
22+
name='testapp_python2',
2323
version='1.1',
2424
description='p4a setup.py test',
2525
author='Alexander Taylor',

testapps/setup_testapp_python3.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
from distutils.core import setup
3+
from setuptools import find_packages
4+
5+
options = {'apk': {'debug': None,
6+
'requirements': 'sdl2,pyjnius,kivy,python3crystax',
7+
'android-api': 19,
8+
'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2',
9+
'dist-name': 'bdisttest',
10+
'ndk-version': '10.3.2',
11+
'permission': 'VIBRATE',
12+
}}
13+
14+
package_data = {'': ['*.py',
15+
'*.png']
16+
}
17+
18+
packages = find_packages()
19+
print('packages are', packages)
20+
21+
setup(
22+
name='testapp_python3',
23+
version='1.1',
24+
description='p4a setup.py test',
25+
author='Alexander Taylor',
26+
author_email='[email protected]',
27+
packages=find_packages(),
28+
options=options,
29+
package_data={'testapp': ['*.py', '*.png']}
30+
)

testapps/setup_vispy.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
from distutils.core import setup
3+
from setuptools import find_packages
4+
5+
options = {'apk': {'debug': None,
6+
'requirements': 'vispy',
7+
'android-api': 19,
8+
'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2',
9+
'dist-name': 'bdisttest',
10+
'ndk-version': '10.3.2',
11+
'permission': 'VIBRATE',
12+
}}
13+
14+
package_data = {'': ['*.py',
15+
'*.png']
16+
}
17+
18+
packages = find_packages()
19+
print('packages are', packages)
20+
21+
setup(
22+
name='testapp_vispy',
23+
version='1.1',
24+
description='p4a setup.py test',
25+
author='Alexander Taylor',
26+
author_email='[email protected]',
27+
packages=find_packages(),
28+
options=options,
29+
package_data={'testapp_vispy': ['*.py', '*.png']}
30+
)

testapps/testapp/main.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@
33
import os
44
print('imported os')
55

6-
print('contents of ./lib/python2.7/site-packages/ etc.')
7-
print(os.listdir('./lib'))
8-
print(os.listdir('./lib/python2.7'))
9-
print(os.listdir('./lib/python2.7/site-packages'))
106

11-
print('contents of this dir', os.listdir('./'))
7+
print('this dir is', os.path.abspath(os.curdir))
128

13-
with open('./lib/python2.7/site-packages/kivy/app.pyo', 'rb') as fileh:
14-
print('app.pyo size is', len(fileh.read()))
9+
print('contents of this dir', os.listdir('./'))
1510

1611
import sys
1712
print('pythonpath is', sys.path)
@@ -35,6 +30,7 @@
3530

3631
kv = '''
3732
#:import Metrics kivy.metrics.Metrics
33+
#:import sys sys
3834
3935
<FixedSizeButton@Button>:
4036
size_hint_y: None
@@ -63,6 +59,14 @@
6359
markup: True
6460
text: '[b]Kivy[/b] on [b]SDL2[/b] on [b]Android[/b]!'
6561
halign: 'center'
62+
Label:
63+
height: self.texture_size[1]
64+
size_hint_y: None
65+
text_size: self.size[0], None
66+
markup: True
67+
text: sys.version
68+
halign: 'center'
69+
padding_y: dp(10)
6670
Widget:
6771
size_hint_y: None
6872
height: 20
@@ -83,7 +87,7 @@
8387
Widget:
8488
size_hint_y: None
8589
height: 1000
86-
on_touch_down: print 'touched at', args[-1].pos
90+
on_touch_down: print('touched at', args[-1].pos)
8791
8892
<ErrorPopup>:
8993
title: 'Error'

testapps/testapp_setup/setup.cfg

Whitespace-only changes.

0 commit comments

Comments
 (0)