Merge pull request #1071 from lerela/1070_fix_python3_raw_input

Support for both input and raw_input in iOS target to avoid NameError with Python 3
This commit is contained in:
Andre Miras 2020-04-24 19:34:47 +02:00 committed by GitHub
commit 504efcc243
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,11 +7,12 @@ if sys.platform != 'darwin':
raise NotImplementedError('Windows platform not yet working for Android')
import plistlib
from buildozer import BuildozerCommandException
from buildozer import BuildozerCommandException, IS_PY3
from buildozer.target import Target, no_config
from os.path import join, basename, expanduser, realpath
from getpass import getpass
PHP_TEMPLATE = '''
<?php
// credits goes to http://jeffreysambells.com/2010/06/22/ios-wireless-app-distribution
@ -395,7 +396,12 @@ class TargetIos(Target):
save = None
while save is None:
q = raw_input('Do you want to save the password (Y/n): ')
if IS_PY3:
input_func = input
else:
input_func = raw_input
q = input_func('Do you want to save the password (Y/n): ')
if q in ('', 'Y'):
save = True
elif q == 'n':
@ -405,7 +411,7 @@ class TargetIos(Target):
if save:
with open(password_file, 'wb') as fd:
fd.write(password)
fd.write(password.encode())
def get_target(buildozer):
return TargetIos(buildozer)