Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] source_folder and build_folder are empty inside generate method #10566

Closed
pasrom opened this issue Feb 14, 2022 · 3 comments · Fixed by #10567
Closed

[question] source_folder and build_folder are empty inside generate method #10566

pasrom opened this issue Feb 14, 2022 · 3 comments · Fixed by #10567

Comments

@pasrom
Copy link

pasrom commented Feb 14, 2022

The self.source_folder and self.build_folder are empty inside the generate method when doing a conan install. While conan create works as I would expect it. I'm using conan version 1.45.0.

Is this desired behavior?

Using following conanfile:

from conans import ConanFile

class Test(ConanFile):
    version = "1.2.3"
    name = "test"

    def generate(self):
        self.output.info("generate sf: {}".format(self.source_folder))
        self.output.info("generate bf: {}".format(self.build_folder))
Output conan install
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=10
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

conanfile.py (test/1.2.3): Installing package
Requirements
Packages

Installing (downloading, building) binaries...
conanfile.py (test/1.2.3): Generator txt created conanbuildinfo.txt
conanfile.py (test/1.2.3): Calling generate()
conanfile.py (test/1.2.3): generate sf: None
conanfile.py (test/1.2.3): generate bf: None
conanfile.py (test/1.2.3): Aggregating env generators
conanfile.py (test/1.2.3): Generated conaninfo.txt
conanfile.py (test/1.2.3): Generated graphinfo
Output conan create
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=10
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

conanfile.py (test/1.2.3): Installing package
Requirements
Packages

Installing (downloading, building) binaries...
conanfile.py (test/1.2.3): Generator txt created conanbuildinfo.txt
conanfile.py (test/1.2.3): Calling generate()
conanfile.py (test/1.2.3): generate sf: None
conanfile.py (test/1.2.3): generate sf: None
conanfile.py (test/1.2.3): Aggregating env generators
conanfile.py (test/1.2.3): Generated conaninfo.txt
conanfile.py (test/1.2.3): Generated graphinfo
jenkins@1f05df87e5a4:~/ws/conan-semver/package-a/build$ conan create .. 
[HOOK - attribute_checker.py] pre_export(): WARN: Conanfile doesn't have 'url'. It is recommended to add it as attribute
[HOOK - attribute_checker.py] pre_export(): WARN: Conanfile doesn't have 'license'. It is recommended to add it as attribute
[HOOK - attribute_checker.py] pre_export(): WARN: Conanfile doesn't have 'description'. It is recommended to add it as attribute
Exporting package recipe
test/1.2.3: A new conanfile.py version was exported
test/1.2.3: Folder: /home/jenkins/.conan/data/test/1.2.3/_/_/export
test/1.2.3: Using the exported files summary hash as the recipe revision: fb4654606f8a8663d725d4ffb122acfa 
test/1.2.3: Package recipe modified in export, forcing source folder removal
test/1.2.3: Use the --keep-source, -k option to skip it
test/1.2.3: Removing the local binary packages from different recipe revisions
test/1.2.3: Exported revision: fb4654606f8a8663d725d4ffb122acfa
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=10
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

test/1.2.3: Forced build from source
Installing package: test/1.2.3
Requirements
    test/1.2.3 from local cache - Cache
Packages
    test/1.2.3:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Build

Installing (downloading, building) binaries...
test/1.2.3: Configuring sources in /home/jenkins/.conan/data/test/1.2.3/_/_/source
test/1.2.3: Copying sources to build folder
test/1.2.3: Building your package in /home/jenkins/.conan/data/test/1.2.3/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
test/1.2.3: Generator txt created conanbuildinfo.txt
test/1.2.3: Calling generate()
test/1.2.3: generate sf: /home/jenkins/.conan/data/test/1.2.3/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
test/1.2.3: generate bf: /home/jenkins/.conan/data/test/1.2.3/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
test/1.2.3: Aggregating env generators
test/1.2.3: Calling build()
test/1.2.3: WARN: This conanfile has no build step
test/1.2.3: Package '5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9' built
test/1.2.3: Build folder /home/jenkins/.conan/data/test/1.2.3/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
test/1.2.3: Generated conaninfo.txt
test/1.2.3: Generated conanbuildinfo.txt
test/1.2.3: Generating the package
test/1.2.3: Package folder /home/jenkins/.conan/data/test/1.2.3/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
test/1.2.3: Calling package()
test/1.2.3: WARN: This conanfile has no package step
test/1.2.3 package(): WARN: No files in this package!
test/1.2.3: Package '5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9' created
test/1.2.3: Created package revision 8b2b6f3200edc3d5cdc4faf769914f3b
@memsharded
Copy link
Member

Hi @pasrom

You would need to define the layout() method. Something like:

 def layout(self):
      self.folders.source = "."
      self.folders.build = "build"

It also had a bug, only the source folder was being computed, so I have submitted #10567 to fixe build_folder for next release 1.46. Thanks for reporting!

@memsharded memsharded added this to the 1.46 milestone Feb 14, 2022
@pasrom
Copy link
Author

pasrom commented Feb 14, 2022

Thank you for your quick response.

@memsharded
Copy link
Member

#10567 merged, this will be in 1.46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants