Ejemplo n.º 1
0
def build_sln_command(settings, sln_path, targets=None, upgrade_project=True, build_type=None,
                      arch=None, parallel=True, toolset=None, platforms=None, output=None,
                      verbosity=None, definitions=None):
    """
    Use example:
        build_command = build_sln_command(self.settings, "myfile.sln", targets=["SDL2_image"])
        command = "%s && %s" % (tools.vcvars_command(self.settings), build_command)
        self.run(command)
    """
    conan_v2_behavior("'tools.build_sln_command' is deprecated, use 'MSBuild()' helper instead")
    from conans.client.build.msbuild import MSBuild
    tmp = MSBuild(settings)
    output = default_output(output, fn_name='conans.client.tools.win.build_sln_command')
    tmp._output = output

    # Generate the properties file
    props_file_contents = tmp._get_props_file_contents(definitions)
    tmp_path = os.path.join(mkdir_tmp(), ".conan_properties")
    save(tmp_path, props_file_contents)

    # Build command
    command = tmp.get_command(sln_path, tmp_path,
                              targets=targets, upgrade_project=upgrade_project,
                              build_type=build_type, arch=arch, parallel=parallel,
                              toolset=toolset, platforms=platforms, use_env=False,
                              verbosity=verbosity)

    return command
Ejemplo n.º 2
0
def tgz_with_contents(files):
    with chdir(mkdir_tmp()):
        import tarfile
        file_path = os.path.abspath("myfile.tar.gz")
        tar_file = tarfile.open(file_path, "w:gz")
        for name, content in files.items():
            info = tarfile.TarInfo(name=name)
            data = content.encode('utf-8')
            info.size = len(data)
            tar_file.addfile(tarinfo=info, fileobj=BytesIO(data))
            tar_file.close()
        return file_path
Ejemplo n.º 3
0
 def setUp(self):
     self.old_folder = os.getcwd()
     self.tmp_folder = mkdir_tmp()
     os.chmod(self.tmp_folder, 0o777)
     self.conan_home = self.tmp_folder
     os.chdir(self.tmp_folder)
     # user_home = "c:/tmp/home"  # Cache
     self.old_env = dict(os.environ)
     os.environ.update({
         "CONAN_USER_HOME": self.conan_home,
         "CONAN_PIP_PACKAGE": "0"
     })
     self.output = TestBufferConanOutput()
     self.api, self.client_cache, _ = ConanAPIV1.factory()
     print("Testing with Conan Folder=%s" % self.client_cache.conan_folder)
Ejemplo n.º 4
0
Archivo: win.py Proyecto: wdobbe/conan
def build_sln_command(settings,
                      sln_path,
                      targets=None,
                      upgrade_project=True,
                      build_type=None,
                      arch=None,
                      parallel=True,
                      toolset=None,
                      platforms=None):
    """
    Use example:
        build_command = build_sln_command(self.settings, "myfile.sln", targets=["SDL2_image"])
        command = "%s && %s" % (tools.vcvars_command(self.settings), build_command)
        self.run(command)
    """
    from conans.client.build.msbuild import MSBuild
    tmp = MSBuild(settings)
    tmp._output = _global_output

    # Generate the properties file
    props_file_contents = tmp._get_props_file_contents()
    tmp_path = os.path.join(mkdir_tmp(), ".conan_properties")
    save(tmp_path, props_file_contents)

    # Build command
    command = tmp.get_command(sln_path,
                              tmp_path,
                              targets=targets,
                              upgrade_project=upgrade_project,
                              build_type=build_type,
                              arch=arch,
                              parallel=parallel,
                              toolset=toolset,
                              platforms=platforms,
                              use_env=False)

    return command
Ejemplo n.º 5
0
def build_sln_command(settings, sln_path, targets=None, upgrade_project=True, build_type=None,
                      arch=None, parallel=True, toolset=None, platforms=None):
    """
    Use example:
        build_command = build_sln_command(self.settings, "myfile.sln", targets=["SDL2_image"])
        command = "%s && %s" % (tools.vcvars_command(self.settings), build_command)
        self.run(command)
    """
    from conans.client.build.msbuild import MSBuild
    tmp = MSBuild(settings)
    tmp._output = _global_output

    # Generate the properties file
    props_file_contents = tmp._get_props_file_contents()
    tmp_path = os.path.join(mkdir_tmp(), ".conan_properties")
    save(tmp_path, props_file_contents)

    # Build command
    command = tmp.get_command(sln_path, tmp_path,
                              targets=targets, upgrade_project=upgrade_project,
                              build_type=build_type, arch=arch, parallel=parallel,
                              toolset=toolset, platforms=platforms, use_env=False)

    return command
def _create_recipe(content):
    conanfile = os.path.join(mkdir_tmp(), 'conanfile.py')
    tools.save(conanfile, content)
    return conanfile