toolchain: factorize cythonize_build, cythonize and big link

This commit is contained in:
Mathieu Virbel 2015-02-23 22:51:16 +01:00
parent aa3ea83bad
commit 6238831a83
5 changed files with 23 additions and 85 deletions

View file

@ -16,19 +16,6 @@ class FFPyplayerRecipe(Recipe):
"CoreMotion"]
pbx_libraries = ["libiconv"]
def cythonize(self, filename):
if filename.startswith(self.build_dir):
filename = filename[len(self.build_dir) + 1:]
print("Cythonize {}".format(filename))
cmd = sh.Command(join(self.ctx.root_dir, "tools", "cythonize.py"))
shprint(cmd, filename)
def cythonize_build(self):
root_dir = self.build_dir
for root, dirnames, filenames in os.walk(root_dir):
for filename in fnmatch.filter(filenames, "*.pyx"):
self.cythonize(join(root, filename))
def get_kivy_env(self, arch):
build_env = arch.get_env()
build_env["KIVYIOSROOT"] = self.ctx.root_dir
@ -59,14 +46,6 @@ class FFPyplayerRecipe(Recipe):
_env=build_env)
self.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, "libffpyplayer.a"), *dirs)
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)

View file

@ -13,19 +13,6 @@ class IosRecipe(Recipe):
depends = ["python"]
pbx_frameworks = ["MessageUI", "CoreMotion", "UIKit"]
def cythonize(self, filename):
if filename.startswith(self.build_dir):
filename = filename[len(self.build_dir) + 1:]
print("Cythonize {}".format(filename))
cmd = sh.Command(join(self.ctx.root_dir, "tools", "cythonize.py"))
shprint(cmd, filename)
def cythonize_build(self):
root_dir = self.build_dir
for root, dirnames, filenames in os.walk(root_dir):
for filename in fnmatch.filter(filenames, "*.pyx"):
self.cythonize(join(root, filename))
def get_kivy_env(self, arch):
build_env = arch.get_env()
build_env["KIVYIOSROOT"] = self.ctx.root_dir
@ -43,14 +30,6 @@ class IosRecipe(Recipe):
_env=build_env)
self.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, "libios.a"), *dirs)
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)

View file

@ -13,19 +13,6 @@ class KivyRecipe(Recipe):
depends = ["python", "sdl2", "sdl2_image", "sdl2_mixer", "sdl2_ttf", "ios"]
pbx_frameworks = ["OpenGLES", "Accelerate"]
def cythonize(self, filename):
if filename.startswith(self.build_dir):
filename = filename[len(self.build_dir) + 1:]
print("Cythonize {}".format(filename))
cmd = sh.Command(join(self.ctx.root_dir, "tools", "cythonize.py"))
shprint(cmd, filename)
def cythonize_build(self):
root_dir = join(self.build_dir, "kivy")
for root, dirnames, filenames in os.walk(root_dir):
for filename in fnmatch.filter(filenames, "*.pyx"):
self.cythonize(join(root, filename))
def get_kivy_env(self, arch):
build_env = arch.get_env()
build_env["KIVYIOSROOT"] = self.ctx.root_dir
@ -55,14 +42,6 @@ class KivyRecipe(Recipe):
_env=build_env)
self.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, "libkivy.a"), *dirs)
def _patch_setup(self):
# patch setup to remove some functionnalities
pyconfig = join(self.build_dir, "setup.py")

View file

@ -12,19 +12,6 @@ class PyobjusRecipe(Recipe):
library = "libpyobjus.a"
depends = ["python"]
def cythonize(self, filename):
if filename.startswith(self.build_dir):
filename = filename[len(self.build_dir) + 1:]
print("Cythonize {}".format(filename))
cmd = sh.Command(join(self.ctx.root_dir, "tools", "cythonize.py"))
shprint(cmd, filename)
def cythonize_build(self):
root_dir = self.build_dir
for root, dirnames, filenames in os.walk(root_dir):
for filename in fnmatch.filter(filenames, "*.pyx"):
self.cythonize(join(root, filename))
def get_kivy_env(self, arch):
build_env = arch.get_env()
build_env["KIVYIOSROOT"] = self.ctx.root_dir
@ -54,14 +41,6 @@ class PyobjusRecipe(Recipe):
_env=build_env)
self.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, "libpyobjus.a"), *dirs)
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)

View file

@ -9,13 +9,14 @@ This tool intend to replace all the previous tools/ in shell script.
import sys
from sys import stdout
from os.path import join, dirname, realpath, exists, isdir, basename
from os import listdir, unlink, makedirs, environ, chdir, getcwd
from os import listdir, unlink, makedirs, environ, chdir, getcwd, walk
import zipfile
import tarfile
import importlib
import io
import json
import shutil
import fnmatch
from datetime import datetime
try:
from urllib.request import FancyURLopener
@ -505,6 +506,27 @@ class Recipe(object):
def get_build_dir(self, arch):
return join(self.ctx.build_dir, self.name, arch, self.archive_root)
def cythonize(self, filename):
if filename.startswith(self.build_dir):
filename = filename[len(self.build_dir) + 1:]
print("Cythonize {}".format(filename))
cmd = sh.Command(join(self.ctx.root_dir, "tools", "cythonize.py"))
shprint(cmd, filename)
def cythonize_build(self):
root_dir = self.build_dir
for root, dirnames, filenames in walk(root_dir):
for filename in fnmatch.filter(filenames, "*.pyx"):
self.cythonize(join(root, filename))
def biglink(self):
dirs = []
for root, dirnames, filenames in 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, "lib{}.a".format(self.name)), *dirs)
# Public Recipe API to be subclassed if needed
def init_with_ctx(self, ctx):