-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Corrections for Fix bootstraps for webview and service_only
(recently merged)
#1586
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,9 +336,11 @@ def make_package(args): | |
with open(args.intent_filters) as fd: | ||
args.intent_filters = fd.read() | ||
|
||
# if get_bootstrap_name() == "sdl2": | ||
args.add_activity = args.add_activity or [] | ||
args.activity_launch_mode = args.activity_launch_mode or '' | ||
if not args.add_activity: | ||
args.add_activity = [] | ||
|
||
if not args.activity_launch_mode: | ||
args.activity_launch_mode = '' | ||
|
||
if args.extra_source_dirs: | ||
esd = [] | ||
|
@@ -536,6 +538,9 @@ def parse_args(args=None): | |
ap.add_argument('--icon', dest='icon', | ||
help=('A png file to use as the icon for ' | ||
'the application.')) | ||
ap.add_argument('--service', dest='services', action='append', | ||
help='Declare a new service entrypoint: ' | ||
'NAME:PATH_TO_PY[:foreground]') | ||
if get_bootstrap_name() != "service_only": | ||
ap.add_argument('--presplash', dest='presplash', | ||
help=('A jpeg file to use as a screen while the ' | ||
|
@@ -564,10 +569,6 @@ def parse_args(args=None): | |
'https://developer.android.com/guide/' | ||
'topics/manifest/' | ||
'activity-element.html')) | ||
else: | ||
ap.add_argument('--service', dest='services', action='append', | ||
help='Declare a new service entrypoint: ' | ||
'NAME:PATH_TO_PY[:foreground]') | ||
ap.add_argument('--wakelock', dest='wakelock', action='store_true', | ||
help=('Indicate if the application needs the device ' | ||
'to stay on')) | ||
|
@@ -687,7 +688,7 @@ def _read_configuration(): | |
if args.meta_data is None: | ||
args.meta_data = [] | ||
|
||
if (not hasattr(args, 'services')) or args.services is None: | ||
if args.services is None: | ||
args.services = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now I'm thinking we may go even more concise with: args.services = getattr(args, 'services', []) What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes that looks exactly how the default value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh wait, actually this was supposed to also apply if args.services is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would work, but it looks uglier: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, the semantic would not be the same for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm only if the default is wrong, I suppose. if we checked that the default has a proper value and never |
||
|
||
if args.try_system_python_compile: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
from setuptools import find_packages | ||
|
||
options = {'apk': {'debug': None, | ||
'requirements': 'python2,genericndkbuild', | ||
'requirements': 'python2,genericndkbuild,pyjnius', | ||
'android-api': 27, | ||
'ndk-api': 21, | ||
'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2', | ||
|
@@ -12,6 +12,7 @@ | |
'bootstrap': 'service_only', | ||
'permissions': ['INTERNET', 'VIBRATE'], | ||
'arch': 'armeabi-v7a', | ||
'service': 'time:p4atime.py', | ||
}} | ||
|
||
package_data = {'': ['*.py']} | ||
|
@@ -21,7 +22,7 @@ | |
|
||
setup( | ||
name='testapp_service', | ||
version='1.0', | ||
version='1.1', | ||
description='p4a service testapp', | ||
author='Alexander Taylor', | ||
author_email='[email protected]', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import datetime | ||
import threading | ||
import time | ||
from os import environ | ||
argument = environ.get('PYTHON_SERVICE_ARGUMENT', '') | ||
print('p4atime.py was successfully called with argument: "{}"'.format(argument)) | ||
|
||
next_call = time.time() | ||
|
||
|
||
def service_timer(): | ||
global next_call | ||
print('P4a datetime service: {}'.format(datetime.datetime.now())) | ||
next_call = next_call + 1 | ||
threading.Timer(next_call - time.time(), service_timer).start() | ||
|
||
|
||
print('Starting the service timer...') | ||
service_timer() |
Uh oh!
There was an error while loading. Please reload this page.