Skip to content

Commit

Permalink
Use p4a_install instead of install, as a file named INSTALL is alread…
Browse files Browse the repository at this point in the history
…y present. (#2663)
  • Loading branch information
misl6 committed Sep 2, 2022
1 parent cea7b2d commit 5e2d44f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
9 changes: 4 additions & 5 deletions pythonforandroid/recipes/liblzma/__init__.py
Expand Up @@ -6,18 +6,18 @@
from pythonforandroid.archs import Arch
from pythonforandroid.logger import shprint
from pythonforandroid.recipe import Recipe
from pythonforandroid.util import current_directory, ensure_dir
from pythonforandroid.util import current_directory


class LibLzmaRecipe(Recipe):

version = '5.2.4'
url = 'https://tukaani.org/xz/xz-{version}.tar.gz'
built_libraries = {'liblzma.so': 'install/lib'}
built_libraries = {'liblzma.so': 'p4a_install/lib'}

def build_arch(self, arch: Arch) -> None:
env = self.get_recipe_env(arch)
install_dir = join(self.get_build_dir(arch.arch), 'install')
install_dir = join(self.get_build_dir(arch.arch), 'p4a_install')
with current_directory(self.get_build_dir(arch.arch)):
if not exists('configure'):
shprint(sh.Command('./autogen.sh'), _env=env)
Expand All @@ -42,7 +42,6 @@ def build_arch(self, arch: Arch) -> None:
_env=env
)

ensure_dir('install')
shprint(sh.make, 'install', _env=env)

def get_library_includes(self, arch: Arch) -> str:
Expand All @@ -52,7 +51,7 @@ def get_library_includes(self, arch: Arch) -> str:
variable `CPPFLAGS`.
"""
return " -I" + join(
self.get_build_dir(arch.arch), 'install', 'include',
self.get_build_dir(arch.arch), 'p4a_install', 'include',
)

def get_library_ldflags(self, arch: Arch) -> str:
Expand Down
20 changes: 18 additions & 2 deletions tests/recipes/test_liblzma.py
Expand Up @@ -15,7 +15,7 @@ def test_get_library_includes(self):
recipe_build_dir = self.recipe.get_build_dir(self.arch.arch)
self.assertEqual(
self.recipe.get_library_includes(self.arch),
f" -I{join(recipe_build_dir, 'install/include')}",
f" -I{join(recipe_build_dir, 'p4a_install/include')}",
)

def test_get_library_ldflags(self):
Expand All @@ -25,11 +25,27 @@ def test_get_library_ldflags(self):
recipe_build_dir = self.recipe.get_build_dir(self.arch.arch)
self.assertEqual(
self.recipe.get_library_ldflags(self.arch),
f" -L{join(recipe_build_dir, 'install/lib')}",
f" -L{join(recipe_build_dir, 'p4a_install/lib')}",
)

def test_link_libs_flags(self):
"""
Test :meth:`~pythonforandroid.recipes.liblzma.get_library_libs_flag`.
"""
self.assertEqual(self.recipe.get_library_libs_flag(), " -llzma")

def test_install_dir_not_named_install(self):
"""
Tests that the install directory is not named ``install``.
liblzma already have a file named ``INSTALL`` in its source directory.
On case-insensitive filesystems, using a folder named ``install`` will
cause a conflict. (See issue: #2343).
WARNING: This test is quite flaky, but should be enough to
ensure that someone in the future will not accidentally rename
the install directory without seeing this test to fail.
"""
liblzma_install_dir = self.recipe.built_libraries["liblzma.so"]

self.assertNotIn("install", liblzma_install_dir.split("/"))

0 comments on commit 5e2d44f

Please sign in to comment.