[question] self.export_sources_folder in def export_sources(self) method

Open
#109 20 comments 0 reactions 1 assignee View on GitHub

@memsharded is already working on this.

Since Jul 27, 2023.

Assessment

This issue has not been assessed yet.

Description

question

I am learning about conan and try migrate conan 1.x recipes to conan 2.x.
Could you please someone tell me where the self.export_sources_folder tis folder is define in following recipe file?

What is the value of self.export_sources_folder for following scenario?

import os
from conan import ConanFile
from conan.tools.files import load, copy
from conan.tools.cmake import CMake


class PkgSay(ConanFile):
    name = "say"
    version = "1.0"
    settings = "os", "compiler", "build_type", "arch"
    generators = "CMakeToolchain"

    def layout(self):
        # The root of the project is one level above
        self.folders.root = ".." 
        # The source of the project (the root CMakeLists.txt) is the source folder
        self.folders.source = "."  
        self.folders.build = "build"

    def export_sources(self):
        # The path of the CMakeLists.txt and sources we want to export are one level above
        folder = os.path.join(self.recipe_folder, "..")
        copy(self, "*.txt", folder, self.export_sources_folder)
        copy(self, "src/*.cpp", folder, self.export_sources_folder)
        copy(self, "include/*.h", folder, self.export_sources_folder)
    
    def source(self):
        # Check that we can see that the CMakeLists.txt is inside the source folder
        cmake_file = load(self, "CMakeLists.txt")

    def build(self):
        # Check that the build() method can also access the CMakeLists.txt in the source folder
        path = os.path.join(self.source_folder, "CMakeLists.txt")
        cmake_file = load(self, path)

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

    def package(self):
        cmake = CMake(self)
        cmake.install()
Dominant language
Python
Stars
126
Forks
65
Avg merge
11h 3m
Merged PRs (30d)
4

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from conan-io/examples2

All issues in conan-io/examples2

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.