prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  libxml2 build broken on latest p4a master with python 3
  With latest p4a master & python3crystax & host python 3, the libxml2 recipe gets built inside `/root/.local/share/python-for-android/build/other_builds/libxml2/armeabi-v7a__ndk_target_19/libxml2/ `.
  
  This is a folder name change, previously it used to be in `/root/.local/share/python-for-android/build/other_builds/libxml2/armeabi-v7a/libxml2/` - and as a result, the path detection inside the libxml2 fails for some reason.
  
  ### Versions
  
  * Python: host python 3.x, python3crystax target
  * OS: ubuntu in docker
  * Kivy: not used
  * Cython: not sure, but I don't think it's relevant
  
  Edit: corrected lxml -> libxml2
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pythonforandroid/recipes/libxslt/__init__.py`
  Content:
  ```
  1 from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
  2 from os.path import exists, join, dirname
  3 import sh
  4 
  5 
  6 class LibxsltRecipe(Recipe):
  7     version = "1.1.28"
  8     url = "http://xmlsoft.org/sources/libxslt-{version}.tar.gz"
  9     depends = ["libxml2"]
  10     patches = ["fix-dlopen.patch"]
  11 
  12     call_hostpython_via_targetpython = False
  13 
  14     def should_build(self, arch):
  15         super(LibxsltRecipe, self).should_build(arch)
  16         return not exists(join(self.ctx.get_libs_dir(arch.arch), "libxslt.a"))
  17 
  18     def build_arch(self, arch):
  19         super(LibxsltRecipe, self).build_arch(arch)
  20         env = self.get_recipe_env(arch)
  21         with current_directory(self.get_build_dir(arch.arch)):
  22             # If the build is done with /bin/sh things blow up,
  23             # try really hard to use bash
  24             env["CC"] += " -I%s" % self.get_build_dir(arch.arch)
  25             libxml = (
  26                 dirname(dirname(self.get_build_container_dir(arch.arch)))
  27                 + "/libxml2/%s/libxml2" % arch.arch
  28             )
  29             shprint(
  30                 sh.Command("./configure"),
  31                 "--build=i686-pc-linux-gnu",
  32                 "--host=arm-linux-eabi",
  33                 "--without-plugins",
  34                 "--without-debug",
  35                 "--without-python",
  36                 "--without-crypto",
  37                 "--with-libxml-src=%s" % libxml,
  38                 _env=env,
  39             )
  40             shprint(sh.make, "V=1", _env=env)
  41             shutil.copyfile(
  42                 "libxslt/.libs/libxslt.a",
  43                 join(self.ctx.get_libs_dir(arch.arch), "libxslt.a"),
  44             )
  45             shutil.copyfile(
  46                 "libexslt/.libs/libexslt.a",
  47                 join(self.ctx.get_libs_dir(arch.arch), "libexslt.a"),
  48             )
  49 
  50     def get_recipe_env(self, arch):
  51         env = super(LibxsltRecipe, self).get_recipe_env(arch)
  52         env["CONFIG_SHELL"] = "/bin/bash"
  53         env["SHELL"] = "/bin/bash"
  54         env[
  55             "CC"
  56         ] = "arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot={}".format(
  57             self.ctx.ndk_platform
  58         )
  59 
  60         env["LDSHARED"] = "%s -nostartfiles -shared -fPIC" % env["CC"]
  61         return env
  62 
  63 
  64 recipe = LibxsltRecipe()
  65
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pythonforandroid/recipes/libxslt/__init__.py b/pythonforandroid/recipes/libxslt/__init__.py
  --- a/pythonforandroid/recipes/libxslt/__init__.py
  +++ b/pythonforandroid/recipes/libxslt/__init__.py
  @@ -1,5 +1,5 @@
   from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
  -from os.path import exists, join, dirname
  +from os.path import exists, join
   import sh
   
   
  @@ -22,10 +22,8 @@
               # If the build is done with /bin/sh things blow up,
               # try really hard to use bash
               env["CC"] += " -I%s" % self.get_build_dir(arch.arch)
  -            libxml = (
  -                dirname(dirname(self.get_build_container_dir(arch.arch)))
  -                + "/libxml2/%s/libxml2" % arch.arch
  -            )
  +            libxml = Recipe.get_recipe(
  +                'libxml2', self.ctx).get_build_dir(arch.arch)
               shprint(
                   sh.Command("./configure"),
                   "--build=i686-pc-linux-gnu",
  
verification_info: {"golden_diff": "diff --git a/pythonforandroid/recipes/libxslt/__init__.py b/pythonforandroid/recipes/libxslt/__init__.py\n--- a/pythonforandroid/recipes/libxslt/__init__.py\n+++ b/pythonforandroid/recipes/libxslt/__init__.py\n@@ -1,5 +1,5 @@\n from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory\n-from os.path import exists, join, dirname\n+from os.path import exists, join\n import sh\n \n \n@@ -22,10 +22,8 @@\n             # If the build is done with /bin/sh things blow up,\n             # try really hard to use bash\n             env[\"CC\"] += \" -I%s\" % self.get_build_dir(arch.arch)\n-            libxml = (\n-                dirname(dirname(self.get_build_container_dir(arch.arch)))\n-                + \"/libxml2/%s/libxml2\" % arch.arch\n-            )\n+            libxml = Recipe.get_recipe(\n+                'libxml2', self.ctx).get_build_dir(arch.arch)\n             shprint(\n                 sh.Command(\"./configure\"),\n                 \"--build=i686-pc-linux-gnu\",\n", "issue": "libxml2 build broken on latest p4a master with python 3\nWith latest p4a master & python3crystax & host python 3, the libxml2 recipe gets built inside `/root/.local/share/python-for-android/build/other_builds/libxml2/armeabi-v7a__ndk_target_19/libxml2/ `.\r\n\r\nThis is a folder name change, previously it used to be in `/root/.local/share/python-for-android/build/other_builds/libxml2/armeabi-v7a/libxml2/` - and as a result, the path detection inside the libxml2 fails for some reason.\r\n\r\n### Versions\r\n\r\n* Python: host python 3.x, python3crystax target\r\n* OS: ubuntu in docker\r\n* Kivy: not used\r\n* Cython: not sure, but I don't think it's relevant\r\n\r\nEdit: corrected lxml -> libxml2\n", "before_files": [{"content": "from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory\nfrom os.path import exists, join, dirname\nimport sh\n\n\nclass LibxsltRecipe(Recipe):\n    version = \"1.1.28\"\n    url = \"http://xmlsoft.org/sources/libxslt-{version}.tar.gz\"\n    depends = [\"libxml2\"]\n    patches = [\"fix-dlopen.patch\"]\n\n    call_hostpython_via_targetpython = False\n\n    def should_build(self, arch):\n        super(LibxsltRecipe, self).should_build(arch)\n        return not exists(join(self.ctx.get_libs_dir(arch.arch), \"libxslt.a\"))\n\n    def build_arch(self, arch):\n        super(LibxsltRecipe, self).build_arch(arch)\n        env = self.get_recipe_env(arch)\n        with current_directory(self.get_build_dir(arch.arch)):\n            # If the build is done with /bin/sh things blow up,\n            # try really hard to use bash\n            env[\"CC\"] += \" -I%s\" % self.get_build_dir(arch.arch)\n            libxml = (\n                dirname(dirname(self.get_build_container_dir(arch.arch)))\n                + \"/libxml2/%s/libxml2\" % arch.arch\n            )\n            shprint(\n                sh.Command(\"./configure\"),\n                \"--build=i686-pc-linux-gnu\",\n                \"--host=arm-linux-eabi\",\n                \"--without-plugins\",\n                \"--without-debug\",\n                \"--without-python\",\n                \"--without-crypto\",\n                \"--with-libxml-src=%s\" % libxml,\n                _env=env,\n            )\n            shprint(sh.make, \"V=1\", _env=env)\n            shutil.copyfile(\n                \"libxslt/.libs/libxslt.a\",\n                join(self.ctx.get_libs_dir(arch.arch), \"libxslt.a\"),\n            )\n            shutil.copyfile(\n                \"libexslt/.libs/libexslt.a\",\n                join(self.ctx.get_libs_dir(arch.arch), \"libexslt.a\"),\n            )\n\n    def get_recipe_env(self, arch):\n        env = super(LibxsltRecipe, self).get_recipe_env(arch)\n        env[\"CONFIG_SHELL\"] = \"/bin/bash\"\n        env[\"SHELL\"] = \"/bin/bash\"\n        env[\n            \"CC\"\n        ] = \"arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot={}\".format(\n            self.ctx.ndk_platform\n        )\n\n        env[\"LDSHARED\"] = \"%s -nostartfiles -shared -fPIC\" % env[\"CC\"]\n        return env\n\n\nrecipe = LibxsltRecipe()\n", "path": "pythonforandroid/recipes/libxslt/__init__.py"}], "after_files": [{"content": "from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory\nfrom os.path import exists, join\nimport sh\n\n\nclass LibxsltRecipe(Recipe):\n    version = \"1.1.28\"\n    url = \"http://xmlsoft.org/sources/libxslt-{version}.tar.gz\"\n    depends = [\"libxml2\"]\n    patches = [\"fix-dlopen.patch\"]\n\n    call_hostpython_via_targetpython = False\n\n    def should_build(self, arch):\n        super(LibxsltRecipe, self).should_build(arch)\n        return not exists(join(self.ctx.get_libs_dir(arch.arch), \"libxslt.a\"))\n\n    def build_arch(self, arch):\n        super(LibxsltRecipe, self).build_arch(arch)\n        env = self.get_recipe_env(arch)\n        with current_directory(self.get_build_dir(arch.arch)):\n            # If the build is done with /bin/sh things blow up,\n            # try really hard to use bash\n            env[\"CC\"] += \" -I%s\" % self.get_build_dir(arch.arch)\n            libxml = Recipe.get_recipe(\n                'libxml2', self.ctx).get_build_dir(arch.arch)\n            shprint(\n                sh.Command(\"./configure\"),\n                \"--build=i686-pc-linux-gnu\",\n                \"--host=arm-linux-eabi\",\n                \"--without-plugins\",\n                \"--without-debug\",\n                \"--without-python\",\n                \"--without-crypto\",\n                \"--with-libxml-src=%s\" % libxml,\n                _env=env,\n            )\n            shprint(sh.make, \"V=1\", _env=env)\n            shutil.copyfile(\n                \"libxslt/.libs/libxslt.a\",\n                join(self.ctx.get_libs_dir(arch.arch), \"libxslt.a\"),\n            )\n            shutil.copyfile(\n                \"libexslt/.libs/libexslt.a\",\n                join(self.ctx.get_libs_dir(arch.arch), \"libexslt.a\"),\n            )\n\n    def get_recipe_env(self, arch):\n        env = super(LibxsltRecipe, self).get_recipe_env(arch)\n        env[\"CONFIG_SHELL\"] = \"/bin/bash\"\n        env[\"SHELL\"] = \"/bin/bash\"\n        env[\n            \"CC\"\n        ] = \"arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot={}\".format(\n            self.ctx.ndk_platform\n        )\n\n        env[\"LDSHARED\"] = \"%s -nostartfiles -shared -fPIC\" % env[\"CC\"]\n        return env\n\n\nrecipe = LibxsltRecipe()\n", "path": "pythonforandroid/recipes/libxslt/__init__.py"}]}