We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[package] swig/4.0.2: Unable to build using shared=True
It appears, `conans.CMake` runs outside of run environment. This causes issues when an upstream provides a build tool that requires `LD_LIBRARY_PATHS`. For example, see the instructions below for `swig` when building with `shared=True` flags.

The failure resolves by using `RunEnvironment` explicitly. Is there a good reason not to use `RunEnvironment` _implicitly_? 
~~~patch
diff --git i/recipes/swig/all/test_package/conanfile.py w/recipes/swig/all/test_package/conanfile.py
index 8b165ecd..8dc4b9b5 100644
--- i/recipes/swig/all/test_package/conanfile.py
+++ w/recipes/swig/all/test_package/conanfile.py
@@ -1,4 +1,4 @@
-from conans import CMake, ConanFile, tools
+from conans import CMake, ConanFile, tools, RunEnvironment


 class TestPackageConan(ConanFile):
@@ -21,11 +21,13 @@ class TestPackageConan(ConanFile):

     def build(self):
         if self._can_build:
-            self._cmake.configure()
-            self._cmake.build()
+            env_build = RunEnvironment(self)
+            with tools.environment_append(env_build.vars):
+                self._cmake.configure()
+                self._cmake.build()

     def test(self):
         if not tools.cross_building(self.settings):
             if self._can_build:
                 self._cmake.test(output_on_failure=True)
-            self.run("swig -version")
+            self.run("swig -version", run_environment=True)
~~~

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **swig/4.0.2**
  * Operating System+version: **Debian GNU/Linux 10 (buster)**
  * Compiler+version: **GCC 9**
  * Conan version: **conan 1.34.1**
  * Python version: **Python 3.9.2**

### Steps to reproduce (Include if Applicable)
~~~
$ conan create . swig/4.0.2@ -o '*:shared=True' --build=missing --build=swig
...
-- Build files have been written to: /scratch/adklimki/conan-center-index/recipes/swig/all/test_package/build/750833d398e7a041deb748846200c7f6e390a6f4
[1/4] Swig compile test.i for python
...
.conan/data/swig/4.0.2/_/_/package/8d9623162576838bf5e4e0b3fae3a5a1a6010552/bin/swig: error while loading shared libraries: libpcre.so: cannot open shared object file: No such file or directory
ninja: build stopped: subcommand failed.
ERROR: swig/4.0.2 (test package): Error in build() method, line 25
~~~



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `recipes/swig/all/conanfile.py`
Content:
```
1 from conans import ConanFile, tools, AutoToolsBuildEnvironment
2 from contextlib import contextmanager
3 import os
4 
5 
6 class SwigConan(ConanFile):
7     name = "swig"
8     description = "SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages."
9     url = "https://github.com/conan-io/conan-center-index"
10     homepage = "http://www.swig.org"
11     license = "GPL-3.0-or-later"
12     topics = ("conan", "swig", "python", "java", "wrapper")
13     exports_sources = "patches/**", "cmake/*"
14     settings = "os", "arch", "compiler", "build_type"
15 
16     _autotools = None
17 
18     @property
19     def _source_subfolder(self):
20         return "source_subfolder"
21 
22     def configure(self):
23         del self.settings.compiler.libcxx
24         del self.settings.compiler.cppstd
25 
26     def build_requirements(self):
27         if tools.os_info.is_windows and not tools.get_env("CONAN_BASH_PATH") \
28                 and tools.os_info.detect_windows_subsystem() != "msys2":
29             self.build_requires("msys2/20190524")
30         if self.settings.compiler == "Visual Studio":
31             self.build_requires("winflexbison/2.5.22")
32         else:
33             self.build_requires("bison/3.7.1")
34         self.build_requires("automake/1.16.2")
35 
36     def requirements(self):
37         self.requires("pcre/8.41")
38 
39     def source(self):
40         tools.get(**self.conan_data["sources"][self.version])
41         os.rename("swig-rel-{}".format(self.version), self._source_subfolder)
42 
43     @contextmanager
44     def _build_context(self):
45         env = {}
46         if self.settings.compiler != "Visual Studio":
47             env["YACC"] = self.deps_user_info["bison"].YACC
48         if self.settings.compiler == "Visual Studio":
49             with tools.vcvars(self.settings):
50                 env.update({
51                     "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
52                     "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
53                     "AR": "{} link".format(self.deps_user_info["automake"].ar_lib),
54                     "LD": "link",
55                 })
56                 with tools.environment_append(env):
57                     yield
58         else:
59             with tools.environment_append(env):
60                 yield
61 
62     def _configure_autotools(self):
63         if self._autotools:
64             return self._autotools
65 
66         self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
67         deps_libpaths = self._autotools.library_paths
68         deps_libs = self._autotools.libs
69         deps_defines = self._autotools.defines
70         if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio":
71             self._autotools.link_flags.append("-static")
72 
73         libargs = list("-L\"{}\"".format(p) for p in deps_libpaths) + list("-l\"{}\"".format(l) for l in deps_libs)
74         args = [
75             "PCRE_LIBS={}".format(" ".join(libargs)),
76             "PCRE_CPPFLAGS={}".format(" ".join("-D{}".format(define) for define in deps_defines)),
77             "--host={}".format(self.settings.arch),
78             "--with-swiglibdir={}".format(self._swiglibdir),
79         ]
80 
81         host, build = None, None
82 
83         if self.settings.compiler == "Visual Studio":
84             self.output.warn("Visual Studio compiler cannot create ccache-swig. Disabling ccache-swig.")
85             args.append("--disable-ccache")
86             self._autotools.flags.append("-FS")
87             # MSVC canonical names aren't understood
88             host, build = False, False
89 
90         self._autotools.libs = []
91         self._autotools.library_paths = []
92 
93         self._autotools.configure(args=args, configure_dir=self._source_subfolder,
94                                   host=host, build=build)
95         return self._autotools
96 
97     def _patch_sources(self):
98         for patch in self.conan_data["patches"][self.version]:
99             tools.patch(**patch)
100 
101     def build(self):
102         self._patch_sources()
103         with tools.chdir(os.path.join(self._source_subfolder)):
104             self.run("./autogen.sh", win_bash=tools.os_info.is_windows)
105         with self._build_context():
106             autotools = self._configure_autotools()
107             autotools.make()
108 
109     def package(self):
110         self.copy(pattern="LICENSE*", dst="licenses", src=self._source_subfolder)
111         self.copy(pattern="COPYRIGHT", dst="licenses", src=self._source_subfolder)
112         self.copy("*", src="cmake", dst=self._module_subfolder)
113         with self._build_context():
114             autotools = self._configure_autotools()
115             autotools.install()
116 
117     @property
118     def _swiglibdir(self):
119         return os.path.join(self.package_folder, "bin", "swiglib").replace("\\", "/")
120 
121     @property
122     def _module_subfolder(self):
123         return os.path.join("lib", "cmake")
124 
125     @property
126     def _module_file(self):
127         return "conan-official-{}-targets.cmake".format(self.name)
128 
129     def package_info(self):
130         self.cpp_info.names["cmake_find_package"] = "SWIG"
131         self.cpp_info.names["cmake_find_package_multi"] = "SWIG"
132         self.cpp_info.builddirs = [self._module_subfolder]
133         self.cpp_info.build_modules = [os.path.join(self._module_subfolder, self._module_file)]
134 
135         bindir = os.path.join(self.package_folder, "bin")
136         self.output.info("Appending PATH environment variable: {}".format(bindir))
137         self.env_info.PATH.append(bindir)
138
```
--- 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()

```

diff --git a/recipes/swig/all/conanfile.py b/recipes/swig/all/conanfile.py
--- a/recipes/swig/all/conanfile.py
+++ b/recipes/swig/all/conanfile.py
@@ -40,17 +40,25 @@
         tools.get(**self.conan_data["sources"][self.version])
         os.rename("swig-rel-{}".format(self.version), self._source_subfolder)
 
+    @property
+    def _user_info_build(self):
+        # If using the experimental feature with different context for host and
+        # build, the 'user_info' attributes of the 'build_requires' packages
+        # will be located into the 'user_info_build' object. In other cases they
+        # will be located into the 'deps_user_info' object.
+        return getattr(self, "user_info_build", None) or self.deps_user_info
+
     @contextmanager
     def _build_context(self):
         env = {}
         if self.settings.compiler != "Visual Studio":
-            env["YACC"] = self.deps_user_info["bison"].YACC
+            env["YACC"] = self._user_info_build["bison"].YACC
         if self.settings.compiler == "Visual Studio":
             with tools.vcvars(self.settings):
                 env.update({
-                    "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
-                    "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
-                    "AR": "{} link".format(self.deps_user_info["automake"].ar_lib),
+                    "CC": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)),
+                    "CXX": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)),
+                    "AR": "{} link".format(self._user_info_build["automake"].ar_lib),
                     "LD": "link",
                 })
                 with tools.environment_append(env):

{"golden_diff": "diff --git a/recipes/swig/all/conanfile.py b/recipes/swig/all/conanfile.py\n--- a/recipes/swig/all/conanfile.py\n+++ b/recipes/swig/all/conanfile.py\n@@ -40,17 +40,25 @@\n         tools.get(**self.conan_data[\"sources\"][self.version])\n         os.rename(\"swig-rel-{}\".format(self.version), self._source_subfolder)\n \n+    @property\n+    def _user_info_build(self):\n+        # If using the experimental feature with different context for host and\n+        # build, the 'user_info' attributes of the 'build_requires' packages\n+        # will be located into the 'user_info_build' object. In other cases they\n+        # will be located into the 'deps_user_info' object.\n+        return getattr(self, \"user_info_build\", None) or self.deps_user_info\n+\n     @contextmanager\n     def _build_context(self):\n         env = {}\n         if self.settings.compiler != \"Visual Studio\":\n-            env[\"YACC\"] = self.deps_user_info[\"bison\"].YACC\n+            env[\"YACC\"] = self._user_info_build[\"bison\"].YACC\n         if self.settings.compiler == \"Visual Studio\":\n             with tools.vcvars(self.settings):\n                 env.update({\n-                    \"CC\": \"{} cl -nologo\".format(tools.unix_path(self.deps_user_info[\"automake\"].compile)),\n-                    \"CXX\": \"{} cl -nologo\".format(tools.unix_path(self.deps_user_info[\"automake\"].compile)),\n-                    \"AR\": \"{} link\".format(self.deps_user_info[\"automake\"].ar_lib),\n+                    \"CC\": \"{} cl -nologo\".format(tools.unix_path(self._user_info_build[\"automake\"].compile)),\n+                    \"CXX\": \"{} cl -nologo\".format(tools.unix_path(self._user_info_build[\"automake\"].compile)),\n+                    \"AR\": \"{} link\".format(self._user_info_build[\"automake\"].ar_lib),\n                     \"LD\": \"link\",\n                 })\n                 with tools.environment_append(env):\n", "issue": "[package] swig/4.0.2: Unable to build using shared=True\nIt appears, `conans.CMake` runs outside of run environment. This causes issues when an upstream provides a build tool that requires `LD_LIBRARY_PATHS`. For example, see the instructions below for `swig` when building with `shared=True` flags.\r\n\r\nThe failure resolves by using `RunEnvironment` explicitly. Is there a good reason not to use `RunEnvironment` _implicitly_? \r\n~~~patch\r\ndiff --git i/recipes/swig/all/test_package/conanfile.py w/recipes/swig/all/test_package/conanfile.py\r\nindex 8b165ecd..8dc4b9b5 100644\r\n--- i/recipes/swig/all/test_package/conanfile.py\r\n+++ w/recipes/swig/all/test_package/conanfile.py\r\n@@ -1,4 +1,4 @@\r\n-from conans import CMake, ConanFile, tools\r\n+from conans import CMake, ConanFile, tools, RunEnvironment\r\n\r\n\r\n class TestPackageConan(ConanFile):\r\n@@ -21,11 +21,13 @@ class TestPackageConan(ConanFile):\r\n\r\n     def build(self):\r\n         if self._can_build:\r\n-            self._cmake.configure()\r\n-            self._cmake.build()\r\n+            env_build = RunEnvironment(self)\r\n+            with tools.environment_append(env_build.vars):\r\n+                self._cmake.configure()\r\n+                self._cmake.build()\r\n\r\n     def test(self):\r\n         if not tools.cross_building(self.settings):\r\n             if self._can_build:\r\n                 self._cmake.test(output_on_failure=True)\r\n-            self.run(\"swig -version\")\r\n+            self.run(\"swig -version\", run_environment=True)\r\n~~~\r\n\r\n### Package and Environment Details (include every applicable attribute)\r\n  * Package Name/Version: **swig/4.0.2**\r\n  * Operating System+version: **Debian GNU/Linux 10 (buster)**\r\n  * Compiler+version: **GCC 9**\r\n  * Conan version: **conan 1.34.1**\r\n  * Python version: **Python 3.9.2**\r\n\r\n### Steps to reproduce (Include if Applicable)\r\n~~~\r\n$ conan create . swig/4.0.2@ -o '*:shared=True' --build=missing --build=swig\r\n...\r\n-- Build files have been written to: /scratch/adklimki/conan-center-index/recipes/swig/all/test_package/build/750833d398e7a041deb748846200c7f6e390a6f4\r\n[1/4] Swig compile test.i for python\r\n...\r\n.conan/data/swig/4.0.2/_/_/package/8d9623162576838bf5e4e0b3fae3a5a1a6010552/bin/swig: error while loading shared libraries: libpcre.so: cannot open shared object file: No such file or directory\r\nninja: build stopped: subcommand failed.\r\nERROR: swig/4.0.2 (test package): Error in build() method, line 25\r\n~~~\r\n\r\n\n", "before_files": [{"content": "from conans import ConanFile, tools, AutoToolsBuildEnvironment\nfrom contextlib import contextmanager\nimport os\n\n\nclass SwigConan(ConanFile):\n    name = \"swig\"\n    description = \"SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    homepage = \"http://www.swig.org\"\n    license = \"GPL-3.0-or-later\"\n    topics = (\"conan\", \"swig\", \"python\", \"java\", \"wrapper\")\n    exports_sources = \"patches/**\", \"cmake/*\"\n    settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n\n    _autotools = None\n\n    @property\n    def _source_subfolder(self):\n        return \"source_subfolder\"\n\n    def configure(self):\n        del self.settings.compiler.libcxx\n        del self.settings.compiler.cppstd\n\n    def build_requirements(self):\n        if tools.os_info.is_windows and not tools.get_env(\"CONAN_BASH_PATH\") \\\n                and tools.os_info.detect_windows_subsystem() != \"msys2\":\n            self.build_requires(\"msys2/20190524\")\n        if self.settings.compiler == \"Visual Studio\":\n            self.build_requires(\"winflexbison/2.5.22\")\n        else:\n            self.build_requires(\"bison/3.7.1\")\n        self.build_requires(\"automake/1.16.2\")\n\n    def requirements(self):\n        self.requires(\"pcre/8.41\")\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version])\n        os.rename(\"swig-rel-{}\".format(self.version), self._source_subfolder)\n\n    @contextmanager\n    def _build_context(self):\n        env = {}\n        if self.settings.compiler != \"Visual Studio\":\n            env[\"YACC\"] = self.deps_user_info[\"bison\"].YACC\n        if self.settings.compiler == \"Visual Studio\":\n            with tools.vcvars(self.settings):\n                env.update({\n                    \"CC\": \"{} cl -nologo\".format(tools.unix_path(self.deps_user_info[\"automake\"].compile)),\n                    \"CXX\": \"{} cl -nologo\".format(tools.unix_path(self.deps_user_info[\"automake\"].compile)),\n                    \"AR\": \"{} link\".format(self.deps_user_info[\"automake\"].ar_lib),\n                    \"LD\": \"link\",\n                })\n                with tools.environment_append(env):\n                    yield\n        else:\n            with tools.environment_append(env):\n                yield\n\n    def _configure_autotools(self):\n        if self._autotools:\n            return self._autotools\n\n        self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)\n        deps_libpaths = self._autotools.library_paths\n        deps_libs = self._autotools.libs\n        deps_defines = self._autotools.defines\n        if self.settings.os == \"Windows\" and self.settings.compiler != \"Visual Studio\":\n            self._autotools.link_flags.append(\"-static\")\n\n        libargs = list(\"-L\\\"{}\\\"\".format(p) for p in deps_libpaths) + list(\"-l\\\"{}\\\"\".format(l) for l in deps_libs)\n        args = [\n            \"PCRE_LIBS={}\".format(\" \".join(libargs)),\n            \"PCRE_CPPFLAGS={}\".format(\" \".join(\"-D{}\".format(define) for define in deps_defines)),\n            \"--host={}\".format(self.settings.arch),\n            \"--with-swiglibdir={}\".format(self._swiglibdir),\n        ]\n\n        host, build = None, None\n\n        if self.settings.compiler == \"Visual Studio\":\n            self.output.warn(\"Visual Studio compiler cannot create ccache-swig. Disabling ccache-swig.\")\n            args.append(\"--disable-ccache\")\n            self._autotools.flags.append(\"-FS\")\n            # MSVC canonical names aren't understood\n            host, build = False, False\n\n        self._autotools.libs = []\n        self._autotools.library_paths = []\n\n        self._autotools.configure(args=args, configure_dir=self._source_subfolder,\n                                  host=host, build=build)\n        return self._autotools\n\n    def _patch_sources(self):\n        for patch in self.conan_data[\"patches\"][self.version]:\n            tools.patch(**patch)\n\n    def build(self):\n        self._patch_sources()\n        with tools.chdir(os.path.join(self._source_subfolder)):\n            self.run(\"./autogen.sh\", win_bash=tools.os_info.is_windows)\n        with self._build_context():\n            autotools = self._configure_autotools()\n            autotools.make()\n\n    def package(self):\n        self.copy(pattern=\"LICENSE*\", dst=\"licenses\", src=self._source_subfolder)\n        self.copy(pattern=\"COPYRIGHT\", dst=\"licenses\", src=self._source_subfolder)\n        self.copy(\"*\", src=\"cmake\", dst=self._module_subfolder)\n        with self._build_context():\n            autotools = self._configure_autotools()\n            autotools.install()\n\n    @property\n    def _swiglibdir(self):\n        return os.path.join(self.package_folder, \"bin\", \"swiglib\").replace(\"\\\\\", \"/\")\n\n    @property\n    def _module_subfolder(self):\n        return os.path.join(\"lib\", \"cmake\")\n\n    @property\n    def _module_file(self):\n        return \"conan-official-{}-targets.cmake\".format(self.name)\n\n    def package_info(self):\n        self.cpp_info.names[\"cmake_find_package\"] = \"SWIG\"\n        self.cpp_info.names[\"cmake_find_package_multi\"] = \"SWIG\"\n        self.cpp_info.builddirs = [self._module_subfolder]\n        self.cpp_info.build_modules = [os.path.join(self._module_subfolder, self._module_file)]\n\n        bindir = os.path.join(self.package_folder, \"bin\")\n        self.output.info(\"Appending PATH environment variable: {}\".format(bindir))\n        self.env_info.PATH.append(bindir)\n", "path": "recipes/swig/all/conanfile.py"}], "after_files": [{"content": "from conans import ConanFile, tools, AutoToolsBuildEnvironment\nfrom contextlib import contextmanager\nimport os\n\n\nclass SwigConan(ConanFile):\n    name = \"swig\"\n    description = \"SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    homepage = \"http://www.swig.org\"\n    license = \"GPL-3.0-or-later\"\n    topics = (\"conan\", \"swig\", \"python\", \"java\", \"wrapper\")\n    exports_sources = \"patches/**\", \"cmake/*\"\n    settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n\n    _autotools = None\n\n    @property\n    def _source_subfolder(self):\n        return \"source_subfolder\"\n\n    def configure(self):\n        del self.settings.compiler.libcxx\n        del self.settings.compiler.cppstd\n\n    def build_requirements(self):\n        if tools.os_info.is_windows and not tools.get_env(\"CONAN_BASH_PATH\") \\\n                and tools.os_info.detect_windows_subsystem() != \"msys2\":\n            self.build_requires(\"msys2/20190524\")\n        if self.settings.compiler == \"Visual Studio\":\n            self.build_requires(\"winflexbison/2.5.22\")\n        else:\n            self.build_requires(\"bison/3.7.1\")\n        self.build_requires(\"automake/1.16.2\")\n\n    def requirements(self):\n        self.requires(\"pcre/8.41\")\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version])\n        os.rename(\"swig-rel-{}\".format(self.version), self._source_subfolder)\n\n    @property\n    def _user_info_build(self):\n        # If using the experimental feature with different context for host and\n        # build, the 'user_info' attributes of the 'build_requires' packages\n        # will be located into the 'user_info_build' object. In other cases they\n        # will be located into the 'deps_user_info' object.\n        return getattr(self, \"user_info_build\", None) or self.deps_user_info\n\n    @contextmanager\n    def _build_context(self):\n        env = {}\n        if self.settings.compiler != \"Visual Studio\":\n            env[\"YACC\"] = self._user_info_build[\"bison\"].YACC\n        if self.settings.compiler == \"Visual Studio\":\n            with tools.vcvars(self.settings):\n                env.update({\n                    \"CC\": \"{} cl -nologo\".format(tools.unix_path(self._user_info_build[\"automake\"].compile)),\n                    \"CXX\": \"{} cl -nologo\".format(tools.unix_path(self._user_info_build[\"automake\"].compile)),\n                    \"AR\": \"{} link\".format(self._user_info_build[\"automake\"].ar_lib),\n                    \"LD\": \"link\",\n                })\n                with tools.environment_append(env):\n                    yield\n        else:\n            with tools.environment_append(env):\n                yield\n\n    def _configure_autotools(self):\n        if self._autotools:\n            return self._autotools\n\n        self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)\n        deps_libpaths = self._autotools.library_paths\n        deps_libs = self._autotools.libs\n        deps_defines = self._autotools.defines\n        if self.settings.os == \"Windows\" and self.settings.compiler != \"Visual Studio\":\n            self._autotools.link_flags.append(\"-static\")\n\n        libargs = list(\"-L\\\"{}\\\"\".format(p) for p in deps_libpaths) + list(\"-l\\\"{}\\\"\".format(l) for l in deps_libs)\n        args = [\n            \"PCRE_LIBS={}\".format(\" \".join(libargs)),\n            \"PCRE_CPPFLAGS={}\".format(\" \".join(\"-D{}\".format(define) for define in deps_defines)),\n            \"--host={}\".format(self.settings.arch),\n            \"--with-swiglibdir={}\".format(self._swiglibdir),\n        ]\n\n        host, build = None, None\n\n        if self.settings.compiler == \"Visual Studio\":\n            self.output.warn(\"Visual Studio compiler cannot create ccache-swig. Disabling ccache-swig.\")\n            args.append(\"--disable-ccache\")\n            self._autotools.flags.append(\"-FS\")\n            # MSVC canonical names aren't understood\n            host, build = False, False\n\n        self._autotools.libs = []\n        self._autotools.library_paths = []\n\n        self._autotools.configure(args=args, configure_dir=self._source_subfolder,\n                                  host=host, build=build)\n        return self._autotools\n\n    def _patch_sources(self):\n        for patch in self.conan_data[\"patches\"][self.version]:\n            tools.patch(**patch)\n\n    def build(self):\n        self._patch_sources()\n        with tools.chdir(os.path.join(self._source_subfolder)):\n            self.run(\"./autogen.sh\", win_bash=tools.os_info.is_windows)\n        with self._build_context():\n            autotools = self._configure_autotools()\n            autotools.make()\n\n    def package(self):\n        self.copy(pattern=\"LICENSE*\", dst=\"licenses\", src=self._source_subfolder)\n        self.copy(pattern=\"COPYRIGHT\", dst=\"licenses\", src=self._source_subfolder)\n        self.copy(\"*\", src=\"cmake\", dst=self._module_subfolder)\n        with self._build_context():\n            autotools = self._configure_autotools()\n            autotools.install()\n\n    @property\n    def _swiglibdir(self):\n        return os.path.join(self.package_folder, \"bin\", \"swiglib\").replace(\"\\\\\", \"/\")\n\n    @property\n    def _module_subfolder(self):\n        return os.path.join(\"lib\", \"cmake\")\n\n    @property\n    def _module_file(self):\n        return \"conan-official-{}-targets.cmake\".format(self.name)\n\n    def package_info(self):\n        self.cpp_info.names[\"cmake_find_package\"] = \"SWIG\"\n        self.cpp_info.names[\"cmake_find_package_multi\"] = \"SWIG\"\n        self.cpp_info.builddirs = [self._module_subfolder]\n        self.cpp_info.build_modules = [os.path.join(self._module_subfolder, self._module_file)]\n\n        bindir = os.path.join(self.package_folder, \"bin\")\n        self.output.info(\"Appending PATH environment variable: {}\".format(bindir))\n        self.env_info.PATH.append(bindir)\n", "path": "recipes/swig/all/conanfile.py"}]}