本文整理汇总了Python中toolchain.shprint函数的典型用法代码示例。如果您正苦于以下问题:Python shprint函数的具体用法?Python shprint怎么用?Python shprint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shprint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: install
def install(self):
"""
Do the equivalent of
python setup.py build_ext install
while setting the proper environment variables
"""
arch = list(self.filtered_archs)[0]
build_env = self.get_recipe_env(arch)
hostpython = sh.Command(self.ctx.hostpython)
subdir_path = self.get_build_dir(arch.arch)
setup_path = join(subdir_path,"setup.py")
dest_dir = join (self.ctx.dist_dir, "root", "python")
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
#Note: Throws error if PATH is not set. I am not sure if this will cause problems
# in other architectures.
build_env['PATH']= os.environ.get('PATH')
shprint(hostpython,
setup_path,
"build_ext",
#"--compiler=mingw32", #note: throws clang error
"install",
_env=build_env)
示例2: install
def install(self):
arch = list(self.filtered_archs)[0]
build_env = arch.get_env()
build_dir = self.get_build_dir(arch.arch)
build_env["PATH"] = os.environ["PATH"]
# Compiling sometimes looks for Python-ast.py in the 'Python' i.s.o.
# the 'hostpython' folder. Create a symlink to fix. See issue #201
shprint(sh.ln, "-s",
join(build_dir, "hostpython"),
join(build_dir, "Python"))
shprint(sh.make, self.ctx.concurrent_make,
"-C", build_dir,
"bininstall", "inclinstall",
_env=build_env)
pylib_dir = join(self.ctx.dist_dir, "hostpython", "lib", "python2.7")
if exists(pylib_dir):
shutil.rmtree(pylib_dir)
shutil.copytree(
join(build_dir, "Lib"),
pylib_dir)
ensure_dir(join(pylib_dir, "config"))
shutil.copy(
join(build_dir, "Makefile"),
join(pylib_dir, "config", "Makefile"))
shutil.copy(
join(build_dir, "Parser", "pgen"),
join(self.ctx.dist_dir, "hostpython", "bin", "pgen"))
示例3: build_arch
def build_arch(self, arch):
build_env = arch.get_env()
configure = sh.Command(join(self.build_dir, "configure"))
shprint(configure,
"CC={}".format(build_env["CC"]),
"LD={}".format(build_env["LD"]),
"CFLAGS={}".format(build_env["CFLAGS"]),
"LDFLAGS={} -undefined dynamic_lookup".format(build_env["LDFLAGS"]),
"--without-pymalloc",
"--disable-toolbox-glue",
"--host={}-apple-darwin".format(arch),
"--prefix=/python",
"--with-system-ffi",
"--without-doc-strings",
"--enable-ipv6",
_env=build_env)
self._patch_pyconfig()
self.apply_patch("ctypes_duplicate.patch")
self.apply_patch("ctypes_duplicate_longdouble.patch")
shprint(sh.make, self.ctx.concurrent_make,
"CROSS_COMPILE_TARGET=yes",
"HOSTPYTHON={}".format(self.ctx.hostpython),
"HOSTPGEN={}".format(self.ctx.hostpgen))
示例4: biglink
def biglink(self):
dirs = []
for root, dirnames, filenames in os.walk(self.build_dir):
if fnmatch.filter(filenames, "*.so.libs"):
dirs.append(root)
cmd = sh.Command(join(self.ctx.root_dir, "tools", "biglink"))
shprint(cmd, join(self.build_dir, "libpil.a"), *dirs)
示例5: build_x86_64
def build_x86_64(self):
sdk_path = sh.xcrun("--sdk", "macosx", "--show-sdk-path").strip()
build_env = self.ctx.env.copy()
ccache = (build_env["CCACHE"] + ' ') if 'CCACHE' in build_env else ''
build_env["CC"] = ccache + "clang -Qunused-arguments -fcolor-diagnostics"
build_env["LDFLAGS"] = " ".join([
"-lsqlite3",
"-lffi",
"-L{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "lib"))
])
build_env["CFLAGS"] = " ".join([
"--sysroot={}".format(sdk_path),
"-I{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "include"))
])
if "openssl.build_all" in self.ctx.state:
build_env["CFLAGS"] += " -I{}".format(join(self.ctx.dist_dir, "include",
"x86_64", "openssl"))
configure = sh.Command(join(self.build_dir, "configure"))
shprint(configure,
"--prefix={}".format(join(self.ctx.dist_dir, "hostpython")),
"--disable-toolbox-glue",
"--without-gcc",
_env=build_env)
shprint(sh.make, "-C", self.build_dir, self.ctx.concurrent_make, "python", "Parser/pgen",
_env=build_env)
shutil.move("python", "hostpython")
shutil.move("Parser/pgen", "Parser/hostpgen")
示例6: build_arch
def build_arch(self, arch):
shprint(sh.xcodebuild,
"ONLY_ACTIVE_ARCH=NO",
"ARCHS={}".format(arch.arch),
"-sdk", arch.sdk,
"-project", "libffi.xcodeproj",
"-target", "libffi-iOS",
"-configuration", "Release")
示例7: prebuild_arch
def prebuild_arch(self, arch):
hostpython = sh.Command(self.ctx.hostpython)
sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py")
dest_dir = join(self.ctx.dist_dir, "root", "python")
build_env = arch.get_env()
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
# shprint(hostpython, "./ez_setup.py", "--to-dir", dest_dir)
shprint(hostpython, "./ez_setup.py", _env=build_env)
示例8: install
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
示例9: reduce_python
def reduce_python(self):
logger.info("Reduce python")
oldpwd = os.getcwd()
try:
logger.info("Remove files unlikely to be used")
os.chdir(join(self.ctx.dist_dir, "root", "python3"))
# os.execve("/bin/bash", ["/bin/bash"], env=os.environ)
sh.rm("-rf", "bin", "share")
# platform binaries and configuration
os.chdir(join(
self.ctx.dist_dir, "root", "python3", "lib",
"python3.7", "config-3.7m-darwin"))
sh.rm("libpython3.7m.a")
sh.rm("python.o")
sh.rm("config.c.in")
sh.rm("makesetup")
sh.rm("install-sh")
# cleanup pkgconfig and compiled lib
os.chdir(join(self.ctx.dist_dir, "root", "python3", "lib"))
sh.rm("-rf", "pkgconfig")
sh.rm("-f", "libpython3.7m.a")
# cleanup python libraries
os.chdir(join(
self.ctx.dist_dir, "root", "python3", "lib", "python3.7"))
sh.rm("-rf", "wsgiref", "curses", "idlelib", "lib2to3",
"ensurepip", "turtledemo", "lib-dynload", "venv",
"pydoc_data")
sh.find(".", "-path", "*/test*/*", "-delete")
sh.find(".", "-name", "*.exe", "-type", "f", "-delete")
sh.find(".", "-name", "test*", "-type", "d", "-delete")
sh.find(".", "-iname", "*.pyc", "-delete")
sh.find(".", "-path", "*/__pycache__/*", "-delete")
sh.find(".", "-name", "__pycache__", "-type", "d", "-delete")
# now precompile to Python bytecode
hostpython = sh.Command(self.ctx.hostpython)
shprint(hostpython, "-m", "compileall", "-f", "-b")
# sh.find(".", "-iname", "*.py", "-delete")
# some pycache are recreated after compileall
sh.find(".", "-path", "*/__pycache__/*", "-delete")
sh.find(".", "-name", "__pycache__", "-type", "d", "-delete")
# create the lib zip
logger.info("Create a python3.7.zip")
sh.mv("config-3.7m-darwin", "..")
sh.mv("site-packages", "..")
sh.zip("-r", "../python37.zip", sh.glob("*"))
sh.rm("-rf", sh.glob("*"))
sh.mv("../config-3.7m-darwin", ".")
sh.mv("../site-packages", ".")
finally:
os.chdir(oldpwd)
示例10: prebuild_arch
def prebuild_arch(self, arch):
if self.has_marker("patched"):
return
# XCode 10 minimum is 8.0 now.
shprint(sh.sed,
"-i.bak",
"s/-miphoneos-version-min=5.1.1/-miphoneos-version-min=8.0/g",
"generate-darwin-source-and-headers.py")
self.apply_patch("fix-win32-unreferenced-symbol.patch")
self.set_marker("patched")
示例11: build_arch
def build_arch(self, arch):
shprint(sh.xcodebuild, self.ctx.concurrent_xcodebuild,
"ONLY_ACTIVE_ARCH=NO",
"ARCHS={}".format(arch.arch),
"-sdk", "macosx",
"install", "installhdrs",
"-project", "libffi.xcodeproj",
"-target", "libffi-Mac",
"-configuration", "Release",
"DSTROOT={}/hostlibffi".format(self.ctx.dist_dir))
示例12: build_arch
def build_arch(self, arch):
self.apply_patch('pil_setup.patch')
build_env = self.get_pil_env(arch)
#build_dir = self.get_build_dir(arch.arch)
hostpython = sh.Command(self.ctx.hostpython)
#build_env["PYTHONHOME"] = hostpython
# first try to generate .h
shprint(hostpython, "setup.py", "build_ext", "-g",
_env=build_env)
self.biglink()
示例13: build_x86_64
def build_x86_64(self):
build_env = self.get_build_env()
configure = sh.Command(join(self.build_dir, "configure"))
shprint(configure,
"--prefix={}".format(join(self.ctx.dist_dir, "hostpython3")),
# "--disable-toolbox-glue",
# "--without-gcc",
_env=build_env)
shprint(sh.make, "-C", self.build_dir, self.ctx.concurrent_make,
_env=build_env)
示例14: cythonize_build
def cythonize_build(self):
# don't use the cythonize, pyobjus don't support method rewriting
shprint(sh.find, self.build_dir, "-iname", "*.pyx",
"-exec", "cython", "{}", ";")
# ffi is installed somewhere else, this include doesn't work
# XXX ideally, we need to fix libffi installation...
shprint(sh.sed,
"-i.bak",
"s/ffi\///g",
"pyobjus/pyobjus.c")
示例15: install
def install(self):
arch = list(self.filtered_archs)[0]
build_env = arch.get_env()
build_dir = self.get_build_dir(arch.arch)
build_env["PATH"] = os.environ["PATH"]
shprint(sh.make, "-C", build_dir, "bininstall", "inclinstall", _env=build_env)
pylib_dir = join(self.ctx.dist_dir, "hostpython", "lib", "python2.7")
if exists(pylib_dir):
shutil.rmtree(pylib_dir)
shutil.copytree(join(build_dir, "Lib"), pylib_dir)
ensure_dir(join(pylib_dir, "config"))
shutil.copy(join(build_dir, "Makefile"), join(pylib_dir, "config", "Makefile"))
shutil.copy(join(build_dir, "Parser", "pgen"), join(self.ctx.dist_dir, "hostpython", "bin", "pgen"))