def short_paths_unzip_output_test(self): if platform.system() != "Windows": return tmp_dir = temp_folder() file_path = os.path.join(tmp_dir, "src/"*40, "example.txt") save(file_path, "Hello world!") zip_path = os.path.join(tmp_dir, 'example.zip') zipf = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) for root, _, files in os.walk(tmp_dir): for f in files: zipf.write(os.path.join(root, f), os.path.join("src/"*20, f)) zipf.close() output_dir = os.path.join(tmp_dir, "dst/"*40, "output_dir") new_out = StringIO() old_out = sys.stdout try: import conans conans.tools.set_global_instances(ConanOutput(new_out), None) tools.unzip(zip_path, output_dir) finally: conans.tools.set_global_instances(ConanOutput(old_out), None) output = new_out.getvalue() self.assertIn("ERROR: Error extract src/src", output)
def unzip_output_test(self): tmp_dir = temp_folder() file_path = os.path.join(tmp_dir, "example.txt") save(file_path, "Hello world!") zip_path = os.path.join(tmp_dir, 'example.zip') zipf = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) for root, _, files in os.walk(tmp_dir): for f in files: zipf.write(os.path.join(root, f), f) zipf.close() output_dir = os.path.join(tmp_dir, "output_dir") new_out = StringIO() old_out = sys.stdout try: import requests import conans conans.tools.set_global_instances(ConanOutput(new_out), requests) tools.unzip(zip_path, output_dir) finally: conans.tools.set_global_instances(ConanOutput(old_out), requests) output = new_out.getvalue() self.assertRegexpMatches(output, "Unzipping [\d]+B") content = load(os.path.join(output_dir, "example.txt")) self.assertEqual(content, "Hello world!")
def source(self): zip_name = self.version + ".zip" download( "https://github.com/DavidAce/h5pp/archive/v" + self.version + ".zip", zip_name) unzip(zip_name)
def source(self): zip_name = "log4cpp-%s.zip" % self.version url = "https://github.com/orocos-toolchain/log4cpp/archive/master.zip" download(url, zip_name) unzip(zip_name) os.system("cp -R log4cpp-%s/* ." % self.version) # hack to build as dependency os.unlink(zip_name)
def source(self): zip_name = "%s.zip" % self.FOLDER_NAME if sys.platform == "win32" else "%s.tar.gz" % self.FOLDER_NAME url = "http://sourceforge.net/projects/boost/files/boost/%s/%s/download" % (self.version, zip_name) self.output.info("Downloading %s..." % url) tools.download(url, zip_name) tools.unzip(zip_name, ".") os.unlink(zip_name)
def source(self): zip_name = "%s.zip" % self.version download("%s/archive/%s" % (self.url, zip_name), zip_name, verify=False) unzip(zip_name) os.unlink(zip_name)
def unzip_fix_symlinks(url, target_folder, sha256): # Python's built-in module 'zipfile' won't handle symlinks (https://bugs.python.org/issue37921) # Most of the logic borrowed from this PR https://github.com/conan-io/conan/pull/8100 filename = "android_sdk.zip" tools.download(url, filename, sha256=sha256) tools.unzip(filename, destination=target_folder, strip_root=True) def is_symlink_zipinfo(zi): return (zi.external_attr >> 28) == 0xA full_path = os.path.normpath(target_folder) import zipfile with zipfile.ZipFile(filename, "r") as z: zip_info = z.infolist() names = [n.replace("\\", "/") for n in z.namelist()] common_folder = os.path.commonprefix(names).split("/", 1)[0] for file_ in zip_info: if is_symlink_zipinfo(file_): rel_path = os.path.relpath(file_.filename, common_folder) full_name = os.path.join(full_path, rel_path) target = tools.load(full_name) os.unlink(full_name) try: os.symlink(target, full_name) except OSError: if not os.path.isabs(target): target = os.path.normpath( os.path.join(os.path.dirname(full_name), target)) shutil.copy2(target, full_name) os.unlink(filename)
def source(self): archive = "{}.tar.gz".format(self.lua_dir) tools.download("https://www.lua.org/ftp/lua-5.2.3.tar.gz", archive) tools.unzip(archive, ".") os.remove(archive) shutil.copy("CMakeLists.txt", os.path.join(self.lua_dir, "CMakeLists.txt"))
def source(self): self.setup_vars() if self.settings.os == "Windows": tools.download( "https://storage.googleapis.com/chrome-infra/depot_tools.zip", "depot_tools.zip") tools.unzip("depot_tools.zip", destination="depot_tools") else: git_depot_tools = tools.Git(folder="depot_tools") git_depot_tools.clone( "https://chromium.googlesource.com/chromium/tools/depot_tools.git", "main") with tools.environment_append({ "PATH": [self._depot_tools_dir], "DEPOT_TOOLS_WIN_TOOLCHAIN": "0" }): self.run("gclient") if self.settings.os == "iOS": self.run("fetch --nohooks webrtc_ios") else: self.run("fetch --nohooks webrtc") with tools.chdir('src'): self.run("git checkout -b %s branch-heads/%s" % (self.version, self._branchHead)) self.run("gclient sync -D") self._patch_runtime()
def source(self): download_url = "https://app.assembla.com/spaces/portaudio/git/source/b7870b08f770c1e84b754e662c08b6942ff7d021?_format=zip" zipped_folder_name = "root.zip" tools.download(download_url, zipped_folder_name) tools.unzip(zipped_folder_name, self.name) os.remove(zipped_folder_name)
def source(self): zip_name = "%s-%s.zip" % (self.name, self.version) url = "https://github.com/syncro/%s/archive/master.zip" % self.name download(url, zip_name) unzip(zip_name) os.system("cp -R %s-%s/* ." % (self.name, self.version)) # hack to build as dependency os.unlink(zip_name)
def source(self): zip_name = "tclap-%s.tar.gz" % self.version download("http://downloads.sourceforge.net/project/tclap/" + zip_name + "?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Ftclap%2Ffiles%2F&ts=1466246416&use_mirror=tenet", zip_name) unzip(zip_name) # strip version from folder name so it does not have to be used later shutil.move("tclap-%s" % self.version, "tclap") os.unlink(zip_name)
def source(self): zip_name = "zlib-1.2.8.zip" download("http://zlib.net/zlib128.zip", zip_name) unzip(zip_name) os.unlink(zip_name) if self.settings.os != "Windows": self.run("chmod +x ./%s/configure" % self.ZIP_FOLDER_NAME)
def source(self): zip_name = "WpdPack_4_1_2.zip" download("https://www.winpcap.org/install/bin/%s" % zip_name, zip_name) check_sha1(zip_name, "f5c80885bd48f07f41833d0f65bf85da1ef1727a") unzip(zip_name) os.unlink(zip_name)
def unzip_output_test(self): tmp_dir = temp_folder() file_path = os.path.join(tmp_dir, "example.txt") save(file_path, "Hello world!") zip_path = os.path.join(tmp_dir, 'example.zip') zipf = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) for root, _, files in os.walk(tmp_dir): for f in files: zipf.write(os.path.join(root, f), f) zipf.close() output_dir = os.path.join(tmp_dir, "output_dir") new_out = StringIO() old_out = sys.stdout try: sys.stdout = new_out tools.unzip(zip_path, output_dir) finally: sys.stdout = old_out output = new_out.getvalue() self.assertRegexpMatches(output, "Unzipping [\d]+ bytes, this can take a while") content = load(os.path.join(output_dir, "example.txt")) self.assertEqual(content, "Hello world!")
def source(self): zip_name = "%s.zip" % self.folder download("https://www.libsdl.org/release/SDL2-%s.zip" % self.version, zip_name) unzip(zip_name) shutil.move("%s/CMakeLists.txt" % self.folder, "%s/CMakeListsOriginal.cmake" % self.folder) shutil.move("CMakeLists.txt", "%s/CMakeLists.txt" % self.folder)
def source(self): zip_name = "bzip2-%s.tar.gz" % self.version # url = "http://www.bzip.org/%s/%s" % (self.version, zip_name) url = "https://bintray.com/conan/Sources/download_file?file_path=%s" % zip_name tools.download(url, zip_name) tools.check_md5(zip_name, "00b516f4704d4a7cb50a1d97e6e8e15b") tools.unzip(zip_name) os.unlink(zip_name)
def source(self): zip_name = "rtmidi-%s.tar.gz" % self.version # this will create a hello subfolder, take it into account download("http://www.music.mcgill.ca/~gary/rtmidi/release/%s" % zip_name, zip_name) unzip(zip_name) # strip version from folder name so it does not have to be used later shutil.move("rtmidi-%s" % self.version, "rtmidi") os.unlink(zip_name)
def source(self): zipfile_name = "nonius-{0}.zip" release_url = "https://github.com/libnonius/nonius/releases/download/v{0}/nonius-{0}.zip".format(self.version) sha256 = "44de210fb8de9fd7c72e47c141b0322f904e8636451263e5ed1d1bbd4f3c17e1" download(release_url, zipfile_name) check_sha256(zipfile_name, sha256) unzip(zipfile_name) unlink(zipfile_name)
def source(self): zip_name = "curl-%s.tar.gz" % self.version download("https://curl.haxx.se/download/%s" % zip_name, zip_name, verify=False) unzip(zip_name) os.unlink(zip_name) download("https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=False) if self.settings.os != "Windows": self.run("chmod +x ./%s/configure" % self.ZIP_FOLDER_NAME)
def source(self): zipname = 'cryptopp565.zip' url = 'http://cryptopp.com/%s' % zipname sha256 = 'a75ef486fe3128008bbb201efee3dcdcffbe791120952910883b26337ec32c34' tools.download(url, zipname) tools.check_sha256(zipname, sha256) tools.unzip(zipname) os.unlink(zipname)
def source(self): # you can download from the url, but it may be too slow # url = "https://github.com/redis/hiredis/archive/%s" % self.zip_name # download(url, self.zip_name) # you can also copy from local path, but make sure the zip file is there self.run("cp /data/software/%s ." % self.zip_name) unzip(self.zip_name) os.unlink(self.zip_name)
def source(self): zip_name = "python2.7.13-release.zip" download("https://github.com/python/cpython/archive/v2.7.13.zip", zip_name) check_md5(zip_name, "c31795e30d95b082627aaa9368fe65fc") unzip(zip_name) shutil.move("cpython-2.7.13", self.name) os.unlink(zip_name)
def source(self): zip_name = "poco-%s-release.zip" % self.version download("https://github.com/pocoproject/poco/archive/%s" % zip_name, zip_name) unzip(zip_name) shutil.move("poco-poco-%s-release" % self.version, "poco") os.unlink(zip_name) shutil.move("poco/CMakeLists.txt", "poco/CMakeListsOriginal.cmake") shutil.move("CMakeLists.txt", "poco/CMakeLists.txt")
def source(self): folder_name = "dcmtk%s" % self.version.replace(".", "") archive_name = "DCMTK-%s.tar.gz" % self.version download("https://github.com/DCMTK/dcmtk/archive/%s" % archive_name, archive_name) unzip(archive_name) extraced_folder = "dcmtk-DCMTK-%s" % self.version shutil.move(extraced_folder, "src")
def _source_windows(self): name_part = 'Tableau-SDK-C-Java-64Bit-10-1-1' zip_name = 'tableausdk.zip' download_url = "https://downloads.tableau.com/tssoftware/{}.zip".format( name_part) tools.download(download_url, zip_name) tools.unzip(zip_name, 'tableausdk') os.unlink(zip_name)
def source(self): url = "http://sourceforge.net/projects/libjson/files/%s/download" % ( self.zip_name) self.output.info("Downloading %s..." % url) tools.download(url, self.zip_name) tools.unzip(self.zip_name) os.unlink(self.zip_name)
def source(self): tar_file = "mysql-connector-c-%s-src.tar.gz" % self.version download("http://dev.mysql.com/get/Downloads/Connector-C/%s" % tar_file, tar_file) unzip(tar_file) shutil.move("mysql-connector-c-%s-src" % self.version, "mysqlclient") os.unlink(tar_file) shutil.move("mysqlclient/CMakeLists.txt", "mysqlclient/CMakeListsOriginal.cmake") shutil.move("CMakeLists.txt", "mysqlclient/CMakeLists.txt")
def source(self): zip_name = "sanitizers-cmake.zip" download("https://github.com/arsenm/sanitizers-cmake/" "archive/master.zip" "".format(version="sanitizers-cmake-" + VERSION), zip_name) unzip(zip_name) os.unlink(zip_name)
def source(self): z_name = "zlib-%s.tar.gz" % self.version tools.download("https://zlib.net/zlib-%s.tar.gz" % self.version, z_name) tools.unzip(z_name) os.unlink(z_name) files.rmdir("%s/contrib" % self.ZIP_FOLDER_NAME) if not tools.os_info.is_windows: self.run("chmod +x ./%s/configure" % self.ZIP_FOLDER_NAME)
def source(self): tgz_name = "2.3.2.tar.gz" download("https://github.com/SFML/SFML/archive/%s" % tgz_name, tgz_name) check_sha256(tgz_name, "55e7c864938e03ceb7d6d05c66f8e0dc886e632805d0ae17c222da317ba14e4c") # unzip falls back to untargz in the case of tar.gz extension unzip(tgz_name) os.unlink(tgz_name) patch(base_path=self.ZIP_FOLDER_NAME, patch_string=SFML_GCC_PATCH)
def source(self): zip_name = "%s.zip" % self.folder_name if sys.platform == "win32" else "%s.tar.gz" % self.folder_name url = "https://dl.bintray.com/boostorg/release/%s/source/%s" % ( self.upstream_version, zip_name) self.output.info("Downloading %s..." % url) tools.download(url, zip_name) tools.unzip(zip_name) os.unlink(zip_name)
def source(self): zip_name = "python3.6.1-release.zip" download("https://github.com/python/cpython/archive/v3.6.1.zip", zip_name) check_md5(zip_name, "6ac7748627c88978ca7a30a0a310a553") unzip(zip_name) shutil.move("cpython-3.6.1", self.name) os.unlink(zip_name)
def source(self): zip_name = "cpp-subprocess.zip" download("https://github.com/polysquare/" "cpp-subprocess/archive/{version}.zip" "".format(version="v" + VERSION), zip_name) unzip(zip_name) os.unlink(zip_name)
def source(self): zip_name = "root_v%s.source.tar.gz" % self.version download("https://root.cern.ch/download/%s" % zip_name, zip_name) unzip(zip_name) os.unlink(zip_name) shutil.move("%s/CMakeLists.txt" % self.folder, "%s/CMakeListsOriginal.cmake" % self.folder) shutil.move("CMakeLists.txt", "%s/CMakeLists.txt" % self.folder)
def source(self): zip_name = "hwloc.tar.gz" major = ".".join(self.version.split(".")[0:2]) download( "http://www.open-mpi.org/software/hwloc/v%s/downloads/hwloc-%s.tar.gz" % (major, self.version), zip_name) unzip(zip_name) os.unlink(zip_name)
def source(self): zip_name = "cotire.zip" download("https://github.com/sakra/" "cotire/archive/{version}.zip" "".format(version="cotire-" + VERSION), zip_name) unzip(zip_name) os.unlink(zip_name)
def source(self): tar_name = "v%s.tar.gz" % self.version tools.download( "https://github.com/mfontanini/libtins/archive/%s" % tar_name, tar_name) tools.check_md5(tar_name, "be029088c9fc8dc979022410b49a8e61") tools.unzip(tar_name) os.unlink(tar_name)
def source(self): zip_name = f"{self.name}-{self.version}.zip" tools.download( f"https://github.com/fmtlib/fmt/archive/{self.version}.zip", zip_name) tools.unzip(zip_name) shutil.move(f"{self.name}-{self.version}", f"{self.name}") os.unlink(zip_name)
def source(self): zip_name = "poco-%s-release.zip" % self.version tools.download("https://github.com/pocoproject/poco/archive/%s" % zip_name, zip_name) tools.unzip(zip_name) shutil.move("poco-poco-%s-release" % self.version, "poco") os.unlink(zip_name) shutil.move("poco/CMakeLists.txt", "poco/CMakeListsOriginal.cmake") shutil.move("CMakeLists.txt", "poco/CMakeLists.txt")
def source(self): zip_name = f"sqlpp-{self.version}" tools.download( f"https://github.com/rbock/sqlpp11-connector-sqlite3/archive/{self.version}.zip", zip_name) tools.unzip(zip_name) shutil.move(f"{self.name}-{self.version}", f"{self.name}") os.unlink(zip_name)
def source(self): zip_name = "cmake-unit.zip" download("https://github.com/polysquare/" "cmake-unit/archive/{version}.zip" "".format(version="v" + VERSION), zip_name) unzip(zip_name) os.unlink(zip_name)
def source(self): if self.version != "master": zip_name = "%s.tgz" % self.source_directory download( "https://sourceforge.net/projects/glew/files/glew/%s/%s/download" % (self.version, zip_name), zip_name) unzip(zip_name) os.unlink(zip_name)
def source(self): tools.download( "https://downloads.sourceforge.net/project/glew/glew/2.0.0/glew-2.0.0.tgz", "glew-2.0.0.tgz") tools.check_sha1("glew-2.0.0.tgz", "6e15c84f7e1fad34cd3679f784a233744ddf048f") tools.unzip("glew-2.0.0.tgz") os.remove("glew-2.0.0.tgz")
def source(self): zip_name = "cmake-linter-cmake.zip" download("https://github.com/polysquare/" "cmake-linter-cmake/archive/{version}.zip" "".format(version="v" + VERSION), zip_name) unzip(zip_name) os.unlink(zip_name)
def source(self): zip_name = "sqlite-amalgamation-3100200.zip" download("http://www.sqlite.org/2016/%s" % zip_name, zip_name) check_sha256( zip_name, "b68adfb8cfd0ba5712e0ed8346929538ceb9125d6de4d15049db56201ac794f6") unzip(zip_name) os.unlink(zip_name)
def source(self): zip_name = "{}-{}.zip".format(self.name, self.version) tools.download( "https://github.com/wdas/ptex/archive/v{}.zip".format( self.version), zip_name) tools.unzip(zip_name) shutil.move("{}-{}".format(self.name, self.version), self.name) os.remove(zip_name)
def source(self): tools.download( "https://sqlite.org/2017/sqlite-amalgamation-3190300.zip", "sqlite.zip") tools.check_sha1("sqlite.zip", "e013f08dc8dc138d7b169d09433dbcea94721441") tools.unzip("sqlite.zip") os.remove("sqlite.zip")
def source_gcc(self): gcc_zip = "%s.tar.xz" % (self.gcc_fullname) tools.download( "https://ftpmirror.gnu.org/gcc/%s/%s" % (self.gcc_fullname, gcc_zip), gcc_zip) tools.unzip(gcc_zip) with tools.chdir(self.gcc_fullname): self.run("contrib/download_prerequisites")
def build(self): self.output.warn("Downloading: %s" % self.url) tools.download(self.url, self.download_path) if os_info.is_linux: self.run("tar xvfJ %s" % self.download_path) else: tools.unzip(self.download_path, keep_permissions=True)
def source(self): self.output.info("Downloading %s" % self.source_tgz) tools.download(self.source_tgz, "libjpeg.zip") tools.unzip("libjpeg.zip", ".") os.unlink("libjpeg.zip") self.output.info("Copying CMakeLists.txt") shutil.move("CMake/CMakeLists.txt", self.libjpeg_name) shutil.move("CMake/jconfig.h.cmake", self.libjpeg_name)
def source( self ): zip_name = "glfw-3.2.zip" tools.download("https://github.com/glfw/glfw/releases/download/3.2/glfw-3.2.zip", zip_name) tools.unzip(zip_name) os.unlink(zip_name) tools.replace_in_file("glfw-3.2/CMakeLists.txt", "project(GLFW C)", """project(GLFW C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() """)
def source(self): zip_name = "lcms2-%s.tar.gz" % self.version download("http://downloads.sourceforge.net/project/lcms/lcms/2.7/%s" % zip_name, zip_name) unzip(zip_name) os.unlink(zip_name) if self.settings.os != "Windows": self.run("chmod +x ./%s/configure" % self.ZIP_FOLDER_NAME) else: copyfile("CMakeLists.txt", os.path.join(self.ZIP_FOLDER_NAME, "CMakeLists.txt"))
def source(self): tgz_name = "2.4.1.tar.gz" download("https://github.com/SFML/SFML/archive/%s" % tgz_name, tgz_name) check_sha256( tgz_name, "f9d1191b02e2df1cbe296601eee20bdf56d98fb69d49fde27c6ca789eb57398e") # unzip falls back to untargz in the case of tar.gz extension unzip(tgz_name) os.unlink(tgz_name)
def source(self): self.output.info("Downloading %s" % self.source_tgz) try: tools.download(self.source_tgz_old, "openssl.tar.gz") tools.unzip("openssl.tar.gz", ".") except: tools.download(self.source_tgz, "openssl.tar.gz") tools.unzip("openssl.tar.gz", ".") os.unlink("openssl.tar.gz")
def source(self): zip_name = "%s.zip" % self.name tools.download(self.ZIP_URL, zip_name) tools.check_sha256(zip_name, self.FILE_SHA) tools.unzip(zip_name) os.unlink(zip_name) self.run("ls -la")
def source(self): self.output.info("Downloading %s" % self.source_tgz) try: tools.download(self.source_tgz_old, "openssl.tar.gz") tools.unzip("openssl.tar.gz", ".") except: tools.download(self.source_tgz, "openssl.tar.gz") tools.unzip("openssl.tar.gz", ".") tools.check_sha256("openssl.tar.gz", "b784b1b3907ce39abf4098702dade6365522a253ad1552e267a9a0e89594aa33") os.unlink("openssl.tar.gz")