def source(self): filename = "hdf5-%s.tar.gz" % self.version tools.download("https://support.hdfgroup.org/ftp/HDF5/prev-releases/hdf5-%s/hdf5-%s/src/%s" % (self.version_base, self.version, filename), filename) tools.untargz(filename) os.unlink(filename) #os.rename ("hdf5-%s" % self.version, "hdf5-%s" % self.version) tools.replace_in_file("hdf5-%s/CMakeLists.txt" % self.version, "project (HDF5 C)", """project (HDF5 C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() """) file = "hdf5-%s/src/CMakeLists.txt" % self.version with open(file, "a") as myfile: myfile.write(''' # Hulud : Force threadsafe in static library if (HDF5_ENABLE_THREADSAFE) set_property (TARGET ${HDF5_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "H5_HAVE_THREADSAFE" ) target_link_libraries (${HDF5_LIB_TARGET} PUBLIC PRIVATE INTERFACE Threads::Threads) endif () ''')
def source(self): tarball_name = self.FOLDER_NAME + '.tar.gz' download( "https://github.com/redis/hiredis/archive/v%s.tar.gz" % (self.version), tarball_name) untargz(tarball_name) os.unlink(tarball_name)
def source(self): # https://github.com/wdas/ptex/archive/v2.3.2.tar.gz filename = "v%s.tar.gz" % self.version tools.download("https://github.com/wdas/ptex/archive/%s" % filename, filename) tools.untargz(filename) os.unlink(filename) tools.replace_in_file( "ptex-%s/CMakeLists.txt" % self.version, """# Use pkg-config to create a PkgConfig::Ptex_ZLIB imported target find_package(PkgConfig REQUIRED) pkg_checK_modules(Ptex_ZLIB REQUIRED zlib IMPORTED_TARGET)""", """include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() find_package(ZLIB)""") tools.replace_in_file( "ptex-%s/src/build/ptex-config.cmake" % self.version, """# Provide PkgConfig::ZLIB to downstream dependents find_package(PkgConfig REQUIRED) pkg_checK_modules(Ptex_ZLIB REQUIRED zlib IMPORTED_TARGET)""", "") tools.replace_in_file("ptex-%s/src/ptex/CMakeLists.txt" % self.version, """PkgConfig::Ptex_ZLIB""", """${ZLIB_LIBRARIES}""") tools.replace_in_file( "ptex-%s/src/utils/CMakeLists.txt" % self.version, """PkgConfig::Ptex_ZLIB""", """${ZLIB_LIBRARIES}""")
def source(self): url_template = "https://github.com/opencv/{0}/archive/{1}" archive_name = "{}.tar.gz".format(self.version) url = url_template.format(self.name, archive_name) tools.download(url, filename=archive_name) tools.untargz(filename=archive_name) os.remove(archive_name) name_contrib = self.name + "_contrib" url = url_template.format(name_contrib, archive_name) tools.download(url, filename=archive_name) tools.untargz(filename=archive_name) os.remove(archive_name) tools.patch(base_path=self.source_name, patch_file="patches/openblas.patch") tools.patch(base_path=self.source_name, patch_file="patches/lapack.patch") tools.patch(base_path=self.source_name, patch_file="patches/libpng.patch") tools.replace_in_file("{}/cmake/OpenCVFindLAPACK.cmake".format(self.source_name), '#message(FATAL_ERROR "LAPACK: check build log:\\n${TRY_OUT}")', 'message(FATAL_ERROR "LAPACK: check build log:\\n${TRY_OUT}")') tools.replace_in_file("{}/CMakeLists.txt".format(self.source_name), "project(OpenCV CXX C)", """project(OpenCV CXX C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup()""")
def source(self): # https://github.com/embree/embree/archive/v3.8.0.tar.gz filename = "v%s.tar.gz" % self.version tools.download( "https://github.com/embree/embree/archive/%s" % filename, filename) tools.untargz(filename) os.unlink(filename)
def source(self): filename = "oidn-%s.src.tar.gz" % self.version tools.download( "https://github.com/OpenImageDenoise/oidn/releases/download/v%s/%s" % (self.version, filename), filename) tools.untargz(filename) os.unlink(filename) tools.replace_in_file( "oidn-%s/mkl-dnn/cmake/OpenMP.cmake" % self.version, """else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp-simd") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp-simd")""", """""") if self.settings.os == "Linux": # force static linking of libstdc++/libgcc tools.replace_in_file( "oidn-%s/CMakeLists.txt" % self.version, """target_link_libraries(${PROJECT_NAME} PRIVATE common mkldnn )""", """target_link_libraries(${PROJECT_NAME} PRIVATE "-static-libstdc++ -static-libgcc" common mkldnn )""")
def do_build(self): build_dir = "{staging_dir}/src".format(staging_dir=self.staging_dir) tools.untargz(self.tarball_name, build_dir) os.unlink(self.tarball_name) src_dir = "{staging_dir}/src/icu".format(staging_dir=self.staging_dir) for file in sorted(glob("patch/[0-9]*.patch")): self.output.info("Applying patch '{file}'".format(file=file)) tools.patch(base_path=src_dir, patch_file=file, strip=0) env_build = AutoToolsBuildEnvironment(self) with tools.environment_append(env_build.vars): self.run( "cd {build_dir}/icu/source && ./configure --prefix=\"{staging}\"" " --enable-tools=yes --enable-tests=no --enable-samples=no --disable-renaming --disable-debug --with-data-packaging=static" " {shared} {extras} {icuio} {layoutex}".format( compiler=self.settings.compiler, shared="--enable-shared --disable-static" if self.options.shared else "--enable-static --disable-shared", extras="--enable-extras=yes" if self.options.extras else "--enable-extras=no", icuio="--enable-icuio=yes" if self.options.icuio else "--enable-icuio=no", layoutex="--enable-layoutex=yes" if self.options.layoutex else "--enable-layoutex=no", build_dir=build_dir, staging=self.staging_dir)) self.run("cd %s/icu/source && make install" % build_dir)
def source(self): tools.download("http://download.savannah.nongnu.org/releases/openexr/openexr-%s.tar.gz" % self.version, "openexr.tar.gz") tools.untargz("openexr.tar.gz") os.unlink("openexr.tar.gz") tools.replace_in_file("openexr-%s/CMakeLists.txt" % self.version, "PROJECT (openexr)", """PROJECT (openexr) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() set(ILMBASE_PACKAGE_PREFIX ${CONAN_ILMBASE_ROOT}) file(GLOB RUNTIME_FILES ${CONAN_ILMBASE_ROOT}/bin/*.dll ${CONAN_ILMBASE_ROOT}/lib/*.dylib) file(COPY ${RUNTIME_FILES} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})""") # Fixes for conan putting binaries in bin folder tools.replace_in_file("openexr-%s/IlmImf/CMakeLists.txt" % self.version, "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/b44ExpLogTable", "b44ExpLogTable") tools.replace_in_file("openexr-%s/IlmImf/CMakeLists.txt" % self.version, "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dwaLookups", "dwaLookups") tools.replace_in_file("openexr-%s/IlmImf/CMakeLists.txt" % self.version, "ADD_EXECUTABLE ( dwaLookups", """file(COPY ${RUNTIME_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) ADD_EXECUTABLE ( dwaLookups""") tools.replace_in_file("openexr-%s/IlmImf/CMakeLists.txt" % self.version, """ Iex${ILMBASE_LIBSUFFIX} IlmThread${ILMBASE_LIBSUFFIX}""", """ IlmThread${ILMBASE_LIBSUFFIX} Iex${ILMBASE_LIBSUFFIX}""") # Fix wrong link order when using static IlmBase on gcc # Remove tests compilation tools.replace_in_file("openexr-%s/CMakeLists.txt" % self.version, "ADD_SUBDIRECTORY ( IlmImfExamples )", "") tools.replace_in_file("openexr-%s/CMakeLists.txt" % self.version, "ADD_SUBDIRECTORY ( IlmImfTest )", "") tools.replace_in_file("openexr-%s/CMakeLists.txt" % self.version, "ADD_SUBDIRECTORY ( IlmImfUtilTest )", "") tools.replace_in_file("openexr-%s/CMakeLists.txt" % self.version, "ADD_SUBDIRECTORY ( IlmImfFuzzTest )", "") if self.settings.os == "Windows" and self.settings.compiler == "gcc": # MinGW compiler tools.patch(patch_file="mingw-fix.patch", base_path="openexr-%s" % self.version)
def source(self): download("http://ftp.gnu.org/gnu/bison/" + self.archiveName, self.archiveName) untargz(self.archiveName) os.unlink(self.archiveName) if self.settings.os != "Windows": self.run("chmod +x ./%s/configure" % self.folderName)
def source(self): filename = "oidn-%s.src.tar.gz" % self.version tools.download( "https://github.com/OpenImageDenoise/oidn/releases/download/v%s/%s" % (self.version, filename), filename) tools.untargz(filename) os.unlink(filename)
def source(self): tarball_url = 'https://gnu.cu.be/autoconf/autoconf-{}.tar.gz'.format( self.version) tgz = tarball_url.split('/')[-1] tools.download(tarball_url, tgz) tools.untargz(tgz) os.unlink(tgz)
def source(self): tarball_name = 'libpng.tar.gz' download( "http://prdownloads.sourceforge.net/libpng/libpng-%s.tar.gz?download" % (self.version), tarball_name) untargz(tarball_name) os.unlink(tarball_name)
def do_build(self): build_dir = "{staging_dir}/src".format(staging_dir=self.staging_dir) tools.untargz("libpcap-{v}.tar.gz".format(v=self.version), build_dir) env_build = AutoToolsBuildEnvironment(self) with tools.environment_append(env_build.vars): self.run( "cd {build_dir}/libpcap-{v} && ./configure --prefix=\"{staging}\"" " {shared} {ipv6} {canusb} {bluetooth} {snf} {dbus} {libnl}". format( v=self.version, build_dir=build_dir, staging=self.staging_dir, shared="--enable-shared --disable-static" if self.options.shared else "--enable-static --disable-shared", ipv6="--enable-ipv6" if self.options.ipv6 else "--disable-ipv6", canusb="--enable-canusb" if self.options.canusb else "--disable-canusb", bluetooth="--enable-bluetooth" if self.options.bluetooth else "--disable-bluetooth", dbus="--enable-dbus" if self.options.dbus else "--disable-dbus", snf="--with-snf" if self.options.snf else "--without-snf", libnl="--with-libnl" if self.options.snf else "--without-libnl")) self.run("cd {build_dir}/libpcap-{v} && make install".format( v=self.version, build_dir=build_dir))
def source(self): archive_filename = "parmetis-4.0.3.tar.gz" tools.download( "http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.3.tar.gz", archive_filename) tools.untargz(archive_filename) self.update_cmake_for_mpi() if self.options.remove_rint_fix == True: tools.replace_in_file(".\\parmetis-4.0.3\\metis\\GKlib\\gk_arch.h", "#define rint(x) ((int)((x)+0.5))", "//#define rint(x) ((int)((x)+0.5))") if self.options.remove_infinity_fix == True: tools.replace_in_file(".\\parmetis-4.0.3\\metis\\GKlib\\gk_arch.h", "#define INFINITY FLT_MAX", "//#define INFINITY FLT_MAX") tools.replace_in_file( ".\\parmetis-4.0.3\\metis\\include\\metis.h", "#define IDXTYPEWIDTH 32", "#define IDXTYPEWIDTH {}".format(self.options.IDXTYPEWIDTH)) tools.replace_in_file( ".\\parmetis-4.0.3\\metis\\include\\metis.h", "#define REALTYPEWIDTH 32", "#define REALTYPEWIDTH {}".format(self.options.REALTYPEWIDTH))
def do_build(self): build_dir = "{staging_dir}/src".format(staging_dir=self.staging_dir) tools.untargz("openssl-{v}.tar.gz".format(v=self.version), build_dir) src_dir = "{build_dir}/openssl-OpenSSL_{v}".format( v=self.version.replace('.', '_'), build_dir=build_dir) shared_definition = "no-shared" if not self.options.shared else "shared" zlib_definition = "no-zlib no-zlib-dynamic" if self.options.with_zlib: if self.options["zlib"].system: zlib_definition = "zlib" else: zlib_definition = "{zlib} --with-zlib-lib={zlib_pkg_dir}/lib --with-zlib-include={zlib_pkg_dir}/include".format( zlib_pkg_dir=self.deps_cpp_info["zlib"].rootpath, zlib="no-zlib zlib-dynamic" if self.options["zlib"].shared else "zlib no-zlib-dynamic") env_build = AutoToolsBuildEnvironment(self) with tools.environment_append(env_build.vars): with tools.chdir(src_dir): self.run( "./config --prefix=\"{staging}\" {shared} {zlib} {android}" .format(staging=self.staging_dir, shared=shared_definition, zlib=zlib_definition, android="no-hw no-engine no-asm" if self.settings.os == "Android" else "")) self.run( "make -j {cpu_count}".format(cpu_count=tools.cpu_count())) self.run("make install_sw")
def source(self): _git = tools.Git() _git.clone("https://github.com/coin-or-tools/{}.git" .format(self._coin_helper), branch=self._coin_helper_branch, shallow=True) hsl_archive = self.options.hsl_archive if hsl_archive is None: raise ConanInvalidConfiguration( "option:hsl_archive must point to an hsl archive file or url") hsl_archive = str(hsl_archive) if hsl_archive.startswith("http"): hsl_user = tools.get_env("HSL_USER") hsl_password = tools.get_env("HSL_PASSWORD") auth = None if hsl_user is not None and hsl_password is not None: auth = (hsl_user, hsl_password) tools.get(hsl_archive, auth=auth, strip_root=True, destination="coinhsl") else: self.output.info("Retrieving HSL from {}".format(hsl_archive)) tools.untargz(hsl_archive, strip_root=True, destination="coinhsl")
def _pip_tar2whl_to_temp(self, pkg_name, temp_name): with tempfile.TemporaryDirectory() as tmpdirname: with tools.chdir(tmpdirname): subprocess.run([ "pip", "download", "--no-deps", "--platform", "win_amd64", "--python-version", "%s" % ("".join(self._python_version.split(".")[0:2])), "--implementation", "cp", "--find-links=.", "--isolated", pkg_name ], check=True) (tar_file, ) = [ filename for filename in os.listdir(".") if filename.endswith(".tar.gz") ] tools.untargz(tar_file) with tools.chdir(tar_file.replace(".tar.gz", "")): tools.replace_in_file("setup.py", "from distutils.core import setup", "from setuptools import setup", strict=False) subprocess.run([ "python", "setup.py", "bdist_wheel", "-d", os.path.join(self.source_folder, temp_name) ], check=True)
def source(self): tarball_name = '{}.tgz'.format(self.dirname) tarball_url = ( 'https://sourceforge.net/projects/xmlrpc-c/files/Xmlrpc-c%20Super%20Stable/{}/{}' .format(self.version, tarball_name)) tools.download(tarball_url, tarball_name) tools.untargz(tarball_name)
def source(self): # https://github.com/ofxa/openfx/archive/OFX_Release_1_4_TAG.tar.gz filename = "OFX_Release_1_4_TAG.tar.gz" tools.download("https://github.com/ofxa/openfx/archive/%s" % filename, filename) tools.untargz(filename) os.unlink(filename)
def source(self): tarball_name = self.FOLDER_NAME + '.tar.gz' download("https://github.com/libevent/libevent/releases/download/release-%s-stable/%s.tar.gz" % (self.version, self.FOLDER_NAME), tarball_name) check_sha1(tarball_name, "a586882bc93a208318c70fc7077ed8fca9862864") untargz(tarball_name) os.unlink(tarball_name)
def source(self): version = self.version[0:self.version.rfind('.')] tools.download("http://ftp.pcre.org/pub/pcre/pcre-%s.tar.gz" % version, "pcre.tar.gz") tools.untargz("pcre.tar.gz") os.unlink("pcre.tar.gz")
def do_build(self): cmake = CMake(self) tools.untargz("docopt.cpp-{v}.tar.gz".format(v=self.version)) cmake_defs = {"CMAKE_INSTALL_PREFIX": self.package_folder, "CMAKE_INSTALL_LIBDIR": "lib"} cmake_defs.update(self.cmake_crt_linking_flags()) cmake.configure(defs = cmake_defs, source_dir="docopt.cpp-{v}".format(v=self.version)) cmake.build(target="install")
def source(self): tar = 'debug_assert-{}.tar.gz'.format(self.version) url = 'https://github.com/foonathan/debug_assert/archive/v{}.tar.gz'.format( self.version) download(url, tar) untargz(tar)
def uncompress_packaged_files(paths, package_reference): package_path = paths.package(package_reference) if not(os.path.exists(os.path.join(package_path, PACKAGE_TGZ_NAME))): raise ConanException("%s not found in %s" % (PACKAGE_TGZ_NAME, package_path)) tmp = temp_folder() untargz(os.path.join(package_path, PACKAGE_TGZ_NAME), tmp) return tmp
def source(self): folder_name = "%s-%s" % (self.name, self.version) arch_name = "%s.tar.gz" % folder_name print("%s/%s" % (self.url, arch_name)) tools.download(url="%s/%s" % (self.url, arch_name), filename=arch_name) tools.untargz(arch_name, destination='.', pattern=None) shutil.move(folder_name, self._source_subfolder)
def source(self): tools.download( "https://github.com/maxis11/ideal-couscous/archive/v0.1.2-beta.tar.gz", "ic.tar.gz") tools.untargz("ic.tar.gz") os.unlink("ic.tar.gz") shutil.move("ideal-couscous-0.1.2-beta", "IdealCouscous")
def do_build(self): build_dir = "{staging_dir}/src".format(staging_dir=self.staging_dir) tools.untargz("gperftools-{v}.tar.gz".format(v=self.version), build_dir) env_build = AutoToolsBuildEnvironment(self) with tools.environment_append(env_build.vars): self.run( "cd {build_dir}/gperftools-{v} && ./configure --prefix=\"{staging}\" {is_minimal}" " {shared} {cpuprof} {heapprof} {heapchecker}".format( v=self.version, build_dir=build_dir, staging=self.staging_dir, is_minimal="" if self.options.cpuprof or self.options.heapprof or self.options.heapchecker else "--enable-minimal", shared="--enable-shared --disable-static" if self.options.shared else "--enable-static --disable-shared", cpuprof="--enable-cpu-profiler" if self.options.cpuprof else "--disable-cpu-profiler", heapprof="--enable-heap-profiler" if self.options.heapprof else "--disable-heap-profiler", heapchecker="--enable-heap-checker" if self.options.heapchecker else "--disable-heap-checker")) self.run("cd {build_dir}/gperftools-{v} && make install".format( v=self.version, build_dir=build_dir))
def source(self): tarball_url = 'https://pkgconfig.freedesktop.org/releases/pkg-config-{}.tar.gz'.format( self.version) tgz = tarball_url.split('/')[-1] tools.download(tarball_url, tgz) tools.untargz(tgz) os.unlink(tgz)
def simple_test(self): """ basic installation of a new conans """ # Try to upload an package without upload conans first self.client.run('upload %s -p %s' % (self.conan_ref, str(self.package_ref.package_id)), ignore_error=True) self.assertIn("There are no remote conanfiles like %s" % str(self.conan_ref), self.client.user_io.out) # Upload conans self.client.run('upload %s' % str(self.conan_ref)) self.assertTrue(os.path.exists(self.server_reg_folder)) self.assertFalse(os.path.exists(self.server_pack_folder)) # Upload package self.client.run('upload %s -p %s' % (str(self.conan_ref), str(self.package_ref.package_id))) self.assertTrue(os.path.exists(self.server_reg_folder)) self.assertTrue(os.path.exists(self.server_pack_folder)) # Test the file in the downloaded conans files = ['CMakeLists.txt', 'my_lib/debug/libd.a', 'hello.cpp', 'hello0.h', CONANFILE, CONAN_MANIFEST, 'main.cpp', 'include/math/lib1.h', 'my_data/readme.txt', 'my_bin/executable'] self.assertTrue(os.path.exists(os.path.join(self.server_reg_folder, CONANFILE))) self.assertTrue(os.path.exists(os.path.join(self.server_reg_folder, EXPORT_TGZ_NAME))) tmp = temp_folder() untargz(os.path.join(self.server_reg_folder, EXPORT_TGZ_NAME), tmp) for f in files: if f not in (CONANFILE, CONAN_MANIFEST): self.assertTrue(os.path.exists(os.path.join(tmp, f))) else: self.assertFalse(os.path.exists(os.path.join(tmp, f))) folder = uncompress_packaged_files(self.test_server.paths, self.package_ref) self.assertTrue(os.path.exists(os.path.join(folder, "include", "lib1.h"))) self.assertTrue(os.path.exists(os.path.join(folder, "lib", "my_lib/libd.a"))) self.assertTrue(os.path.exists(os.path.join(folder, "res", "shares/readme.txt"))) if platform.system() != "Windows": self.assertEqual(os.stat(os.path.join(folder, "bin", "my_bin/executable")).st_mode & stat.S_IRWXU, stat.S_IRWXU)
def source(self): tarball_name = self.FOLDER_NAME + '.tar.gz' self.run("cp /data/software/%s ." % (tarball_name)) # download("https://github.com/mongodb/mongo-c-driver/releases/download/%s/%s.tar.gz" # % (self.version, self.FOLDER_NAME), tarball_name) untargz(tarball_name) os.unlink(tarball_name) pass
def source(self): distrib_url = 'https://sourceforge.net/projects/geographiclib/files/distrib/' tarball = '%s-%s.tar.gz' % (self.name, self.version) self.output.info('Downloading %s' % tarball) tools.download(distrib_url + tarball, tarball) tools.untargz(tarball) shutil.move('%s-%s' % (self.name, self.version), 'distrib') os.unlink(tarball)
def source(self): distrib_url = 'https://sourceforge.net/projects/geographiclib/files/distrib/' tarball = '%s-%s.tar.gz' % (self.name, self.version) self.output.info('Downloading %s' % tarball) tools.download(distrib_url + tarball, tarball) tools.untargz(tarball) shutil.move('%s-%s' % (self.name, self.version), 'geographiclib_src') os.unlink(tarball)
def do_build(self): cmake = CMake(self) cmake.build_dir = "{staging_dir}/src".format(staging_dir=self.staging_dir) tools.untargz("procman-{v}.tar.gz".format(v=self.version), cmake.build_dir) cmake.configure(defs={ "CMAKE_INSTALL_PREFIX": self.staging_dir, "CMAKE_INSTALL_LIBDIR": "lib" }, source_dir="procman-{v}".format(v=self.version)) cmake.build(target="install")
def source(self): targzfile = '%s.tar.gz' % self.ZIP_FOLDER_NAME tools.download("http://www.fftw.org/fftw-%s.tar.gz" % self.version, targzfile) tools.check_md5(targzfile, "2edab8c06b24feeb3b82bbb3ebf3e7b3") tools.untargz(targzfile) os.unlink(targzfile) shutil.move("CMakeLists.txt", self.ZIP_FOLDER_NAME) shutil.move("config.h.cmake", self.ZIP_FOLDER_NAME) shutil.move("config.h.cmaketemplate", self.ZIP_FOLDER_NAME)
def do_build(self): build_dir = "{staging_dir}/src".format(staging_dir=self.staging_dir) tools.untargz("snappy-{v}.tar.gz".format(v=self.version), build_dir) shared_definition = "--enable-static --disable-shared" if self.options.shared: shared_definition = "--enable-shared --disable-static" env_build = AutoToolsBuildEnvironment(self) with tools.environment_append(env_build.vars): self.run("cd {build_dir}/snappy-{v} && ./configure --disable-gtest prefix=\"{staging}\" {shared}".format( v = self.version, staging=self.staging_dir, shared=shared_definition, build_dir=build_dir)) self.run("cd {build_dir}/snappy-{v} && make install".format(v = self.version, build_dir = build_dir))
def source(self): tools.download("https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb44_20160413oss_src.tgz", "tbb.zip") tools.untargz("tbb.zip") os.unlink("tbb.zip") shutil.move("tbb44_20160413oss", "tbb")
def upload_test(self): conan_reference = ConanFileReference.loads("Hello0/0.1@lasote/stable") files = cpp_hello_conan_files("Hello0", "0.1") files["to_be_deleted.txt"] = "delete me" files["to_be_deleted2.txt"] = "delete me2" remote_paths = self.client.servers["default"].paths server_conan_path = remote_paths.export(conan_reference) self.client.save(files) self.client.run("export . lasote/stable") # Upload conan file self.client.run("upload %s" % str(conan_reference)) # Verify the files are there self.assertTrue(os.path.exists(os.path.join(server_conan_path, EXPORT_TGZ_NAME))) tmp = temp_folder() untargz(os.path.join(server_conan_path, EXPORT_TGZ_NAME), tmp) self.assertTrue(load(os.path.join(tmp, "to_be_deleted.txt")), "delete me") self.assertTrue(load(os.path.join(tmp, "to_be_deleted2.txt")), "delete me2") # Now delete local files export and upload and check that they are not in server os.remove(os.path.join(self.client.current_folder, "to_be_deleted.txt")) self.client.run("export . lasote/stable") self.client.run("upload %s" % str(conan_reference)) self.assertTrue(os.path.exists(os.path.join(server_conan_path, EXPORT_TGZ_NAME))) tmp = temp_folder() untargz(os.path.join(server_conan_path, EXPORT_TGZ_NAME), tmp) self.assertFalse(os.path.exists(os.path.join(tmp, "to_be_deleted.txt"))) self.assertTrue(os.path.exists(os.path.join(tmp, "to_be_deleted2.txt"))) # Now modify a file, and delete other, and put a new one. files["to_be_deleted2.txt"] = "modified content" files["new_file.lib"] = "new file" del files["to_be_deleted.txt"] self.client.save(files) self.client.run("export . lasote/stable") self.client.run("upload %s" % str(conan_reference)) # Verify all is correct self.assertTrue(os.path.exists(os.path.join(server_conan_path, EXPORT_TGZ_NAME))) tmp = temp_folder() untargz(os.path.join(server_conan_path, EXPORT_TGZ_NAME), tmp) self.assertTrue(load(os.path.join(tmp, "to_be_deleted2.txt")), "modified content") self.assertTrue(load(os.path.join(tmp, "new_file.lib")), "new file") self.assertFalse(os.path.exists(os.path.join(tmp, "to_be_deleted.txt"))) ########################## # Now try with the package ########################## self.client.run("install %s --build missing" % str(conan_reference)) # Upload package package_ids = self.client.paths.conan_packages(conan_reference) self.client.run("upload %s -p %s" % (str(conan_reference), str(package_ids[0]))) # Check that conans exists on server package_reference = PackageReference(conan_reference, str(package_ids[0])) package_server_path = remote_paths.package(package_reference) self.assertTrue(os.path.exists(package_server_path)) # Add a new file to package (artificially), upload again and check pack_path = self.client.paths.package(package_reference) new_file_source_path = os.path.join(pack_path, "newlib.lib") save(new_file_source_path, "newlib") os.unlink(os.path.join(pack_path, PACKAGE_TGZ_NAME)) # Force new tgz self._create_manifest(package_reference) self.client.run("upload %s -p %s" % (str(conan_reference), str(package_ids[0]))) folder = uncompress_packaged_files(remote_paths, package_reference) remote_file_path = os.path.join(folder, "newlib.lib") self.assertTrue(os.path.exists(remote_file_path)) # Now modify the file and check again save(new_file_source_path, "othercontent") self._create_manifest(package_reference) self.client.run("upload %s -p %s" % (str(conan_reference), str(package_ids[0]))) folder = uncompress_packaged_files(remote_paths, package_reference) remote_file_path = os.path.join(folder, "newlib.lib") self.assertTrue(os.path.exists(remote_file_path)) self.assertTrue(load(remote_file_path), "othercontent") # Now delete the file and check again os.remove(new_file_source_path) self._create_manifest(package_reference) os.unlink(os.path.join(pack_path, PACKAGE_TGZ_NAME)) # Force new tgz self.client.run("upload %s -p %s" % (str(conan_reference), str(package_ids[0]))) folder = uncompress_packaged_files(remote_paths, package_reference) remote_file_path = os.path.join(folder, "newlib.lib") self.assertFalse(os.path.exists(remote_file_path)) self.assertNotEquals(remote_file_path, new_file_source_path)