11from conan import ConanFile
22from conan .errors import ConanInvalidConfiguration
3- from conan .tools .files import copy , chdir , download , get , replace_in_file
3+ from conan .tools .files import copy , chdir , get , replace_in_file
44from conan .tools .gnu import Autotools , AutotoolsDeps , AutotoolsToolchain
55from conan .tools .layout import basic_layout
66from conan .tools .microsoft import is_msvc , NMakeToolchain
77from conan .tools .scm import Version
88
99import os
1010
11- required_conan_version = ">=1.55.0 "
11+ required_conan_version = ">=2 "
1212
1313
1414class SevenZipConan (ConanFile ):
@@ -21,10 +21,6 @@ class SevenZipConan(ConanFile):
2121 package_type = "application"
2222 settings = "os" , "arch" , "compiler" , "build_type"
2323
24- @property
25- def _settings_build (self ):
26- return getattr (self , "settings_build" , self .settings )
27-
2824 def validate (self ):
2925 if self .settings .os != "Windows" :
3026 raise ConanInvalidConfiguration ("Only Windows supported" )
@@ -35,26 +31,15 @@ def layout(self):
3531 basic_layout (self , src_folder = "src" )
3632
3733 def build_requirements (self ):
38- if Version (self .version ) < "22" :
39- self .build_requires ("lzma_sdk/9.20" )
40-
41- if not is_msvc (self ) and self ._settings_build .os == "Windows" and "make" not in os .environ .get ("CONAN_MAKE_PROGRAM" , "" ):
34+ if not is_msvc (self ) and self .settings_build .os == "Windows" and "make" not in os .environ .get ("CONAN_MAKE_PROGRAM" , "" ):
4235 self .build_requires ("make/4.3" )
4336
4437 def package_id (self ):
4538 del self .info .settings .build_type
4639 del self .info .settings .compiler
4740
4841 def source (self ):
49- if Version (self .version ) < "22" :
50- item = self .conan_data ["sources" ][self .version ]
51- filename = "7z-source.7z"
52- download (self , ** item , filename = filename )
53- sevenzip = os .path .join (self .dependencies .build ["lzma_sdk" ].package_folder , "bin" , "7zr.exe" )
54- self .run (f"{ sevenzip } x { filename } " )
55- os .unlink (filename )
56- else :
57- get (self , ** self .conan_data ["sources" ][self .version ])
42+ get (self , ** self .conan_data ["sources" ][self .version ])
5843
5944 def generate (self ):
6045 if is_msvc (self ):
@@ -115,9 +100,5 @@ def package(self):
115100 # TODO: Package the libraries: binaries and headers (add the rest of settings)
116101
117102 def package_info (self ):
118- bin_path = os .path .join (self .package_folder , "bin" )
119- self .output .info (f"Appending PATH environment variable: { bin_path } " )
120- self .env_info .path .append (bin_path )
121-
122103 self .cpp_info .includedirs = []
123104 self .cpp_info .libdirs = []
0 commit comments