本文整理汇总了Python中pythonforandroid.toolchain.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_armeabi
def build_armeabi(self):
# AND: Should use an i386 recipe system
warning('Running hostpython build. Arch is armeabi! '
'This is naughty, need to fix the Arch system!')
# AND: Fix armeabi again
with current_directory(self.get_build_dir('armeabi')):
if exists('hostpython'):
info('hostpython already exists, skipping build')
self.ctx.hostpython = join(self.get_build_dir('armeabi'),
'hostpython')
self.ctx.hostpgen = join(self.get_build_dir('armeabi'),
'hostpgen')
return
configure = sh.Command('./configure')
shprint(configure)
shprint(sh.make, '-j5')
shprint(sh.mv, join('Parser', 'pgen'), 'hostpgen')
if exists('python.exe'):
shprint(sh.mv, 'python.exe', 'hostpython')
elif exists('python'):
shprint(sh.mv, 'python', 'hostpython')
else:
warning('Unable to find the python executable after '
'hostpython build! Exiting.')
exit(1)
self.ctx.hostpython = join(self.get_build_dir('armeabi'), 'hostpython')
self.ctx.hostpgen = join(self.get_build_dir('armeabi'), 'hostpgen')
示例2: install_python_package
def install_python_package(self, arch):
env = self.get_recipe_env(arch)
info('Installing {} into site-packages'.format(self.name))
with current_directory(join(self.get_build_dir(arch.arch), 'python')):
hostpython = sh.Command(self.hostpython_location)
if self.ctx.python_recipe.from_crystax:
hpenv = env.copy()
shprint(hostpython, 'setup.py', 'install', '-O2',
'--root={}'.format(self.ctx.get_python_install_dir()),
'--install-lib=.',
'--cpp_implementation',
_env=hpenv, *self.setup_extra_args)
else:
hppath = join(dirname(self.hostpython_location), 'Lib',
'site-packages')
hpenv = env.copy()
if 'PYTHONPATH' in hpenv:
hpenv['PYTHONPATH'] = ':'.join([hppath] +
hpenv['PYTHONPATH'].split(':'))
else:
hpenv['PYTHONPATH'] = hppath
shprint(hostpython, 'setup.py', 'install', '-O2',
'--root={}'.format(self.ctx.get_python_install_dir()),
'--install-lib=lib/python2.7/site-packages',
'--cpp_implementation',
_env=hpenv, *self.setup_extra_args)
示例3: build_arch
def build_arch(self, arch):
# AND: Should use an i386 recipe system
warning("Running hostpython build. Arch is armeabi! " "This is naughty, need to fix the Arch system!")
# AND: Fix armeabi again
with current_directory(self.get_build_dir(arch.arch)):
if exists("hostpython"):
info("hostpython already exists, skipping build")
self.ctx.hostpython = join(self.get_build_dir("armeabi"), "hostpython")
self.ctx.hostpgen = join(self.get_build_dir("armeabi"), "hostpgen")
return
configure = sh.Command("./configure")
shprint(configure)
shprint(sh.make, "-j5", "BUILDPYTHON=hostpython", "hostpython", "PGEN=Parser/hostpgen", "Parser/hostpgen")
shprint(sh.mv, join("Parser", "hostpgen"), "hostpgen")
# if exists('python.exe'):
# shprint(sh.mv, 'python.exe', 'hostpython')
# elif exists('python'):
# shprint(sh.mv, 'python', 'hostpython')
if exists("hostpython"):
pass # The above commands should automatically create
# the hostpython binary, unlike with python2
else:
warning("Unable to find the python executable after " "hostpython build! Exiting.")
exit(1)
self.ctx.hostpython = join(self.get_build_dir(arch.arch), "hostpython")
self.ctx.hostpgen = join(self.get_build_dir(arch.arch), "hostpgen")
示例4: prebuild_arch
def prebuild_arch(self, arch):
build_dir = self.get_build_container_dir(arch.arch)
if exists(join(build_dir, '.patched')):
info('Python2 already patched, skipping.')
return
self.apply_patch(join('patches', 'Python-{}-xcompile.patch'.format(self.version)),
arch.arch)
self.apply_patch(join('patches', 'Python-{}-ctypes-disable-wchar.patch'.format(self.version)),
arch.arch)
self.apply_patch(join('patches', 'disable-modules.patch'), arch.arch)
self.apply_patch(join('patches', 'fix-locale.patch'), arch.arch)
self.apply_patch(join('patches', 'fix-gethostbyaddr.patch'), arch.arch)
self.apply_patch(join('patches', 'fix-setup-flags.patch'), arch.arch)
self.apply_patch(join('patches', 'fix-filesystemdefaultencoding.patch'), arch.arch)
self.apply_patch(join('patches', 'fix-termios.patch'), arch.arch)
self.apply_patch(join('patches', 'custom-loader.patch'), arch.arch)
self.apply_patch(join('patches', 'verbose-compilation.patch'), arch.arch)
self.apply_patch(join('patches', 'fix-remove-corefoundation.patch'), arch.arch)
self.apply_patch(join('patches', 'fix-dynamic-lookup.patch'), arch.arch)
self.apply_patch(join('patches', 'fix-dlfcn.patch'), arch.arch)
self.apply_patch(join('patches', 'parsetuple.patch'), arch.arch)
# self.apply_patch(join('patches', 'ctypes-find-library.patch'), arch.arch)
self.apply_patch(join('patches', 'ctypes-find-library-updated.patch'), arch.arch)
if uname()[0] == 'Linux':
self.apply_patch(join('patches', 'fix-configure-darwin.patch'), arch.arch)
self.apply_patch(join('patches', 'fix-distutils-darwin.patch'), arch.arch)
if self.ctx.android_api > 19:
self.apply_patch(join('patches', 'fix-ftime-removal.patch'), arch.arch)
shprint(sh.touch, join(build_dir, '.patched'))
示例5: build_arch
def build_arch(self, arch):
with current_directory(self.get_build_dir()):
if exists('hostpython'):
info('hostpython already exists, skipping build')
self.ctx.hostpython = join(self.get_build_dir(),
'hostpython')
self.ctx.hostpgen = join(self.get_build_dir(),
'hostpgen')
return
configure = sh.Command('./configure')
shprint(configure)
shprint(sh.make, '-j5')
shprint(sh.mv, join('Parser', 'pgen'), 'hostpgen')
if exists('python.exe'):
shprint(sh.mv, 'python.exe', 'hostpython')
elif exists('python'):
shprint(sh.mv, 'python', 'hostpython')
else:
warning('Unable to find the python executable after '
'hostpython build! Exiting.')
exit(1)
self.ctx.hostpython = join(self.get_build_dir(), 'hostpython')
self.ctx.hostpgen = join(self.get_build_dir(), 'hostpgen')
示例6: build_armeabi
def build_armeabi(self):
# AND: I'm going to ignore any extra pythonrecipe or cythonrecipe behaviour for now
arch = ArchAndroid(self.ctx)
env = self.get_recipe_env(arch)
env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/png -I{jni_path}/jpeg'.format(
jni_path=join(self.ctx.bootstrap.build_dir, 'jni'))
env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/sdl/include -I{jni_path}/sdl_mixer'.format(
jni_path=join(self.ctx.bootstrap.build_dir, 'jni'))
env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/sdl_ttf -I{jni_path}/sdl_image'.format(
jni_path=join(self.ctx.bootstrap.build_dir, 'jni'))
debug('pygame cflags', env['CFLAGS'])
env['LDFLAGS'] = env['LDFLAGS'] + ' -L{libs_path} -L{src_path}/obj/local/{arch} -lm -lz'.format(
libs_path=self.ctx.libs_dir, src_path=self.ctx.bootstrap.build_dir, arch=env['ARCH'])
env['LDSHARED'] = join(self.ctx.root_dir, 'tools', 'liblink')
with current_directory(self.get_build_dir('armeabi')):
info('hostpython is ' + self.ctx.hostpython)
hostpython = sh.Command(self.ctx.hostpython)
shprint(hostpython, 'setup.py', 'install', '-O2', _env=env)
info('strip is ' + env['STRIP'])
build_lib = glob.glob('./build/lib*')
assert len(build_lib) == 1
print('stripping pygame')
shprint(sh.find, build_lib[0], '-name', '*.o', '-exec',
env['STRIP'], '{}', ';')
python_install_path = join(self.ctx.build_dir, 'python-install')
# AND: Should do some deleting here!
print('Should remove pygame tests etc. here, but skipping for now')
示例7: run_distribute
def run_distribute(self):
info_main('# Creating Android project from build and {} bootstrap'.format(
self.name))
shprint(sh.rm, '-rf', self.dist_dir)
shprint(sh.cp, '-r', self.build_dir, self.dist_dir)
with current_directory(self.dist_dir):
with open('local.properties', 'w') as fileh:
fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir))
arch = self.ctx.archs[0]
if len(self.ctx.archs) > 1:
raise ValueError('built for more than one arch, but bootstrap cannot handle that yet')
info('Bootstrap running with arch {}'.format(arch))
with current_directory(self.dist_dir):
info('Copying python distribution')
self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)])
self.distribute_aars(arch)
self.distribute_javaclasses(self.ctx.javaclass_dir)
python_bundle_dir = join('_python_bundle', '_python_bundle')
ensure_dir(python_bundle_dir)
site_packages_dir = self.ctx.python_recipe.create_python_bundle(
join(self.dist_dir, python_bundle_dir), arch)
if 'sqlite3' not in self.ctx.recipe_build_order:
with open('blacklist.txt', 'a') as fileh:
fileh.write('\nsqlite3/*\nlib-dynload/_sqlite3.so\n')
self.strip_libraries(arch)
self.fry_eggs(site_packages_dir)
super(WebViewBootstrap, self).run_distribute()
示例8: prebuild_arch
def prebuild_arch(self, arch):
super(LibSDL2Image, self).prebuild_arch(arch)
build_dir = self.get_build_dir(arch.arch)
if exists(join(build_dir, ".patched")):
info("SDL2_image already patched, skipping")
return
self.apply_patch("disable_webp.patch")
shprint(sh.touch, join(build_dir, ".patched"))
示例9: prebuild_armeabi
def prebuild_armeabi(self):
if exists(join(self.get_build_container_dir('armeabi'), '.patched')):
info('Pygame already patched, skipping.')
return
shprint(sh.cp, join(self.get_recipe_dir(), 'Setup'),
join(self.get_build_dir('armeabi'), 'Setup'))
self.apply_patch(join('patches', 'fix-surface-access.patch'))
self.apply_patch(join('patches', 'fix-array-surface.patch'))
shprint(sh.touch, join(self.get_build_container_dir('armeabi'), '.patched'))
示例10: build_compiled_components
def build_compiled_components(self, arch):
info('Configuring compiled components in {}'.format(self.name))
env = self.get_recipe_env(arch)
with current_directory(self.get_build_dir(arch.arch)):
configure = sh.Command('./configure')
shprint(configure, '--host=arm-eabi',
'--prefix={}'.format(self.ctx.get_python_install_dir()),
'--enable-shared', _env=env)
super(PyCryptoRecipe, self).build_compiled_components(arch)
示例11: run_distribute
def run_distribute(self):
info_main("# Creating Android project ({})".format(self.name))
arch = self.ctx.archs[0]
python_install_dir = self.ctx.get_python_install_dir()
from_crystax = self.ctx.python_recipe.from_crystax
if len(self.ctx.archs) > 1:
raise ValueError("SDL2/gradle support only one arch")
info("Copying SDL2/gradle build for {}".format(arch))
shprint(sh.rm, "-rf", self.dist_dir)
shprint(sh.cp, "-r", self.build_dir, self.dist_dir)
# either the build use environment variable (ANDROID_HOME)
# or the local.properties if exists
with current_directory(self.dist_dir):
with open('local.properties', 'w') as fileh:
fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir))
with current_directory(self.dist_dir):
info("Copying Python distribution")
hostpython = sh.Command(self.ctx.hostpython)
if self.ctx.python_recipe.name == 'python2':
try:
shprint(hostpython, '-OO', '-m', 'compileall',
python_install_dir,
_tail=10, _filterout="^Listing")
except sh.ErrorReturnCode:
pass
if 'python2' in self.ctx.recipe_build_order and not exists('python-install'):
shprint(
sh.cp, '-a', python_install_dir, './python-install')
self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)])
self.distribute_javaclasses(self.ctx.javaclass_dir,
dest_dir=join("src", "main", "java"))
python_bundle_dir = join('_python_bundle', '_python_bundle')
if 'python2' in self.ctx.recipe_build_order:
# Python 2 is a special case with its own packaging location
python_bundle_dir = 'private'
ensure_dir(python_bundle_dir)
site_packages_dir = self.ctx.python_recipe.create_python_bundle(
join(self.dist_dir, python_bundle_dir), arch)
if 'sqlite3' not in self.ctx.recipe_build_order:
with open('blacklist.txt', 'a') as fileh:
fileh.write('\nsqlite3/*\nlib-dynload/_sqlite3.so\n')
self.strip_libraries(arch)
self.fry_eggs(site_packages_dir)
super(SDL2GradleBootstrap, self).run_distribute()
示例12: install_python_package
def install_python_package(self, arch):
env = self.get_recipe_env(arch)
info('Installing {} into site-packages'.format(self.name))
with current_directory(join(self.get_build_dir(arch.arch), 'python')):
hostpython = sh.Command(self.hostpython_location)
hpenv = env.copy()
shprint(hostpython, 'setup.py', 'install', '-O2',
'--root={}'.format(self.ctx.get_python_install_dir()),
'--install-lib=.',
'--cpp_implementation',
_env=hpenv, *self.setup_extra_args)
示例13: run_distribute
def run_distribute(self):
info_main('# Creating Android project from build and {} bootstrap'.format(
self.name))
# src_path = join(self.ctx.root_dir, 'bootstrap_templates',
# self.name)
src_path = join(self.bootstrap_dir, 'build')
arch = self.ctx.archs[0]
if len(self.ctx.archs) > 1:
raise ValueError('built for more than one arch, but bootstrap cannot handle that yet')
info('Bootstrap running with arch {}'.format(arch))
with current_directory(self.dist_dir):
info('Creating initial layout')
for dirname in ('assets', 'bin', 'private', 'res', 'templates'):
if not exists(dirname):
shprint(sh.mkdir, dirname)
info('Copying default files')
shprint(sh.cp, '-a', join(self.build_dir, 'project.properties'), '.')
shprint(sh.cp, '-a', join(src_path, 'build.py'), '.')
shprint(sh.cp, '-a', join(src_path, 'buildlib'), '.')
shprint(sh.cp, '-a', join(src_path, 'src'), '.')
shprint(sh.cp, '-a', join(src_path, 'templates'), '.')
shprint(sh.cp, '-a', join(src_path, 'res'), '.')
shprint(sh.cp, '-a', join(src_path, 'blacklist.txt'), '.')
shprint(sh.cp, '-a', join(src_path, 'whitelist.txt'), '.')
with open('local.properties', 'w') as fileh:
fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir))
info('Copying python distribution')
python_bundle_dir = join('_python_bundle', '_python_bundle')
if 'python2legacy' in self.ctx.recipe_build_order:
# a special case with its own packaging location
python_bundle_dir = 'private'
# And also must had an install directory, make sure of that
self.ctx.python_recipe.create_python_install(self.dist_dir)
self.distribute_libs(
arch, [join(self.build_dir, 'libs', arch.arch),
self.ctx.get_libs_dir(arch.arch)])
self.distribute_aars(arch)
self.distribute_javaclasses(self.ctx.javaclass_dir)
ensure_dir(python_bundle_dir)
site_packages_dir = self.ctx.python_recipe.create_python_bundle(
join(self.dist_dir, python_bundle_dir), arch)
if 'sqlite3' not in self.ctx.recipe_build_order:
with open('blacklist.txt', 'a') as fileh:
fileh.write('\nsqlite3/*\nlib-dynload/_sqlite3.so\n')
self.strip_libraries(arch)
self.fry_eggs(site_packages_dir)
super(PygameBootstrap, self).run_distribute()
示例14: build_arch
def build_arch(self, arch):
build_dir = self.get_build_dir(arch.arch)
info("create links to icu libs")
lib_dir = join(self.ctx.get_python_install_dir(), "lib")
icu_libs = [f for f in os.listdir(lib_dir) if f.startswith("libicu")]
for l in icu_libs:
raw = l.rsplit(".", 1)[0]
try:
shprint(sh.ln, "-s", join(lib_dir, l), join(build_dir, raw))
except Exception:
pass
super(PyICURecipe, self).build_arch(arch)
示例15: build_armeabi
def build_armeabi(self):
if exists(join(self.ctx.libs_dir, 'libsdl.so')):
info('libsdl.so already exists, skipping sdl build.')
return
env = ArchAndroid(self.ctx).get_env()
with current_directory(self.get_jni_dir()):
shprint(sh.ndk_build, 'V=1', _env=env)
libs_dir = join(self.ctx.bootstrap.build_dir, 'libs', 'armeabi')
import os
contents = list(os.walk(libs_dir))[0][-1]
for content in contents:
shprint(sh.cp, '-a', join(self.ctx.bootstrap.build_dir, 'libs', 'armeabi', content),
self.ctx.libs_dir)