本文整理汇总了Python中pythonforandroid.bootstrap.Bootstrap.get_bootstrap方法的典型用法代码示例。如果您正苦于以下问题:Python Bootstrap.get_bootstrap方法的具体用法?Python Bootstrap.get_bootstrap怎么用?Python Bootstrap.get_bootstrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pythonforandroid.bootstrap.Bootstrap
的用法示例。
在下文中一共展示了Bootstrap.get_bootstrap方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_dist_from_args
# 需要导入模块: from pythonforandroid.bootstrap import Bootstrap [as 别名]
# 或者: from pythonforandroid.bootstrap.Bootstrap import get_bootstrap [as 别名]
def build_dist_from_args(ctx, dist, args):
'''Parses out any bootstrap related arguments, and uses them to build
a dist.'''
bs = Bootstrap.get_bootstrap(args.bootstrap, ctx)
build_order, python_modules, bs \
= get_recipe_order_and_bootstrap(ctx, dist.recipes, bs)
ctx.recipe_build_order = build_order
info('The selected bootstrap is {}'.format(bs.name))
info_main('# Creating dist with {} bootstrap'.format(bs.name))
bs.distribution = dist
info_notify('Dist will have name {} and recipes ({})'.format(
dist.name, ', '.join(dist.recipes)))
ctx.dist_name = bs.distribution.name
ctx.prepare_bootstrap(bs)
ctx.prepare_dist(ctx.dist_name)
build_recipes(build_order, python_modules, ctx)
ctx.bootstrap.run_distribute()
info_main('# Your distribution was created successfully, exiting.')
info('Dist can be found at (for now) {}'
.format(join(ctx.dist_dir, ctx.dist_name)))
示例2: clean_bootstrap_builds
# 需要导入模块: from pythonforandroid.bootstrap import Bootstrap [as 别名]
# 或者: from pythonforandroid.bootstrap.Bootstrap import get_bootstrap [as 别名]
def clean_bootstrap_builds(self, args):
'''Delete all the bootstrap builds.'''
for bs in Bootstrap.list_bootstraps():
bs = Bootstrap.get_bootstrap(bs, self.ctx)
if bs.build_dir and exists(bs.build_dir):
info('Cleaning build for {} bootstrap.'.format(bs.name))
shutil.rmtree(bs.build_dir)
示例3: build_dist_from_args
# 需要导入模块: from pythonforandroid.bootstrap import Bootstrap [as 别名]
# 或者: from pythonforandroid.bootstrap.Bootstrap import get_bootstrap [as 别名]
def build_dist_from_args(ctx, dist, args):
'''Parses out any bootstrap related arguments, and uses them to build
a dist.'''
bs = Bootstrap.get_bootstrap(args.bootstrap, ctx)
build_order, python_modules, bs \
= get_recipe_order_and_bootstrap(ctx, dist.recipes, bs)
ctx.recipe_build_order = build_order
ctx.python_modules = python_modules
if python_modules and hasattr(sys, 'real_prefix'):
error('virtualenv is needed to install pure-Python modules, but')
error('virtualenv does not support nesting, and you are running')
error('python-for-android in one. Please run p4a outside of a')
error('virtualenv instead.')
exit(1)
info('The selected bootstrap is {}'.format(bs.name))
info_main('# Creating dist with {} bootstrap'.format(bs.name))
bs.distribution = dist
info_notify('Dist will have name {} and recipes ({})'.format(
dist.name, ', '.join(dist.recipes)))
ctx.dist_name = bs.distribution.name
ctx.prepare_bootstrap(bs)
ctx.prepare_dist(ctx.dist_name)
build_recipes(build_order, python_modules, ctx)
ctx.bootstrap.run_distribute()
info_main('# Your distribution was created successfully, exiting.')
info('Dist can be found at (for now) {}'
.format(join(ctx.dist_dir, ctx.dist_name)))
示例4: bootstraps
# 需要导入模块: from pythonforandroid.bootstrap import Bootstrap [as 别名]
# 或者: from pythonforandroid.bootstrap.Bootstrap import get_bootstrap [as 别名]
def bootstraps(self, args):
'''List all the bootstraps available to build with.'''
for bs in Bootstrap.list_bootstraps():
bs = Bootstrap.get_bootstrap(bs, self.ctx)
print('{Fore.BLUE}{Style.BRIGHT}{bs.name}{Style.RESET_ALL}'
.format(bs=bs, Fore=Out_Fore, Style=Out_Style))
print(' {Fore.GREEN}depends: {bs.recipe_depends}{Fore.RESET}'
.format(bs=bs, Fore=Out_Fore))
示例5: test_blacklist
# 需要导入模块: from pythonforandroid.bootstrap import Bootstrap [as 别名]
# 或者: from pythonforandroid.bootstrap.Bootstrap import get_bootstrap [as 别名]
def test_blacklist():
# First, get order without blacklist:
build_order, python_modules, bs = get_recipe_order_and_bootstrap(
ctx, ["python3", "kivy"], None
)
# Now, obtain again with blacklist:
build_order_2, python_modules_2, bs_2 = get_recipe_order_and_bootstrap(
ctx, ["python3", "kivy"], None, blacklist=["libffi"]
)
assert "libffi" not in build_order_2
assert set(build_order_2).union({"libffi"}) == set(build_order)
# Check that we get a conflict when using webview and kivy combined:
wbootstrap = Bootstrap.get_bootstrap('webview', ctx)
with pytest.raises(BuildInterruptingException) as e_info:
get_recipe_order_and_bootstrap(ctx, ["flask", "kivy"], wbootstrap)
assert "conflict" in e_info.value.message.lower()
# We should no longer get a conflict blacklisting sdl2 and pygame:
get_recipe_order_and_bootstrap(
ctx, ["flask", "kivy"], wbootstrap, blacklist=["sdl2", "pygame"]
)
示例6: build_dist_from_args
# 需要导入模块: from pythonforandroid.bootstrap import Bootstrap [as 别名]
# 或者: from pythonforandroid.bootstrap.Bootstrap import get_bootstrap [as 别名]
def build_dist_from_args(ctx, dist, args_list):
'''Parses out any bootstrap related arguments, and uses them to build
a dist.'''
parser = argparse.ArgumentParser(
description='Create a newAndroid project')
parser.add_argument(
'--bootstrap',
help=('The name of the bootstrap type, \'pygame\' '
'or \'sdl2\', or leave empty to let a '
'bootstrap be chosen automatically from your '
'requirements.'),
default=None)
args, unknown = parser.parse_known_args(args_list)
bs = Bootstrap.get_bootstrap(args.bootstrap, ctx)
build_order, python_modules, bs \
= get_recipe_order_and_bootstrap(ctx, dist.recipes, bs)
info('The selected bootstrap is {}'.format(bs.name))
info_main('# Creating dist with {} bootstrap'.format(bs.name))
bs.distribution = dist
info_notify('Dist will have name {} and recipes ({})'.format(
dist.name, ', '.join(dist.recipes)))
ctx.dist_name = bs.distribution.name
ctx.prepare_bootstrap(bs)
ctx.prepare_dist(ctx.dist_name)
build_recipes(build_order, python_modules, ctx)
ctx.bootstrap.run_distribute()
info_main('# Your distribution was created successfully, exiting.')
info('Dist can be found at (for now) {}'
.format(join(ctx.dist_dir, ctx.dist_name)))
return unknown
示例7: Context
# 需要导入模块: from pythonforandroid.bootstrap import Bootstrap [as 别名]
# 或者: from pythonforandroid.bootstrap.Bootstrap import get_bootstrap [as 别名]
from pythonforandroid.build import Context
from pythonforandroid.graph import get_recipe_order_and_bootstrap
from pythonforandroid.bootstrap import Bootstrap
from itertools import product
import pytest
ctx = Context()
name_sets = [['python2'],
['kivy']]
bootstraps = [None,
Bootstrap.get_bootstrap('pygame', ctx),
Bootstrap.get_bootstrap('sdl2', ctx)]
valid_combinations = list(product(name_sets, bootstraps))
valid_combinations.extend(
[(['python3crystax'], Bootstrap.get_bootstrap('sdl2', ctx)),
(['kivy', 'python3crystax'], Bootstrap.get_bootstrap('sdl2', ctx))])
invalid_combinations = [[['python2', 'python3crystax'], None]]
@pytest.mark.parametrize('names,bootstrap', valid_combinations)
def test_valid_recipe_order_and_bootstrap(names, bootstrap):
get_recipe_order_and_bootstrap(ctx, names, bootstrap)
@pytest.mark.parametrize('names,bootstrap', invalid_combinations)
def test_invalid_recipe_order_and_bootstrap(names, bootstrap):
with pytest.raises(SystemExit):
get_recipe_order_and_bootstrap(ctx, names, bootstrap)
示例8: Context
# 需要导入模块: from pythonforandroid.bootstrap import Bootstrap [as 别名]
# 或者: from pythonforandroid.bootstrap.Bootstrap import get_bootstrap [as 别名]
from pythonforandroid.build import Context
from pythonforandroid.graph import get_recipe_order_and_bootstrap
from pythonforandroid.bootstrap import Bootstrap
from itertools import product
import pytest
ctx = Context()
name_sets = [['python2'],
['kivy']]
bootstraps = [None,
Bootstrap.get_bootstrap('pygame', ctx),
Bootstrap.get_bootstrap('sdl2', ctx)]
valid_combinations = list(product(name_sets, bootstraps))
valid_combinations.extend(
[(['python3crystax'], Bootstrap.get_bootstrap('sdl2', ctx)),
(['kivy', 'python3crystax'], Bootstrap.get_bootstrap('sdl2', ctx))])
@pytest.mark.parametrize('names,bootstrap', valid_combinations)
def test_valid_recipe_order_and_bootstrap(names, bootstrap):
get_recipe_order_and_bootstrap(ctx, names, bootstrap)
invalid_combinations = [[['python2', 'python3crystax'], None],
[['python3'], Bootstrap.get_bootstrap('pygame', ctx)]]
@pytest.mark.parametrize('names,bootstrap', invalid_combinations)
def test_invalid_recipe_order_and_bootstrap(names, bootstrap):
with pytest.raises(SystemExit):
示例9: Context
# 需要导入模块: from pythonforandroid.bootstrap import Bootstrap [as 别名]
# 或者: from pythonforandroid.bootstrap.Bootstrap import get_bootstrap [as 别名]
get_recipe_order_and_bootstrap, obvious_conflict_checker,
)
from pythonforandroid.bootstrap import Bootstrap
from pythonforandroid.recipe import Recipe
from pythonforandroid.util import BuildInterruptingException
from itertools import product
import mock
import pytest
ctx = Context()
name_sets = [['python2'],
['kivy']]
bootstraps = [None,
Bootstrap.get_bootstrap('sdl2', ctx)]
valid_combinations = list(product(name_sets, bootstraps))
valid_combinations.extend(
[(['python3crystax'], Bootstrap.get_bootstrap('sdl2', ctx)),
(['kivy', 'python3crystax'], Bootstrap.get_bootstrap('sdl2', ctx)),
(['flask'], Bootstrap.get_bootstrap('webview', ctx)),
(['pysdl2'], None), # auto-detect bootstrap! important corner case
]
)
invalid_combinations = [
[['python2', 'python3crystax'], None],
[['pysdl2', 'genericndkbuild'], None],
]
invalid_combinations_simple = list(invalid_combinations)
# NOTE !! keep in mind when setting invalid_combinations_simple:
#