本文整理汇总了Python中pythonforandroid.toolchain.shprint函数的典型用法代码示例。如果您正苦于以下问题:Python shprint函数的具体用法?Python shprint怎么用?Python shprint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shprint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_libs_flags
def set_libs_flags(self, env, arch):
'''Takes care to properly link libraries with python depending on our
requirements and the attribute :attr:`opt_depends`.
'''
if 'libffi' in self.ctx.recipe_build_order:
info('Activating flags for libffi')
recipe = Recipe.get_recipe('libffi', self.ctx)
include = ' -I' + ' -I'.join(recipe.get_include_dirs(arch))
ldflag = ' -L' + join(recipe.get_build_dir(arch.arch),
recipe.get_host(arch), '.libs') + ' -lffi'
env['CPPFLAGS'] = env.get('CPPFLAGS', '') + include
env['LDFLAGS'] = env.get('LDFLAGS', '') + ldflag
if 'openssl' in self.ctx.recipe_build_order:
recipe = Recipe.get_recipe('openssl', self.ctx)
openssl_build_dir = recipe.get_build_dir(arch.arch)
setuplocal = join('Modules', 'Setup.local')
shprint(sh.cp, join(self.get_recipe_dir(), 'Setup.local-ssl'), setuplocal)
shprint(sh.sed, '-i.backup', 's#^SSL=.*#SSL={}#'.format(openssl_build_dir), setuplocal)
env['OPENSSL_VERSION'] = recipe.version
if 'sqlite3' in self.ctx.recipe_build_order:
# Include sqlite3 in python2 build
recipe = Recipe.get_recipe('sqlite3', self.ctx)
include = ' -I' + recipe.get_build_dir(arch.arch)
lib = ' -L' + recipe.get_lib_dir(arch) + ' -lsqlite3'
# Insert or append to env
flag = 'CPPFLAGS'
env[flag] = env[flag] + include if flag in env else include
flag = 'LDFLAGS'
env[flag] = env[flag] + lib if flag in env else lib
return env
示例2: build_arch
def build_arch(self, arch):
super(LibtorrentRecipe, self).build_arch(arch)
env = self.get_recipe_env(arch)
with current_directory(join(self.get_build_dir(arch.arch), 'bindings/python')):
# Compile libtorrent with boost libraries and python bindings
b2 = sh.Command(join(env['BOOST_ROOT'], 'b2'))
shprint(b2,
'-q',
'-j5',
'toolset=gcc-' + env['ARCH'],
'target-os=android',
'threading=multi',
'link=shared',
'boost-link=shared',
'boost=source',
'encryption=openssl' if 'openssl' in recipe.ctx.recipe_build_order else '',
'--prefix=' + env['CROSSHOME'],
'release', _env=env)
# Common build directories
build_subdirs = 'gcc-arm/release/boost-link-shared/boost-source'
if 'openssl' in recipe.ctx.recipe_build_order:
build_subdirs += '/encryption-openssl'
build_subdirs += '/libtorrent-python-pic-on/target-os-android/threading-multi/visibility-hidden'
# Copy the shared libraries into the libs folder
shutil.copyfile(join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/python/build', build_subdirs, 'libboost_python.so'),
join(self.ctx.get_libs_dir(arch.arch), 'libboost_python.so'))
shutil.copyfile(join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/system/build', build_subdirs, 'libboost_system.so'),
join(self.ctx.get_libs_dir(arch.arch), 'libboost_system.so'))
if 'openssl' in recipe.ctx.recipe_build_order:
shutil.copyfile(join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/date_time/build', build_subdirs, 'libboost_date_time.so'),
join(self.ctx.get_libs_dir(arch.arch), 'libboost_date_time.so'))
shutil.copyfile(join(self.get_build_dir(arch.arch), 'bin', build_subdirs, 'libtorrent_rasterbar.so'),
join(self.ctx.get_libs_dir(arch.arch), 'libtorrent_rasterbar.so'))
shutil.copyfile(join(self.get_build_dir(arch.arch), 'bindings/python/bin', build_subdirs, 'libtorrent.so'),
join(self.ctx.get_site_packages_dir(arch.arch), 'libtorrent.so'))
示例3: build_arch
def build_arch(self, arch):
super(Libxml2Recipe, self).build_arch(arch)
env = self.get_recipe_env(arch)
with current_directory(self.get_build_dir(arch.arch)):
env["CC"] += " -I%s" % self.get_build_dir(arch.arch)
shprint(
sh.Command("./configure"),
"--host=arm-linux-eabi",
"--without-modules",
"--without-legacy",
"--without-history",
"--without-debug",
"--without-docbook",
"--without-python",
"--without-threads",
"--without-iconv",
_env=env,
)
# Ensure we only build libxml2.la as if we do everything
# we'll need the glob dependency which is a big headache
shprint(sh.make, "libxml2.la", _env=env)
shutil.copyfile(
".libs/libxml2.a", join(self.ctx.get_libs_dir(arch.arch), "libxml2.a")
)
示例4: 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')
示例5: 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')
示例6: run_distribute
def run_distribute(self):
info_main('# Creating Android project from build and {} bootstrap'.format(
self.name))
info('This currently just copies the build stuff straight from the build dir.')
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(ServiceOnlyBootstrap, self).run_distribute()
示例7: 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')
示例8: prebuild_arch
def prebuild_arch(self, arch):
build_dir = self.get_build_container_dir(arch.arch)
if exists(join(build_dir, '.patched')):
print('Python3 already patched, skipping.')
return
# # self.apply_patch(join('patches_inclement',
# # 'python-{version}-define_macro.patch'.format(version=self.version)))
# # self.apply_patch(join('patches_inclement',
# # 'python-{version}-android-locale.patch'.format(version=self.version)))
# # self.apply_patch(join('patches_inclement',
# # 'python-{version}-android-misc.patch'.format(version=self.version)))
# self.apply_patch(join('patches_inclement',
# 'python-{version}-locale_and_android_misc.patch'.format(version=self.version)))
self.apply_patch(join('patches', 'python-{version}-android-libmpdec.patch'.format(version=self.version)),
arch.arch)
self.apply_patch(join('patches', 'python-{version}-android-locale.patch'.format(version=self.version)), arch.arch)
self.apply_patch(join('patches', 'python-{version}-android-misc.patch'.format(version=self.version)), arch.arch)
# self.apply_patch(join('patches', 'python-{version}-android-missing-getdents64-definition.patch'.format(version=self.version)), arch.arch)
self.apply_patch(join('patches', 'python-{version}-cross-compile.patch'.format(version=self.version)), arch.arch)
self.apply_patch(join('patches', 'python-{version}-python-misc.patch'.format(version=self.version)), arch.arch)
self.apply_patch(join('patches', 'python-{version}-libpymodules_loader.patch'.format(version=self.version)), arch.arch)
self.apply_patch('log_failures.patch', arch.arch)
shprint(sh.touch, join(build_dir, '.patched'))
示例9: prebuild_arch
def prebuild_arch(self, arch):
super(VlcRecipe, self).prebuild_arch(arch)
build_dir = self.get_build_dir(arch.arch)
port_dir = join(build_dir, 'vlc-port-android')
if self.ENV_LIBVLC_AAR in environ:
self.aars[arch] = aar = environ.get(self.ENV_LIBVLC_AAR)
if not exists(aar):
warning("Error: libvlc-<ver>.aar bundle " \
"not found in {}".format(aar))
info("check {} environment!".format(self.ENV_LIBVLC_AAR))
exit(1)
else:
aar_path = join(port_dir, 'libvlc', 'build', 'outputs', 'aar')
self.aars[arch] = aar = join(aar_path, 'libvlc-{}.aar'.format(self.version))
warning("HINT: set path to precompiled libvlc-<ver>.aar bundle " \
"in {} environment!".format(self.ENV_LIBVLC_AAR))
info("libvlc-<ver>.aar should build " \
"from sources at {}".format(port_dir))
if not exists(join(port_dir, 'compile.sh')):
info("clone vlc port for android sources from {}".format(
self.port_git))
shprint(sh.git, 'clone', self.port_git, port_dir,
_tail=20, _critical=True)
vlc_dir = join(port_dir, 'vlc')
if not exists(join(vlc_dir, 'Makefile.am')):
info("clone vlc sources from {}".format(self.vlc_git))
shprint(sh.git, 'clone', self.vlc_git, vlc_dir,
_tail=20, _critical=True)
示例10: build_arch
def build_arch(self, arch):
env = self.get_recipe_env(arch)
with current_directory(self.get_build_dir(arch.arch)):
# sh fails with code 255 trying to execute ./Configure
# so instead we manually run perl passing in Configure
perl = sh.Command('perl')
buildarch = self.select_build_arch(arch)
# XXX if we don't have no-asm, using clang and ndk-15c, i got:
# crypto/aes/bsaes-armv7.S:1372:14: error: immediate operand must be in the range [0,4095]
# add r8, r6, #.LREVM0SR-.LM0 @ borrow r8
# ^
# crypto/aes/bsaes-armv7.S:1434:14: error: immediate operand must be in the range [0,4095]
# sub r6, r8, #.LREVM0SR-.LSR @ pass constants
config_args = ['shared', 'no-dso', 'no-asm']
if self.use_legacy:
config_args.append('no-krb5')
config_args.append(buildarch)
if not self.use_legacy:
config_args.append('-D__ANDROID_API__={}'.format(self.ctx.ndk_api))
shprint(perl, 'Configure', *config_args, _env=env)
self.apply_patch(
'disable-sover{}.patch'.format(
'-legacy' if self.use_legacy else ''), arch.arch)
if self.use_legacy:
self.apply_patch('rename-shared-lib.patch', arch.arch)
shprint(sh.make, 'build_libs', _env=env)
self.install_libs(arch, 'libssl' + self.version + '.so',
'libcrypto' + self.version + '.so')
示例11: 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'))
示例12: get_recipe_env
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
env = super(PILRecipe, self).get_recipe_env(arch, with_flags_in_cc)
env['PYTHON_INCLUDE_ROOT'] = self.ctx.python_recipe.include_root(arch.arch)
env['PYTHON_LINK_ROOT'] = self.ctx.python_recipe.link_root(arch.arch)
ndk_lib_dir = join(self.ctx.ndk_platform, 'usr', 'lib')
ndk_include_dir = join(self.ctx.ndk_dir, 'sysroot', 'usr', 'include')
png = self.get_recipe('png', self.ctx)
png_lib_dir = png.get_lib_dir(arch)
png_jni_dir = png.get_jni_dir(arch)
jpeg = self.get_recipe('jpeg', self.ctx)
jpeg_inc_dir = jpeg_lib_dir = jpeg.get_build_dir(arch.arch)
if 'freetype' in self.ctx.recipe_build_order:
freetype = self.get_recipe('freetype', self.ctx)
free_lib_dir = join(freetype.get_build_dir(arch.arch), 'objs', '.libs')
free_inc_dir = join(freetype.get_build_dir(arch.arch), 'include')
# hack freetype to be found by pil
freetype_link = join(free_inc_dir, 'freetype')
if not exists(freetype_link):
shprint(sh.ln, '-s', join(free_inc_dir), freetype_link)
harfbuzz = self.get_recipe('harfbuzz', self.ctx)
harf_lib_dir = join(harfbuzz.get_build_dir(arch.arch), 'src', '.libs')
harf_inc_dir = harfbuzz.get_build_dir(arch.arch)
env['FREETYPE_ROOT'] = '{}|{}'.format(free_lib_dir, free_inc_dir)
env['JPEG_ROOT'] = '{}|{}'.format(jpeg_lib_dir, jpeg_inc_dir)
env['ZLIB_ROOT'] = '{}|{}'.format(ndk_lib_dir, ndk_include_dir)
cflags = ' -std=c99'
cflags += ' -I{}'.format(png_jni_dir)
if 'freetype' in self.ctx.recipe_build_order:
cflags += ' -I{} -I{}'.format(harf_inc_dir, join(harf_inc_dir, 'src'))
cflags += ' -I{}'.format(free_inc_dir)
cflags += ' -I{}'.format(jpeg_inc_dir)
cflags += ' -I{}'.format(ndk_include_dir)
py_v = self.ctx.python_recipe.major_minor_version_string
if py_v[0] == '3':
py_v += 'm'
env['LIBS'] = ' -lpython{version} -lpng'.format(version=py_v)
if 'freetype' in self.ctx.recipe_build_order:
env['LIBS'] += ' -lfreetype -lharfbuzz'
env['LIBS'] += ' -ljpeg -lturbojpeg'
env['LDFLAGS'] += ' -L{} -L{}'.format(env['PYTHON_LINK_ROOT'], png_lib_dir)
if 'freetype' in self.ctx.recipe_build_order:
env['LDFLAGS'] += ' -L{} -L{}'.format(harf_lib_dir, free_lib_dir)
env['LDFLAGS'] += ' -L{} -L{}'.format(jpeg_lib_dir, ndk_lib_dir)
if cflags not in env['CFLAGS']:
env['CFLAGS'] += cflags
return env
示例13: prebuild_arch
def prebuild_arch(self, arch):
libdir = self.ctx.get_libs_dir(arch.arch)
with current_directory(self.get_build_dir(arch.arch)):
# pg_config_helper will return the system installed libpq, but we
# need the one we just cross-compiled
shprint(sh.sed, '-i',
"s|pg_config_helper.query(.libdir.)|'{}'|".format(libdir),
'setup.py')
示例14: prebuild_arch
def prebuild_arch(self, arch):
super(PyjniusRecipe, self).prebuild_arch(arch)
build_dir = self.get_build_dir(arch.arch)
if exists(join(build_dir, '.patched')):
print('pyjniussdl2 already pathed, skipping')
return
self.apply_patch('sdl2_jnienv_getter.patch')
shprint(sh.touch, join(build_dir, '.patched'))
示例15: build_arch
def build_arch(self, arch):
super(FFMpegRecipe, self).build_arch(arch)
env = self.get_recipe_env(arch)
build_dir = self.get_build_dir(arch.arch)
with current_directory(build_dir):
bash = sh.Command('bash')
shprint(bash, 'init_update_libs.sh')
shprint(bash, 'android_build.sh', _env=env)