We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[request] xz_utils/5.2.5
### Package Details
  * Package Name/Version: **xz_utils/5.2.5**
  * Changelog: **https://git.tukaani.org/?p=xz.git;a=blob;f=NEWS;hb=HEAD**


The above mentioned version is newly released by the upstream project and not yet available as a recipe. Please add this version.


--- 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/xz_utils/all/conanfile.py`
Content:
```
1 import os
2 from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild
3 from conans.tools import Version
4 
5 
6 class XZUtils(ConanFile):
7     name = "xz_utils"
8     description = "XZ Utils is free general-purpose data compression software with a high compression ratio. XZ Utils were written" \
9                   " for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils."
10     url = "https://github.com/conan-io/conan-center-index"
11     homepage = "https://tukaani.org/xz"
12     license = "Public Domain, GNU LGPLv2.1, GNU GPLv2, or GNU GPLv3"
13 
14     settings = "os", "arch", "compiler", "build_type"
15     options = {"shared": [True, False], "fPIC": [True, False]}
16     default_options = {"shared": False, "fPIC": True}
17 
18     @property
19     def _source_subfolder(self):
20         return "source_subfolder"
21 
22     @property
23     def _use_winbash(self):
24         return tools.os_info.is_windows
25 
26     def build_requirements(self):
27         if self._use_winbash and "CONAN_BASH_PATH" not in os.environ and \
28                 tools.os_info.detect_windows_subsystem() != "msys2":
29             self.build_requires("msys2/20190524")
30 
31     def _effective_msbuild_type(self):
32         # treat "RelWithDebInfo" and "MinSizeRel" as "Release"
33         return "Debug" if self.settings.build_type == "Debug" else "Release"
34 
35     def config_options(self):
36         if self.settings.os == "Windows":
37             del self.options.fPIC
38 
39     def configure(self):
40         del self.settings.compiler.cppstd
41         del self.settings.compiler.libcxx
42 
43     def _apply_patches(self):
44         # Relax Windows SDK restriction
45         tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma.vcxproj"),
46                               "<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>",
47                               "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>")
48 
49         tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma_dll.vcxproj"),
50                               "<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>",
51                               "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>")
52 
53     def source(self):
54         tools.get(**self.conan_data["sources"][self.version])
55         os.rename("xz-" + self.version, self._source_subfolder)
56         self._apply_patches()
57 
58     def _build_msvc(self):
59         # windows\INSTALL-MSVC.txt
60 
61         if self.settings.compiler.version == 15:
62             # emulate VS2019+ meaning of WindowsTargetPlatformVersion == "10.0"
63             # undocumented method, but officially recommended workaround by microsoft at at
64             # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html
65             tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma.vcxproj"),
66                                   "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>",
67                                   "<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>")
68 
69             tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma_dll.vcxproj"),
70                                   "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>",
71                                   "<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>")
72 
73         msvc_version = "vs2017" if Version(self.settings.compiler.version) >= "15" else "vs2013"
74         with tools.chdir(os.path.join(self._source_subfolder, "windows", msvc_version)):
75             target = "liblzma_dll" if self.options.shared else "liblzma"
76             msbuild = MSBuild(self)
77             msbuild.build(
78                 "xz_win.sln",
79                 targets=[target],
80                 build_type=self._effective_msbuild_type(),
81                 platforms={"x86": "Win32", "x86_64": "x64"},
82                 use_env=False,
83                 upgrade_project=False)
84 
85     def _build_configure(self):
86         with tools.chdir(self._source_subfolder):
87             args = []
88             env_build = AutoToolsBuildEnvironment(self, win_bash=self._use_winbash)
89             args = ["--disable-doc"]
90             if self.settings.os != "Windows" and self.options.fPIC:
91                 args.append("--with-pic")
92             if self.options.shared:
93                 args.extend(["--disable-static", "--enable-shared"])
94             else:
95                 args.extend(["--enable-static", "--disable-shared"])
96             if self.settings.build_type == "Debug":
97                 args.append("--enable-debug")
98             env_build.configure(args=args, build=False)
99             env_build.make()
100             env_build.install()
101 
102     def build(self):
103         if self.settings.compiler == "Visual Studio":
104             self._build_msvc()
105         else:
106             self._build_configure()
107 
108     def package(self):
109         self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder)
110         if self.settings.compiler == "Visual Studio":
111             inc_dir = os.path.join(self._source_subfolder, "src", "liblzma", "api")
112             self.copy(pattern="*.h", dst="include", src=inc_dir, keep_path=True)
113             arch = {"x86": "Win32", "x86_64": "x64"}.get(str(self.settings.arch))
114             target = "liblzma_dll" if self.options.shared else "liblzma"
115             msvc_version = "vs2017" if Version(self.settings.compiler.version) >= "15" else "vs2013"
116             bin_dir = os.path.join(self._source_subfolder, "windows", msvc_version,
117                                    str(self._effective_msbuild_type()), arch, target)
118             self.copy(pattern="*.lib", dst="lib", src=bin_dir, keep_path=False)
119             if self.options.shared:
120                 self.copy(pattern="*.dll", dst="bin", src=bin_dir, keep_path=False)
121             os.rename(os.path.join(self.package_folder, "lib", "liblzma.lib"),
122                       os.path.join(self.package_folder, "lib", "lzma.lib"))
123 
124         # Remove/rename forbidden files/folders in central repository
125         tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
126         tools.rmdir(os.path.join(self.package_folder, "share"))
127         try:
128             os.remove(os.path.join(self.package_folder, "lib", "liblzma.la"))
129         except:
130             pass
131 
132     def package_info(self):
133         if not self.options.shared:
134             self.cpp_info.defines.append("LZMA_API_STATIC")
135         if self.settings.os == "Linux":
136             self.cpp_info.system_libs.append("pthread")
137         self.cpp_info.libs = tools.collect_libs(self)
138         self.cpp_info.names["pkg_config"] = "liblzma"
139         self.cpp_info.names["cmake_find_package"] = "LibLZMA"
140         self.cpp_info.names["cmake_find_package_multi"] = "LibLZMA"
141
```
--- 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/xz_utils/all/conanfile.py b/recipes/xz_utils/all/conanfile.py
--- a/recipes/xz_utils/all/conanfile.py
+++ b/recipes/xz_utils/all/conanfile.py
@@ -9,6 +9,7 @@
                   " for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils."
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://tukaani.org/xz"
+    topics = ("conan", "lzma", "xz", "compression")
     license = "Public Domain, GNU LGPLv2.1, GNU GPLv2, or GNU GPLv3"
 
     settings = "os", "arch", "compiler", "build_type"
@@ -26,7 +27,7 @@
     def build_requirements(self):
         if self._use_winbash and "CONAN_BASH_PATH" not in os.environ and \
                 tools.os_info.detect_windows_subsystem() != "msys2":
-            self.build_requires("msys2/20190524")
+            self.build_requires("msys2/20200517")
 
     def _effective_msbuild_type(self):
         # treat "RelWithDebInfo" and "MinSizeRel" as "Release"
@@ -41,14 +42,15 @@
         del self.settings.compiler.libcxx
 
     def _apply_patches(self):
-        # Relax Windows SDK restriction
-        tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma.vcxproj"),
-                              "<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>",
-                              "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>")
+        if tools.Version(self.version) == "5.2.4":
+            # Relax Windows SDK restriction
+            tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma.vcxproj"),
+                                  "<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>",
+                                  "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>")
 
-        tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma_dll.vcxproj"),
-                              "<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>",
-                              "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>")
+            tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma_dll.vcxproj"),
+                                  "<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>",
+                                  "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>")
 
     def source(self):
         tools.get(**self.conan_data["sources"][self.version])
@@ -58,7 +60,9 @@
     def _build_msvc(self):
         # windows\INSTALL-MSVC.txt
 
-        if self.settings.compiler.version == 15:
+        if self.settings.compiler.version == 15 and tools.Version(self.version) == "5.2.4":
+            # Workaround is required only for 5.2.4 because since 5.2.5 WindowsTargetPlatformVersion is dropped from vcproj file
+            #
             # emulate VS2019+ meaning of WindowsTargetPlatformVersion == "10.0"
             # undocumented method, but officially recommended workaround by microsoft at at
             # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html

{"golden_diff": "diff --git a/recipes/xz_utils/all/conanfile.py b/recipes/xz_utils/all/conanfile.py\n--- a/recipes/xz_utils/all/conanfile.py\n+++ b/recipes/xz_utils/all/conanfile.py\n@@ -9,6 +9,7 @@\n                   \" for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils.\"\n     url = \"https://github.com/conan-io/conan-center-index\"\n     homepage = \"https://tukaani.org/xz\"\n+    topics = (\"conan\", \"lzma\", \"xz\", \"compression\")\n     license = \"Public Domain, GNU LGPLv2.1, GNU GPLv2, or GNU GPLv3\"\n \n     settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n@@ -26,7 +27,7 @@\n     def build_requirements(self):\n         if self._use_winbash and \"CONAN_BASH_PATH\" not in os.environ and \\\n                 tools.os_info.detect_windows_subsystem() != \"msys2\":\n-            self.build_requires(\"msys2/20190524\")\n+            self.build_requires(\"msys2/20200517\")\n \n     def _effective_msbuild_type(self):\n         # treat \"RelWithDebInfo\" and \"MinSizeRel\" as \"Release\"\n@@ -41,14 +42,15 @@\n         del self.settings.compiler.libcxx\n \n     def _apply_patches(self):\n-        # Relax Windows SDK restriction\n-        tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma.vcxproj\"),\n-                              \"<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>\",\n-                              \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\")\n+        if tools.Version(self.version) == \"5.2.4\":\n+            # Relax Windows SDK restriction\n+            tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma.vcxproj\"),\n+                                  \"<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>\",\n+                                  \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\")\n \n-        tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma_dll.vcxproj\"),\n-                              \"<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>\",\n-                              \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\")\n+            tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma_dll.vcxproj\"),\n+                                  \"<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>\",\n+                                  \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\")\n \n     def source(self):\n         tools.get(**self.conan_data[\"sources\"][self.version])\n@@ -58,7 +60,9 @@\n     def _build_msvc(self):\n         # windows\\INSTALL-MSVC.txt\n \n-        if self.settings.compiler.version == 15:\n+        if self.settings.compiler.version == 15 and tools.Version(self.version) == \"5.2.4\":\n+            # Workaround is required only for 5.2.4 because since 5.2.5 WindowsTargetPlatformVersion is dropped from vcproj file\n+            #\n             # emulate VS2019+ meaning of WindowsTargetPlatformVersion == \"10.0\"\n             # undocumented method, but officially recommended workaround by microsoft at at\n             # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html\n", "issue": "[request] xz_utils/5.2.5\n### Package Details\r\n  * Package Name/Version: **xz_utils/5.2.5**\r\n  * Changelog: **https://git.tukaani.org/?p=xz.git;a=blob;f=NEWS;hb=HEAD**\r\n\r\n\r\nThe above mentioned version is newly released by the upstream project and not yet available as a recipe. Please add this version.\r\n\n", "before_files": [{"content": "import os\nfrom conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild\nfrom conans.tools import Version\n\n\nclass XZUtils(ConanFile):\n    name = \"xz_utils\"\n    description = \"XZ Utils is free general-purpose data compression software with a high compression ratio. XZ Utils were written\" \\\n                  \" for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils.\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    homepage = \"https://tukaani.org/xz\"\n    license = \"Public Domain, GNU LGPLv2.1, GNU GPLv2, or GNU GPLv3\"\n\n    settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n    options = {\"shared\": [True, False], \"fPIC\": [True, False]}\n    default_options = {\"shared\": False, \"fPIC\": True}\n\n    @property\n    def _source_subfolder(self):\n        return \"source_subfolder\"\n\n    @property\n    def _use_winbash(self):\n        return tools.os_info.is_windows\n\n    def build_requirements(self):\n        if self._use_winbash and \"CONAN_BASH_PATH\" not in os.environ and \\\n                tools.os_info.detect_windows_subsystem() != \"msys2\":\n            self.build_requires(\"msys2/20190524\")\n\n    def _effective_msbuild_type(self):\n        # treat \"RelWithDebInfo\" and \"MinSizeRel\" as \"Release\"\n        return \"Debug\" if self.settings.build_type == \"Debug\" else \"Release\"\n\n    def config_options(self):\n        if self.settings.os == \"Windows\":\n            del self.options.fPIC\n\n    def configure(self):\n        del self.settings.compiler.cppstd\n        del self.settings.compiler.libcxx\n\n    def _apply_patches(self):\n        # Relax Windows SDK restriction\n        tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma.vcxproj\"),\n                              \"<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>\",\n                              \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\")\n\n        tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma_dll.vcxproj\"),\n                              \"<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>\",\n                              \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\")\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version])\n        os.rename(\"xz-\" + self.version, self._source_subfolder)\n        self._apply_patches()\n\n    def _build_msvc(self):\n        # windows\\INSTALL-MSVC.txt\n\n        if self.settings.compiler.version == 15:\n            # emulate VS2019+ meaning of WindowsTargetPlatformVersion == \"10.0\"\n            # undocumented method, but officially recommended workaround by microsoft at at\n            # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma.vcxproj\"),\n                                  \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\",\n                                  \"<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>\")\n\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma_dll.vcxproj\"),\n                                  \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\",\n                                  \"<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>\")\n\n        msvc_version = \"vs2017\" if Version(self.settings.compiler.version) >= \"15\" else \"vs2013\"\n        with tools.chdir(os.path.join(self._source_subfolder, \"windows\", msvc_version)):\n            target = \"liblzma_dll\" if self.options.shared else \"liblzma\"\n            msbuild = MSBuild(self)\n            msbuild.build(\n                \"xz_win.sln\",\n                targets=[target],\n                build_type=self._effective_msbuild_type(),\n                platforms={\"x86\": \"Win32\", \"x86_64\": \"x64\"},\n                use_env=False,\n                upgrade_project=False)\n\n    def _build_configure(self):\n        with tools.chdir(self._source_subfolder):\n            args = []\n            env_build = AutoToolsBuildEnvironment(self, win_bash=self._use_winbash)\n            args = [\"--disable-doc\"]\n            if self.settings.os != \"Windows\" and self.options.fPIC:\n                args.append(\"--with-pic\")\n            if self.options.shared:\n                args.extend([\"--disable-static\", \"--enable-shared\"])\n            else:\n                args.extend([\"--enable-static\", \"--disable-shared\"])\n            if self.settings.build_type == \"Debug\":\n                args.append(\"--enable-debug\")\n            env_build.configure(args=args, build=False)\n            env_build.make()\n            env_build.install()\n\n    def build(self):\n        if self.settings.compiler == \"Visual Studio\":\n            self._build_msvc()\n        else:\n            self._build_configure()\n\n    def package(self):\n        self.copy(pattern=\"COPYING\", dst=\"licenses\", src=self._source_subfolder)\n        if self.settings.compiler == \"Visual Studio\":\n            inc_dir = os.path.join(self._source_subfolder, \"src\", \"liblzma\", \"api\")\n            self.copy(pattern=\"*.h\", dst=\"include\", src=inc_dir, keep_path=True)\n            arch = {\"x86\": \"Win32\", \"x86_64\": \"x64\"}.get(str(self.settings.arch))\n            target = \"liblzma_dll\" if self.options.shared else \"liblzma\"\n            msvc_version = \"vs2017\" if Version(self.settings.compiler.version) >= \"15\" else \"vs2013\"\n            bin_dir = os.path.join(self._source_subfolder, \"windows\", msvc_version,\n                                   str(self._effective_msbuild_type()), arch, target)\n            self.copy(pattern=\"*.lib\", dst=\"lib\", src=bin_dir, keep_path=False)\n            if self.options.shared:\n                self.copy(pattern=\"*.dll\", dst=\"bin\", src=bin_dir, keep_path=False)\n            os.rename(os.path.join(self.package_folder, \"lib\", \"liblzma.lib\"),\n                      os.path.join(self.package_folder, \"lib\", \"lzma.lib\"))\n\n        # Remove/rename forbidden files/folders in central repository\n        tools.rmdir(os.path.join(self.package_folder, \"lib\", \"pkgconfig\"))\n        tools.rmdir(os.path.join(self.package_folder, \"share\"))\n        try:\n            os.remove(os.path.join(self.package_folder, \"lib\", \"liblzma.la\"))\n        except:\n            pass\n\n    def package_info(self):\n        if not self.options.shared:\n            self.cpp_info.defines.append(\"LZMA_API_STATIC\")\n        if self.settings.os == \"Linux\":\n            self.cpp_info.system_libs.append(\"pthread\")\n        self.cpp_info.libs = tools.collect_libs(self)\n        self.cpp_info.names[\"pkg_config\"] = \"liblzma\"\n        self.cpp_info.names[\"cmake_find_package\"] = \"LibLZMA\"\n        self.cpp_info.names[\"cmake_find_package_multi\"] = \"LibLZMA\"\n", "path": "recipes/xz_utils/all/conanfile.py"}], "after_files": [{"content": "import os\nfrom conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild\nfrom conans.tools import Version\n\n\nclass XZUtils(ConanFile):\n    name = \"xz_utils\"\n    description = \"XZ Utils is free general-purpose data compression software with a high compression ratio. XZ Utils were written\" \\\n                  \" for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils.\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    homepage = \"https://tukaani.org/xz\"\n    topics = (\"conan\", \"lzma\", \"xz\", \"compression\")\n    license = \"Public Domain, GNU LGPLv2.1, GNU GPLv2, or GNU GPLv3\"\n\n    settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n    options = {\"shared\": [True, False], \"fPIC\": [True, False]}\n    default_options = {\"shared\": False, \"fPIC\": True}\n\n    @property\n    def _source_subfolder(self):\n        return \"source_subfolder\"\n\n    @property\n    def _use_winbash(self):\n        return tools.os_info.is_windows\n\n    def build_requirements(self):\n        if self._use_winbash and \"CONAN_BASH_PATH\" not in os.environ and \\\n                tools.os_info.detect_windows_subsystem() != \"msys2\":\n            self.build_requires(\"msys2/20200517\")\n\n    def _effective_msbuild_type(self):\n        # treat \"RelWithDebInfo\" and \"MinSizeRel\" as \"Release\"\n        return \"Debug\" if self.settings.build_type == \"Debug\" else \"Release\"\n\n    def config_options(self):\n        if self.settings.os == \"Windows\":\n            del self.options.fPIC\n\n    def configure(self):\n        del self.settings.compiler.cppstd\n        del self.settings.compiler.libcxx\n\n    def _apply_patches(self):\n        if tools.Version(self.version) == \"5.2.4\":\n            # Relax Windows SDK restriction\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma.vcxproj\"),\n                                  \"<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>\",\n                                  \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\")\n\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma_dll.vcxproj\"),\n                                  \"<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>\",\n                                  \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\")\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version])\n        os.rename(\"xz-\" + self.version, self._source_subfolder)\n        self._apply_patches()\n\n    def _build_msvc(self):\n        # windows\\INSTALL-MSVC.txt\n\n        if self.settings.compiler.version == 15 and tools.Version(self.version) == \"5.2.4\":\n            # Workaround is required only for 5.2.4 because since 5.2.5 WindowsTargetPlatformVersion is dropped from vcproj file\n            #\n            # emulate VS2019+ meaning of WindowsTargetPlatformVersion == \"10.0\"\n            # undocumented method, but officially recommended workaround by microsoft at at\n            # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma.vcxproj\"),\n                                  \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\",\n                                  \"<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>\")\n\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"windows\", \"vs2017\", \"liblzma_dll.vcxproj\"),\n                                  \"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\",\n                                  \"<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>\")\n\n        msvc_version = \"vs2017\" if Version(self.settings.compiler.version) >= \"15\" else \"vs2013\"\n        with tools.chdir(os.path.join(self._source_subfolder, \"windows\", msvc_version)):\n            target = \"liblzma_dll\" if self.options.shared else \"liblzma\"\n            msbuild = MSBuild(self)\n            msbuild.build(\n                \"xz_win.sln\",\n                targets=[target],\n                build_type=self._effective_msbuild_type(),\n                platforms={\"x86\": \"Win32\", \"x86_64\": \"x64\"},\n                use_env=False,\n                upgrade_project=False)\n\n    def _build_configure(self):\n        with tools.chdir(self._source_subfolder):\n            args = []\n            env_build = AutoToolsBuildEnvironment(self, win_bash=self._use_winbash)\n            args = [\"--disable-doc\"]\n            if self.settings.os != \"Windows\" and self.options.fPIC:\n                args.append(\"--with-pic\")\n            if self.options.shared:\n                args.extend([\"--disable-static\", \"--enable-shared\"])\n            else:\n                args.extend([\"--enable-static\", \"--disable-shared\"])\n            if self.settings.build_type == \"Debug\":\n                args.append(\"--enable-debug\")\n            env_build.configure(args=args, build=False)\n            env_build.make()\n            env_build.install()\n\n    def build(self):\n        if self.settings.compiler == \"Visual Studio\":\n            self._build_msvc()\n        else:\n            self._build_configure()\n\n    def package(self):\n        self.copy(pattern=\"COPYING\", dst=\"licenses\", src=self._source_subfolder)\n        if self.settings.compiler == \"Visual Studio\":\n            inc_dir = os.path.join(self._source_subfolder, \"src\", \"liblzma\", \"api\")\n            self.copy(pattern=\"*.h\", dst=\"include\", src=inc_dir, keep_path=True)\n            arch = {\"x86\": \"Win32\", \"x86_64\": \"x64\"}.get(str(self.settings.arch))\n            target = \"liblzma_dll\" if self.options.shared else \"liblzma\"\n            msvc_version = \"vs2017\" if Version(self.settings.compiler.version) >= \"15\" else \"vs2013\"\n            bin_dir = os.path.join(self._source_subfolder, \"windows\", msvc_version,\n                                   str(self._effective_msbuild_type()), arch, target)\n            self.copy(pattern=\"*.lib\", dst=\"lib\", src=bin_dir, keep_path=False)\n            if self.options.shared:\n                self.copy(pattern=\"*.dll\", dst=\"bin\", src=bin_dir, keep_path=False)\n            os.rename(os.path.join(self.package_folder, \"lib\", \"liblzma.lib\"),\n                      os.path.join(self.package_folder, \"lib\", \"lzma.lib\"))\n\n        # Remove/rename forbidden files/folders in central repository\n        tools.rmdir(os.path.join(self.package_folder, \"lib\", \"pkgconfig\"))\n        tools.rmdir(os.path.join(self.package_folder, \"share\"))\n        try:\n            os.remove(os.path.join(self.package_folder, \"lib\", \"liblzma.la\"))\n        except:\n            pass\n\n    def package_info(self):\n        if not self.options.shared:\n            self.cpp_info.defines.append(\"LZMA_API_STATIC\")\n        if self.settings.os == \"Linux\":\n            self.cpp_info.system_libs.append(\"pthread\")\n        self.cpp_info.libs = tools.collect_libs(self)\n        self.cpp_info.names[\"pkg_config\"] = \"liblzma\"\n        self.cpp_info.names[\"cmake_find_package\"] = \"LibLZMA\"\n        self.cpp_info.names[\"cmake_find_package_multi\"] = \"LibLZMA\"\n", "path": "recipes/xz_utils/all/conanfile.py"}]}