We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[package] swig/4.0.1: wrong bison used in windows with MinGW
<!-- 
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.
-->

### Package and Environment Details
  * Package Name/Version: **swig/4.0.1**
  * Operating System+version: **Windows 10*
  * Compiler+version: **GCC 8 (MinGW)**
  * Conan version: **conan 1.27.1**
  * Python version: **Python 3.7.4**


### Conan profile
```
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=8
build_type=Release
compiler.exception=seh
compiler.libcxx=libstdc++11
compiler.threads=posix
[options]
[build_requires]
mingw_installer/1.0@conan/stable
[env]

```

### Steps to reproduce (Include if Applicable)

`conan install -pr=mingw-w64 --build=missing swig/4.0.1@`

Build fails because swig tries to use winflexbison/2.5.22.


### Logs from winflexbison
```
......
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan setting CPP STANDARD: 14 WITH EXTENSIONS OFF
-- Conan: Compiler GCC>=5, checking major version 8.1
-- Conan: Checking correct version: 8.1
-- Conan: C++ stdlib: libstdc++11
CMake Error at source_subfolder/CMakeLists.txt:6 (message):
  Visual Studio Build supported only
```

See here:
https://github.com/conan-io/conan-center-index/issues/1967

### Root cause

In the conanfile.py of swig, the build requirements are wrong:

```python
    def build_requirements(self):
        if tools.os_info.is_windows and not tools.get_env("CONAN_BASH_PATH") \
                and tools.os_info.detect_windows_subsystem() != "msys2":
            self.build_requires("msys2/20190524")
        if tools.os_info.is_windows: // Bad!
            self.build_requires("winflexbison/2.5.22")
        else:
            self.build_requires("bison/3.5.3")
        self.build_requires("automake/1.16.2")
```

`winflexbison` only works with Visual Studio. So `bison` should be used instead.



--- 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/**"
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 tools.os_info.is_windows:
31             self.build_requires("winflexbison/2.5.22")
32         else:
33             self.build_requires("bison/3.5.3")
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         if self.settings.compiler == "Visual Studio":
46             with tools.vcvars(self.settings):
47                 env = {
48                     "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
49                     "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
50                     "AR": "{} link".format(self.deps_user_info["automake"].ar_lib),
51                     "LD": "link",
52                 }
53                 with tools.environment_append(env):
54                     yield
55         else:
56             yield
57 
58     def _configure_autotools(self):
59         if self._autotools:
60             return self._autotools
61 
62         self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
63         deps_libpaths = self._autotools.library_paths
64         deps_libs = self._autotools.libs
65         deps_defines = self._autotools.defines
66         if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio":
67             self._autotools.link_flags.append("-static")
68 
69         libargs = list("-L\"{}\"".format(p) for p in deps_libpaths) + list("-l\"{}\"".format(l) for l in deps_libs)
70         args = [
71             "PCRE_LIBS={}".format(" ".join(libargs)),
72             "PCRE_CPPFLAGS={}".format(" ".join("-D{}".format(define) for define in deps_defines)),
73             "--host={}".format(self.settings.arch),
74             "--with-swiglibdir={}".format(self._swiglibdir),
75         ]
76         if self.settings.compiler == "Visual Studio":
77             self.output.warn("Visual Studio compiler cannot create ccache-swig. Disabling ccache-swig.")
78             args.append("--disable-ccache")
79             self._autotools.flags.append("-FS")
80 
81         self._autotools.libs = []
82         self._autotools.library_paths = []
83 
84         self._autotools.configure(args=args, configure_dir=self._source_subfolder)
85         return self._autotools
86 
87     def _patch_sources(self):
88         for patch in self.conan_data["patches"][self.version]:
89             tools.patch(**patch)
90 
91     def build(self):
92         self._patch_sources()
93         with tools.chdir(os.path.join(self._source_subfolder)):
94             self.run("./autogen.sh", win_bash=tools.os_info.is_windows)
95         with self._build_context():
96             autotools = self._configure_autotools()
97             autotools.make()
98 
99     def package(self):
100         self.copy(pattern="LICENSE*", dst="licenses", src=self._source_subfolder)
101         self.copy(pattern="COPYRIGHT", dst="licenses", src=self._source_subfolder)
102         with self._build_context():
103             autotools = self._configure_autotools()
104             autotools.install()
105 
106         if self.settings.compiler != "Visual Studio":
107             with tools.chdir(os.path.join(self.package_folder, "bin")):
108                 strip = tools.get_env("STRIP") or tools.which("strip")
109                 ext = ".exe" if tools.os_info.is_windows else ""
110                 if strip:
111                     self.run("{} swig{}".format(strip, ext), win_bash=tools.os_info.is_windows)
112                     self.run("{} ccache-swig{}".format(strip, ext), win_bash=tools.os_info.is_windows)
113 
114     @property
115     def _swiglibdir(self):
116         return os.path.join(self.package_folder, "bin", "swiglib").replace("\\", "/")
117 
118     def package_info(self):
119         # FIXME: Don't set cmake_find_package name because conan cmake generators do not define SWIG_EXECUTABLE
120         # self.cpp_info.names["cmake_find_package"] = "SWIG"
121         # self.cpp_info.names["cmake_find_package_multi"] = "SWIG"
122 
123         bindir = os.path.join(self.package_folder, "bin")
124         self.output.info("Appending PATH environment variable: {}".format(bindir))
125         self.env_info.PATH.append(bindir)
126
```
--- 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
@@ -27,10 +27,10 @@
         if tools.os_info.is_windows and not tools.get_env("CONAN_BASH_PATH") \
                 and tools.os_info.detect_windows_subsystem() != "msys2":
             self.build_requires("msys2/20190524")
-        if tools.os_info.is_windows:
+        if self.settings.compiler == "Visual Studio":
             self.build_requires("winflexbison/2.5.22")
         else:
-            self.build_requires("bison/3.5.3")
+            self.build_requires("bison/3.7.1")
         self.build_requires("automake/1.16.2")
 
     def requirements(self):
@@ -42,18 +42,22 @@
 
     @contextmanager
     def _build_context(self):
+        env = {}
+        if self.settings.compiler != "Visual Studio":
+            env["YACC"] = self.deps_user_info["bison"].YACC
         if self.settings.compiler == "Visual Studio":
             with tools.vcvars(self.settings):
-                env = {
+                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),
                     "LD": "link",
-                }
+                })
                 with tools.environment_append(env):
                     yield
         else:
-            yield
+            with tools.environment_append(env):
+                yield
 
     def _configure_autotools(self):
         if self._autotools:
@@ -73,15 +77,21 @@
             "--host={}".format(self.settings.arch),
             "--with-swiglibdir={}".format(self._swiglibdir),
         ]
+
+        host, build = None, None
+
         if self.settings.compiler == "Visual Studio":
             self.output.warn("Visual Studio compiler cannot create ccache-swig. Disabling ccache-swig.")
             args.append("--disable-ccache")
             self._autotools.flags.append("-FS")
+            # MSVC canonical names aren't understood
+            host, build = False, False
 
         self._autotools.libs = []
         self._autotools.library_paths = []
 
-        self._autotools.configure(args=args, configure_dir=self._source_subfolder)
+        self._autotools.configure(args=args, configure_dir=self._source_subfolder,
+                                  host=host, build=build)
         return self._autotools
 
     def _patch_sources(self):
@@ -105,7 +115,7 @@
 
         if self.settings.compiler != "Visual Studio":
             with tools.chdir(os.path.join(self.package_folder, "bin")):
-                strip = tools.get_env("STRIP") or tools.which("strip")
+                strip = (tools.get_env("STRIP") or tools.which("strip")).replace("\\", "/")
                 ext = ".exe" if tools.os_info.is_windows else ""
                 if strip:
                     self.run("{} swig{}".format(strip, ext), win_bash=tools.os_info.is_windows)

{"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@@ -27,10 +27,10 @@\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 tools.os_info.is_windows:\n+        if self.settings.compiler == \"Visual Studio\":\n             self.build_requires(\"winflexbison/2.5.22\")\n         else:\n-            self.build_requires(\"bison/3.5.3\")\n+            self.build_requires(\"bison/3.7.1\")\n         self.build_requires(\"automake/1.16.2\")\n \n     def requirements(self):\n@@ -42,18 +42,22 @@\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 = {\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+                })\n                 with tools.environment_append(env):\n                     yield\n         else:\n-            yield\n+            with tools.environment_append(env):\n+                yield\n \n     def _configure_autotools(self):\n         if self._autotools:\n@@ -73,15 +77,21 @@\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+        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@@ -105,7 +115,7 @@\n \n         if self.settings.compiler != \"Visual Studio\":\n             with tools.chdir(os.path.join(self.package_folder, \"bin\")):\n-                strip = tools.get_env(\"STRIP\") or tools.which(\"strip\")\n+                strip = (tools.get_env(\"STRIP\") or tools.which(\"strip\")).replace(\"\\\\\", \"/\")\n                 ext = \".exe\" if tools.os_info.is_windows else \"\"\n                 if strip:\n                     self.run(\"{} swig{}\".format(strip, ext), win_bash=tools.os_info.is_windows)\n", "issue": "[package] swig/4.0.1: wrong bison used in windows with MinGW\n<!-- \r\n  Please don't forget to update the issue title.\r\n  Include all applicable information to help us reproduce your problem.\r\n-->\r\n\r\n### Package and Environment Details\r\n  * Package Name/Version: **swig/4.0.1**\r\n  * Operating System+version: **Windows 10*\r\n  * Compiler+version: **GCC 8 (MinGW)**\r\n  * Conan version: **conan 1.27.1**\r\n  * Python version: **Python 3.7.4**\r\n\r\n\r\n### Conan profile\r\n```\r\n[settings]\r\nos=Windows\r\nos_build=Windows\r\narch=x86_64\r\narch_build=x86_64\r\ncompiler=gcc\r\ncompiler.version=8\r\nbuild_type=Release\r\ncompiler.exception=seh\r\ncompiler.libcxx=libstdc++11\r\ncompiler.threads=posix\r\n[options]\r\n[build_requires]\r\nmingw_installer/1.0@conan/stable\r\n[env]\r\n\r\n```\r\n\r\n### Steps to reproduce (Include if Applicable)\r\n\r\n`conan install -pr=mingw-w64 --build=missing swig/4.0.1@`\r\n\r\nBuild fails because swig tries to use winflexbison/2.5.22.\r\n\r\n\r\n### Logs from winflexbison\r\n```\r\n......\r\n-- Conan: Using cmake global configuration\r\n-- Conan: Adjusting default RPATHs Conan policies\r\n-- Conan: Adjusting language standard\r\n-- Conan setting CPP STANDARD: 14 WITH EXTENSIONS OFF\r\n-- Conan: Compiler GCC>=5, checking major version 8.1\r\n-- Conan: Checking correct version: 8.1\r\n-- Conan: C++ stdlib: libstdc++11\r\nCMake Error at source_subfolder/CMakeLists.txt:6 (message):\r\n  Visual Studio Build supported only\r\n```\r\n\r\nSee here:\r\nhttps://github.com/conan-io/conan-center-index/issues/1967\r\n\r\n### Root cause\r\n\r\nIn the conanfile.py of swig, the build requirements are wrong:\r\n\r\n```python\r\n    def build_requirements(self):\r\n        if tools.os_info.is_windows and not tools.get_env(\"CONAN_BASH_PATH\") \\\r\n                and tools.os_info.detect_windows_subsystem() != \"msys2\":\r\n            self.build_requires(\"msys2/20190524\")\r\n        if tools.os_info.is_windows: // Bad!\r\n            self.build_requires(\"winflexbison/2.5.22\")\r\n        else:\r\n            self.build_requires(\"bison/3.5.3\")\r\n        self.build_requires(\"automake/1.16.2\")\r\n```\r\n\r\n`winflexbison` only works with Visual Studio. So `bison` should be used instead.\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/**\"\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 tools.os_info.is_windows:\n            self.build_requires(\"winflexbison/2.5.22\")\n        else:\n            self.build_requires(\"bison/3.5.3\")\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        if self.settings.compiler == \"Visual Studio\":\n            with tools.vcvars(self.settings):\n                env = {\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            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        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\n        self._autotools.libs = []\n        self._autotools.library_paths = []\n\n        self._autotools.configure(args=args, configure_dir=self._source_subfolder)\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        with self._build_context():\n            autotools = self._configure_autotools()\n            autotools.install()\n\n        if self.settings.compiler != \"Visual Studio\":\n            with tools.chdir(os.path.join(self.package_folder, \"bin\")):\n                strip = tools.get_env(\"STRIP\") or tools.which(\"strip\")\n                ext = \".exe\" if tools.os_info.is_windows else \"\"\n                if strip:\n                    self.run(\"{} swig{}\".format(strip, ext), win_bash=tools.os_info.is_windows)\n                    self.run(\"{} ccache-swig{}\".format(strip, ext), win_bash=tools.os_info.is_windows)\n\n    @property\n    def _swiglibdir(self):\n        return os.path.join(self.package_folder, \"bin\", \"swiglib\").replace(\"\\\\\", \"/\")\n\n    def package_info(self):\n        # FIXME: Don't set cmake_find_package name because conan cmake generators do not define SWIG_EXECUTABLE\n        # self.cpp_info.names[\"cmake_find_package\"] = \"SWIG\"\n        # self.cpp_info.names[\"cmake_find_package_multi\"] = \"SWIG\"\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/**\"\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        with self._build_context():\n            autotools = self._configure_autotools()\n            autotools.install()\n\n        if self.settings.compiler != \"Visual Studio\":\n            with tools.chdir(os.path.join(self.package_folder, \"bin\")):\n                strip = (tools.get_env(\"STRIP\") or tools.which(\"strip\")).replace(\"\\\\\", \"/\")\n                ext = \".exe\" if tools.os_info.is_windows else \"\"\n                if strip:\n                    self.run(\"{} swig{}\".format(strip, ext), win_bash=tools.os_info.is_windows)\n                    self.run(\"{} ccache-swig{}\".format(strip, ext), win_bash=tools.os_info.is_windows)\n\n    @property\n    def _swiglibdir(self):\n        return os.path.join(self.package_folder, \"bin\", \"swiglib\").replace(\"\\\\\", \"/\")\n\n    def package_info(self):\n        # FIXME: Don't set cmake_find_package name because conan cmake generators do not define SWIG_EXECUTABLE\n        # self.cpp_info.names[\"cmake_find_package\"] = \"SWIG\"\n        # self.cpp_info.names[\"cmake_find_package_multi\"] = \"SWIG\"\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"}]}