Exemplo n.º 1
0
    def test_package_tools(self):
        run("pip install tabulate")  # only package tools dep
        run("pip install conan_package_tools --no-dependencies"
            )  # Install latest

        # To try build bzip2 with package tools
        librepo = "https://github.com/lasote/conan-bzip2.git"
        branch = "release/1.0.6"
        run("git clone --depth 1 %s -b %s ." % (librepo, branch))
        env = {
            "CONAN_USERNAME": "******",
            "CONAN_CHANNEL": "testing",
            "CONAN_DOCKER_USE_SUDO": "0",
            "CONAN_REFERENCE": "bzip2/1.0.6"
        }

        if platform.system() == "Windows":
            env["CONAN_VISUAL_VERSIONS"] = "15"
        elif platform.system() == "Linux":
            env["CONAN_GCC_VERSIONS"] = "5"
            # env["CONAN_USE_DOCKER"] = "1" docker command not found, check why and enable again
        elif platform.system() == "Darwin":
            env["CONAN_APPLE_CLANG_VERSIONS"] = "9.0"

        with tools.environment_append(env):
            run("conan --version")
            run("python build.py")
Exemplo n.º 2
0
    def install_one_test(self):
        conanfile = """from conans import ConanFile
import time
class ConanMeanLib(ConanFile):
    settings = "os"
    exports = "*.txt"
    def package(self):
        self.copy("*")
    # To force some concurrency
    def system_requirements(self):
        time.sleep(0.3)
    """

        save("conanfile.py", conanfile)
        save("file.txt", "whatever")

        run("conan create . Pkg/0.1@user/testing -s os=Windows")
        run("conan remote add local http://localhost:9300 --insert")
        run("conan user user -p user --remote=local")
        run("conan upload Pkg/0.1@user/testing --all -r=local")
        run('conan remove "*" -f')

        os.remove("conanfile.py")
        save("conanfile.txt", "[requires]\nPkg/0.1@user/testing")

        total_output = []
        def install():
            out = run("conan install . -s os=Windows", capture=True)
            total_output.append(out)
        ps = []
        for i in range(count):
            thread = Thread(target=install)
            ps.append(thread)

        for p in ps:
            p.start()
        for p in ps:
            p.join()
        final_output = "\n".join(total_output)
        self.assertEqual(1, final_output.count("Downloading conan_export.tgz"))
        self.assertEqual(1, final_output.count("Downloading conan_package.tgz"))
        skipped_downloads = final_output.count("Pkg/0.1@user/testing: Download skipped. "
                                               "Probable concurrent download")
        cached_installs = final_output.count("Pkg/0.1@user/testing: Already installed!")
        self.assertEqual(count - 1, skipped_downloads + cached_installs)
Exemplo n.º 3
0
    def test_base(self, subsystem_require):

        run("conan remote remove conan-testuite ", ignore_error=True)
        run("conan remote add conan-center https://conan.bintray.com",
            ignore_error=True)

        files = cpp_hello_conan_files(name="Hello",
                                      version="0.1",
                                      deps=None,
                                      language=0,
                                      static=True,
                                      use_cmake=False)
        files["myprofile"] = """
[build_requires]
mingw_installer/1.0@conan/stable
%s
 
[settings]
os_build=Windows
arch_build=x86_64
os=Windows
arch=x86_64
compiler=gcc
compiler.version=5.4
compiler.libcxx=libstdc++11
compiler.exception=seh
compiler.threads=posix
""" % subsystem_require

        save_files(files)
        run("conan create %s conan/testing --profile ./myprofile --update" %
            path_dot())
Exemplo n.º 4
0
    def cmake_with_raw_flag_test(self):
        if conan_version < "1.3.0":  # Avoid 0.30.0
            raise nose.SkipTest("Only Conan 1.0 test")
        if platform.system() == "Windows":
            raise nose.SkipTest("Only Non-windows test")

        conanfile = """from conans import ConanFile, CMake
import os
class Conan(ConanFile):
    name = "lib"
    version = "1.0"
    settings = "os", "compiler", "arch", "build_type", "cppstd"
    exports_sources = "*"
    build_requires = "cmake_installer/2.8.12@conan/stable"
    generators = "cmake"

    def build(self):
        cmake = CMake(self)
        cmake.configure()
        cmake.build()

"""

        test_main = """#include <iostream>

int main() {
    auto a = 1;
}
"""
        cmake = """
project(MyHello CXX)
cmake_minimum_required(VERSION 2.8.12)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(main main.cpp)
"""
        save("conanfile.py", conanfile)
        save("main.cpp", test_main)
        save("CMakeLists.txt", cmake)
        out = run("conan create . user/channel -s cppstd=14", capture=True)
        self.assertIn("Conan setting CXX_FLAGS flags: -std=c++14", out)
Exemplo n.º 5
0
 def setUp(self):
     super(PocoTest, self).setUp()
     run("conan remove %s -f" % self.libref, ignore_error=True)
Exemplo n.º 6
0
 def test_install_remote(self):
     run("git clone --depth 1 %s -b %s ." % (self.librepo, self.branch))
     run("conan test test_package %s" % self.libref)
Exemplo n.º 7
0
 def test_repo(self):
     run("git clone --depth 1 %s -b %s ." % (self.librepo, self.branch))
     run(conan_create_command("conan/testing"))
Exemplo n.º 8
0
 def setUp(self):
     super(ZlibTest, self).setUp()
     run("conan remove %s -f" % self.libref)
Exemplo n.º 9
0
 def create():
     out = run("conan create . Pkg/0.1@user/testing", capture=True)
     total_output.append(out)
Exemplo n.º 10
0
 def export():
     out = run("conan export . Pkg/0.1@user/testing", capture=True)
     total_output.append(out)
Exemplo n.º 11
0
 def install():
     out = run("conan install . -s os=Windows", capture=True)
     total_output.append(out)