8000 Merge pull request #1034 from bobatsar/recipe_updates · jusme/python-for-android@e8986f7 · GitHub
[go: up one dir, main page]

Skip to content

Commit e8986f7

Browse files
authored
Merge pull request kivy#1034 from bobatsar/recipe_updates
Recipe updates and small fixes to build process
2 parents f5335ed + 97ae521 commit e8986f7

File tree

4 files changed

+62
-47
lines changed
  • recipes
  • 4 files changed

    +62
    -47
    lines changed

    pythonforandroid/build.py

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -530,6 +530,7 @@ def build_recipes(build_order, python_modules, ctx):
    530530
    bs = ctx.bootstrap
    531531
    info_notify("Recipe build order is {}".format(build_order))
    532532
    if python_modules:
    533+
    python_modules = sorted(set(python_modules))
    533534
    info_notify(
    534535
    ('The requirements ({}) were not found as recipes, they will be '
    535536
    'installed with pip.').format(', '.join(python_modules)))
    Lines changed: 14 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,14 @@
    1+
    from pythonforandroid.recipe import PythonRecipe
    2+
    3+
    4+
    class DateutilRecipe(PythonRecipe):
    5+
    name = 'dateutil'
    6+
    version = '2.6.0'
    7+
    url = 'https://pypi.python.org/packages/3e/f5/aad82824b369332a676a90a8c0d1e608b17e740bbb6aeeebca726f17b902/python-dateutil-{version}.tar.gz'
    8+
    9+
    depends = ['python2', "setuptools"]
    10+
    call_hostpython_via_targetpython = False
    11+
    install_in_hostpython = True
    12+
    13+
    14+
    recipe = DateutilRecipe()

    pythonforandroid/recipes/icu/__init__.py

    Lines changed: 38 additions & 40 deletions
    Original file line numberDiff line numberDiff line change
    @@ -11,7 +11,7 @@ class ICURecipe(NDKRecipe):
    1111
    version = '57.1'
    1212
    url = 'http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz'
    1313

    14-
    depends = [('python2', 'python3crystax')] # installs in python
    14+
    depends = [('python2', 'python3crystax'), 'hostpython2'] # installs in python
    1515
    generated_libraries = [
    1616
    'libicui18n.so', 'libicuuc.so', 'libicudata.so', 'libicule.so']
    1717

    @@ -68,50 +68,48 @@ def make_build_dest(dest):
    6868
    shprint(sh.make, "install", _env=host_env)
    6969

    7070
    build_android, exists = make_build_dest("build_icu_android")
    71-
    if exists:
    72-
    return
    73-
    74-
    configure = sh.Command(join(build_root, "source", "configure"))
    75-
    76-
    include = (
    77-
    " -I{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/include/"
    78-
    " -I{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/libs/"
    79-
    "{arch}/include")
    80-
    include = include.format(ndk=self.ctx.ndk_dir,
    81-
    version=env["TOOLCHAIN_VERSION"],
    82-
    arch=arch.arch)
    83-
    env["CPPFLAGS"] = env["CXXFLAGS"] + " "
    84-
    env["CPPFLAGS"] += host_env["CPPFLAGS"]
    85-
    env["CPPFLAGS"] += include
    71+
    if not exists:
    8672

    87-
    lib = "{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/libs/{arch}"
    88-
    lib = lib.format(ndk=self.ctx.ndk_dir,
    89-
    version=env["TOOLCHAIN_VERSION"],
    90-
    arch=arch.arch)
    91-
    env["LDFLAGS"] += " -lgnustl_shared -L"+lib
    92-
    93-
    env.pop("CFLAGS", None)
    94-
    env.pop("CXXFLAGS", None)
    95-
    96-
    with current_directory(build_android):
    97-
    shprint(
    98-
    configure,
    99-
    "--with-cross-build="+build_linux,
    100-
    "--enable-extras=no",
    101-
    "--enable-strict=no",
    102-
    "--enable-static",
    103-
    "--enable-tests=no",
    104-
    "--enable-samples=no",
    105-
    "--host="+env["TOOLCHAIN_PREFIX"],
    106-
    "--prefix="+icu_build,
    107-
    _env=env)
    108-
    shprint(sh.make, "-j5", _env=env)
    109-
    shprint(sh.make, "install", _env=env)
    73+
    configure = sh.Command(join(build_root, "source", "configure"))
    74+
    75+
    include = (
    76+
    " -I{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/include/"
    77+
    " -I{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/libs/"
    78+
    "{arch}/include")
    79+
    include = include.format(ndk=self.ctx.ndk_dir,
    80+
    version=env["TOOLCHAIN_VERSION"],
    81+
    arch=arch.arch)
    82+
    env["CPPFLAGS"] = env["CXXFLAGS"] + " "
    83+
    env["CPPFLAGS"] += host_env["CPPFLAGS"]
    84+
    env["CPPFLAGS"] += include
    85+
    86+
    lib = "{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/libs/{arch}"
    87+
    lib = lib.format(ndk=self.ctx.ndk_dir,
    88+
    version=env["TOOLCHAIN_VERSION"],
    89+
    arch=arch.arch)
    90+
    env["LDFLAGS"] += " -lgnustl_shared -L"+lib
    91+
    92+
    env.pop("CFLAGS", None)
    93+
    env.pop("CXXFLAGS", None)
    94+
    95+
    with current_directory(build_android):
    96+
    shprint(
    97+
    configure,
    98+
    "--with-cross-build="+build_linux,
    99+
    "--enable-extras=no",
    100+
    "--enable-strict=no",
    101+
    "--enable-static",
    102+
    "--enable-tests=no",
    103+
    "--enable-samples=no",
    104+
    "--host="+env["TOOLCHAIN_PREFIX"],
    105+
    "--prefix="+icu_build,
    106+
    _env=env)
    107+
    shprint(sh.make, "-j5", _env=env)
    108+
    shprint(sh.make, "install", _env=env)
    110109

    111110
    self.copy_files(arch)
    112111

    113112
    def copy_files(self, arch):
    114-
    ndk = self.ctx.ndk_dir
    115113
    env = self.get_recipe_env(arch)
    116114

    117115
    lib = "{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/libs/{arch}"

    pythonforandroid/toolchain.py

    Lines changed: 9 additions & 7 deletions
    Original file line numberDiff line numberDiff line change
    @@ -871,18 +871,20 @@ def _adb(self, commands):
    871871

    872872

    873873
    def build_status(self, args):
    874-
    875874
    print('{Style.BRIGHT}Bootstraps whose core components are probably '
    876875
    'already built:{Style.RESET_ALL}'.format(Style=Out_Style))
    877-
    for filen in os.listdir(join(self.ctx.build_dir, 'bootstrap_builds')):
    878-
    print(' {Fore.GREEN}{Style.BRIGHT}{filen}{Style.RESET_ALL}'
    879-
    .format(filen=filen, Fore=Out_Fore, Style=Out_Style))
    876+
    877+
    bootstrap_dir = join(self.ctx.build_dir, 'bootstrap_builds')
    878+
    if exists(bootstrap_dir):
    879+
    for filen in os.listdir(bootstrap_dir):
    880+
    print(' {Fore.GREEN}{Style.BRIGHT}{filen}{Style.RESET_ALL}'
    881+
    .format(filen=filen, Fore=Out_Fore, Style=Out_Style))
    880882

    881883
    print('{Style.BRIGHT}Recipes that are probably already built:'
    882884
    '{Style.RESET_ALL}'.format(Style=Out_Style))
    883-
    if exists(join(self.ctx.build_dir, 'other_builds')):
    884-
    for filen in sorted(
    885-
    os.listdir(join(self.ctx.build_dir, 'other_builds'))):
    885+
    other_builds_dir = join(self.ctx.build_dir, 'other_builds')
    886+
    if exists(other_builds_dir):
    887+
    for filen in sorted(os.listdir(other_builds_dir)):
    886888
    name = filen.split('-')[0]
    887889
    dependencies = filen.split('-')[1:]
    888890
    recipe_str = (' {Style.BRIGHT}{Fore.GREEN}{name}'

    0 commit comments

    Comments
     (0)
    0