8000 Merge branch 'master' into doc_and_cosmetics · bb33bb/python-for-android@e885739 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit e885739

Browse files
authored
Merge branch 'master' into doc_and_cosmetics
2 parents df428cb + 4f57863 commit e885739

File tree

47 files changed

+372
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+372
-263
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
The issue tracker is a tool to address bugs.
3-
Please use the #kivy IRC channel on freenode or Stack Overflow for
4-
support questions, more information at https://github.com/kivy/python-for-android#support
3+
Please use the Disord community or Stack Overflow for support questions,
4+
more information at https://github.com/kivy/python-for-android#support
55
66
Before opening a new issue, make sure you do the following:
77
* check that your issue isn't already filed: https://github.com/kivy/python-for-android/issues

.travis.yml

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

88
before_install:
99
- sudo apt-get update -qq
10-
- sudo apt-get install -qq python-tox
10+
- sudo apt-get install -qq python2.7 python3
11+
- sudo pip install tox>=2.0
1112

1213
env:
1314
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk'

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# TODO:
1212
# - delete archives to keep small the container small
1313
# - setup caching (for apt, pip, ndk, sdk and p4a recipes downloads)
14-
FROM ubuntu:16.04
14+
FROM ubuntu:18.04
1515

1616

1717
# get the latest version from https://developer.android.com/ndk/downloads/index.html

README.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ If you need assistance, you can ask for help on our mailing list:
7575
- User Group: https://groups.google.com/group/kivy-users
7676
- Email: kivy-users@googlegroups.com
7777

78-
We also have an IRC channel:
79-
80-
- Server: irc.freenode.net
81-
- Port: 6667, 6697 (SSL only)
82-
- Channel: #kivy
78+
We also have `#support Discord channel <https://chat.kivy.org/>`_.
8379

8480
Contributing
8581
============
@@ -94,11 +90,7 @@ discussions about developing the Kivy framework and its sister projects:
9490
- Dev Group: https://groups.google.com/group/kivy-dev
9591
- Email: kivy-dev@googlegroups.com
9692

97-
IRC channel:
98-
99-
- Server: irc.freenode.net
100-
- Port: 6667, 6697 (SSL only)
101-
- Channel: #kivy or #kivy-dev
93+
We also have `#dev Discord channel <https://chat.kivy.org/>`_.
10294

10395
License
10496
=======

doc/source/services.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,23 @@ code), you must use PyJNIus to interact with the java class
6868
python-for-android creates for each one, as follows::
6969

7070
from jnius import autoclass
71-
service = autoclass('your.package.name.ServiceMyservice')
71+
service = autoclass('your.package.domain.package.name.ServiceMyservice')
7272
mActivity = autoclass('org.kivy.android.PythonActivity').mActivity
7373
argument = ''
7474
service.start(mActivity, argument)
7575

76-
Here, ``your.package.name`` refers to the package identifier of your
77-
APK as set by the ``--package`` argument to python-for-android, and
78-
the name of the service is ``ServiceMyservice``, in which ``Myservice``
79-
is the identifier that was previously passed to the ``--service``
76+
Here, ``your.package.domain.package.name`` refers to the package identifier
77+
of your APK.
78+
79+
If you are using buildozer, the identifier is set by the ``package.name``
80+
and ``package.domain`` values in your buildozer.spec file.
81+
The name of the service is ``ServiceMyservice``, where ``Myservice``
82+
is the name specied by one of the ``services`` values, but with the first
83+
letter upper case.
84+
85+
If you are using python-for-android directly, the identifier is set by the ``--package``
86+
argument to python-for-android. The name of the service is ``ServiceMyservice``,
87+
where ``Myservice`` is the identifier that was previously passed to the ``--service``
8088
argument, but with the first letter upper case. You must also pass the
8189
``argument`` parameter even if (as here) it is an empty string. If you
8290
do pass it, the service can make use of this argument.

doc/source/troubleshooting.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Add the ``--debug`` option to any python-for-android command to see
1010
full debug output including the output of all the external tools used
1111
in the compilation and packaging steps.
1212

13-
If reporting a problem by email or irc, it is usually helpful to
13+
If reporting a problem by email or Discord, it is usually helpful to
1414
include this full log, via e.g. a `pastebin
1515
<http://paste.ubuntu.com/>`_ or `Github gist
1616
<https://gist.github.com/>`_.
@@ -23,7 +23,7 @@ get help with any problems using the same channels as Kivy itself:
2323

2424
- by email to the `kivy-users Google group
2525
<https://groups.google.com/forum/#!forum/kivy-users>`_
26-
- by irc in the #kivy room at irc.freenode.net
26+
- on `#support Discord channel <https://chat.kivy.org/>`_
2727

2828
If you find a bug, you can also post an issue on the
2929
`python-for-android Github page

pythonforandroid/bdistapk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _set_user_options():
136136
for i, arg in enumerate(sys.argv):
137137
if arg.startswith('--'):
138138
if ('=' in arg or
139-
(i < (len(sys.argv) - 1) and not sys.argv[i+1].startswith('-'))):
139+
(i < (len(sys.argv) - 1) and not sys.argv[i+1].startswith('-'))):
140140
user_options.append((arg[2:].split('=')[0] + '=', None, None))
141141
else:
142142
user_options.append((arg[2:], None, None))

pythonforandroid/bootstraps/pygame/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def run_distribute(self):
5454
if not exists('python-install'):
5555
shprint(sh.cp, '-a', self.ctx.get_python_install_dir(), './python-install')
5656

57-
self.distribute_libs(arch, [join(self.build_dir, 'libs', arch.arch), self.ctx.get_libs_dir(arch.arch)]);
57+
self.distribute_libs(arch, [join(self.build_dir, 'libs', arch.arch), self.ctx.get_libs_dir(arch.arch)])
5858
self.distribute_aars(arch)
5959
self.distribute_javaclasses(self.ctx.javaclass_dir)
6060

pythonforandroid/bootstraps/pygame/build/build.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ def select(fn):
133133
fn = realpath(fn)
134134
assert(fn.startswith(d))
135135
fn = fn[len(d):]
136-
if (fn.startswith('/site-packages/') or
137-
fn.startswith('/config/') or
138-
fn.startswith('/lib-dynload/') or
139-
fn.startswith('/libpymodules.so')):
136+
if (fn.startswith('/site-packages/')
137+
or fn.startswith('/config/')
138+
or fn.startswith('/lib-dynload/')
139+
or fn.startswith('/libpymodules.so')):
140140
return False
141141
return fn
142142

@@ -183,7 +183,6 @@ def select(fn):
183183
tf = tarfile.open(tfn, 'w:gz', format=tarfile.USTAR_FORMAT)
184184
dirs = []
185185
for fn, afn in files:
186-
# print('%s: %s' % (tfn, fn))
187186
dn = dirname(afn)
188187
if dn not in dirs:
189188
# create every dirs first if not exist yet

pythonforandroid/bootstraps/pygame/build/buildlib/argparse.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,8 @@ def _split_lines(self, text, width):
651651

652652
def _fill_text(self, text, width, indent):
653653
text = self._whitespace_matcher.sub(' ', text).strip()
654-
return _textwrap.fill(text, width, initial_indent=indent,
655-
subsequent_indent=indent)
654+
return _textwrap.fill(
655+
text, width, initial_indent=indent, subsequent_indent=indent)
656656

657657
def _get_help_string(self, action):
658658
return action.help
@@ -705,7 +705,7 @@ def _get_action_name(argument):
705705
if argument is None:
706706
return None
707707
elif argument.option_strings:
708-
return '/'.join(argument.option_strings)
708+
return '/'.join(argument.option_strings)
709709
elif argument.metavar not in (None, SUPPRESS):
710710
return argument.metavar
711711
elif argument.dest not in (None, SUPPRESS):
@@ -2070,8 +2070,8 @@ def _parse_optional(self, arg_string):
20702070

20712071
# if multiple actions match, the option string was ambiguous
20722072
if len(option_tuples) > 1:
2073-
options = ', '.join([option_string
2074-
for action, option_string, explicit_arg in option_tuples])
2073+
options = ', '.join(
2074+
[option_string for action, option_string, explicit_arg in option_tuples])
20752075
tup = arg_string, options
20762076
self.error(_('ambiguous option: %s could match %s') % tup)
20772077

pythonforandroid/bootstraps/pygame/build/tools/biglink

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import os
55
import sys
66
import subprocess
77

8-
sofiles = [ ]
8+
sofiles = []
99

1010
for directory in sys.argv[2:]:
1111

@@ -20,7 +20,7 @@ for directory in sys.argv[2:]:
2020
sofiles.append(fn[:-2])
2121

2222
# The raw argument list.
23-
args = [ ]
23+
args = []
2424

2525
for fn in sofiles:
2626
afn = fn + ".o"
@@ -31,7 +31,7 @@ for fn in sofiles:
3131
data = fd.read()
3232
args.extend(data.split(" "))
3333

34-
unique_args = [ ]
34+
unique_args = []
3535
while args:
3636
a = args.pop()
3737
if a in ('-L', ):

pythonforandroid/bootstraps/pygame/build/tools/biglink-jb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ blacklist_libs = (
2525
)
2626

2727
found_libs = []
28-
sofiles = [ ]
28+
sofiles = []
2929

3030
for directory in sys.argv[2:]:
3131

pythonforandroid/bootstraps/pygame/build/tools/liblink

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import subprocess
66
from os import environ
77
from os.path import basename, join
88

9-
libs = [ ]
10-
objects = [ ]
9+
libs = []
10+
objects = []
1111
output = None
1212

1313

pythonforandroid/bootstraps/pygame/build/tools/liblink-jb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import subprocess
66
from os import environ
77
from os.path import basename, join
88

9-
libs = [ ]
10-
libdirs = [ ]
9+
libs = []
10+
libdirs = []
1111
output = None
1212

1313

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ def select(fn):
137137
fn = realpath(fn)
138138
assert(fn.startswith(d))
139139
fn = fn[len(d):]
140-
if (fn.startswith('/site-packages/') or
141-
fn.startswith('/config/') or
142-
fn.startswith('/lib-dynload/') or
143-
fn.startswith('/libpymodules.so')):
140+
if (fn.startswith('/site-packages/')
141+
or fn.startswith('/config/')
142+
or fn.startswith('/lib-dynload/')
143+
or fn.startswith('/libpymodules.so')):
144144
return False
145145
return fn
146146

@@ -187,7 +187,6 @@ def select(fn):
187187
tf = tarfile.open(tfn, 'w:gz', format=tarfile.USTAR_FORMAT)
188188
dirs = []
189189
for fn, afn in files:
190-
# print('%s: %s' % (tfn, fn))
191190
dn = dirname(afn)
192191
if dn not in dirs:
193192
# create every dirs first if not exist yet

pythonforandroid/bootstraps/service_only/build/build.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ def select(fn):
128128
fn = realpath(fn)
129129
assert(fn.startswith(d))
130130
fn = fn[len(d):]
131-
if (fn.startswith('/site-packages/') or
132-
fn.startswith('/config/') or
133-
fn.startswith('/lib-dynload/') or
134-
fn.startswith('/libpymodules.so')):
131+
if (fn.startswith('/site-packages/')
132+
or fn.startswith('/config/')
133+
or fn.startswith('/lib-dynload/')
134+
or fn.startswith('/libpymodules.so')):
135135
return False
136136
return fn
137137

@@ -178,7 +178,6 @@ def select(fn):
178178
tf = tarfile.open(tfn, 'w:gz', format=tarfile.USTAR_FORMAT)
179179
dirs = []
180180
for fn, afn in files:
181-
# print('%s: %s' % (tfn, fn))
182181
dn = dirname(afn)
183182
if dn not in dirs:
184183
# create every dirs first if not exist yet

pythonforandroid/bootstraps/webview/build/build.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ def select(fn):
129129
fn = realpath(fn)
130130
assert(fn.startswith(d))
131131
fn = fn[len(d):]
132-
if (fn.startswith('/site-packages/') or
133-
fn.startswith('/config/') or
134-
fn.startswith('/lib-dynload/') or
135-
fn.startswith('/libpymodules.so')):
132+
if (fn.startswith('/site-packages/')
133+
or fn.startswith('/config/')
134+
or fn.startswith('/lib-dynload/')
135+
or fn.startswith('/libpymodules.so')):
136136
return False
137137
return fn
138138

@@ -179,7 +179,6 @@ def select(fn):
179179
tf = tarfile.open(tfn, 'w:gz', format=tarfile.USTAR_FORMAT)
180180
dirs = []
181181
for fn, afn in files:
182-
# print('%s: %s' % (tfn, fn))
183182
dn = dirname(afn)
184183
if dn not in dirs:
185184
# create every dirs first if not exist yet

pythonforandroid/build.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,19 @@ class Context(object):
2323
will be instantiated and used to hold all the build state.'''
2424

2525
env = environ.copy()
26-
root_dir = None # the filepath of toolchain.py
27-
storage_dir = None # the root dir where builds and dists will be stored
28-
29-
build_dir = None # in which bootstraps are copied for building
30-
# and recipes are built
31-
dist_dir = None # the Android project folder where everything ends up
32-
libs_dir = None # where Android libs are cached after build but
33-
# before being placed in dists
26+
# the filepath of toolchain.py
27+
root_dir = None
28+
# the root dir where builds and dists will be stored
29+
storage_dir = None
30+
31+
# in which bootstraps are copied for building
32+
# and recipes are built
33+
build_dir = None
34+
# the Android project folder where everything ends up
35+
dist_dir = None
36+
# where Android libs are cached after build
37+
# but before being placed in dists
38+
libs_dir = None
3439
aars_dir = None
3540

3641
ccache = None # whether to use ccache
@@ -178,12 +183,14 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
178183
sdk_dir = None
179184
if user_sdk_dir:
180185
sdk_dir = user_sdk_dir
181-
if sdk_dir is None: # This is the old P4A-specific var
186+
# This is the old P4A-specific var
187+
if sdk_dir is None:
182188
sdk_dir = environ.get('ANDROIDSDK', None)
183-
if sdk_dir is None: # This seems used more conventionally
189+
# This seems used more conventionally
190+
if sdk_dir is None:
184191
sdk_dir = environ.get('ANDROID_HOME', None)
185-
if sdk_dir is None: # Checks in the buildozer SDK dir, useful
186-
# for debug tests of p4a
192+
# Checks in the buildozer SDK dir, useful for debug tests of p4a
193+
if sdk_dir is None:
187194
possible_dirs = glob.glob(expanduser(join(
188195
'~', '.buildozer', 'android', 'platform', 'android-sdk-*')))
189196
possible_dirs = [d for d in possible_dirs if not
@@ -842,8 +849,8 @@ def copylibs_function(soname, objs_paths, extra_link_dirs=[], env=None):
842849
if needso:
843850
lib = needso.group(1)
844851
if (lib not in needed_libs
845-
and lib not in found_libs
846-
and lib not in blacklist_libs):
852+
and lib not in found_libs
853+
and lib not in blacklist_libs):
847854
needed_libs.append(needso.group(1))
848855

849856
sofiles += found_sofiles

0 commit comments

Comments
 (0)
0