conan-io / examples

Conan 1.x examples
MIT License
124 stars 66 forks source link

Scripts to run the examples should not modify the cache #30

Closed jgsogo closed 4 years ago

jgsogo commented 5 years ago

The examples are run using scripts like build.py, build.bat or build.sh, these scripts are inside the folder where the example is contained and users may run them to check that example works in their machine. Taken into account this, examples can't modify the user cache (they may install packages but configuration files, remotes,... everything should be the same before and after).

Not covered in this PR: metadata of references, we don't want an example to change the remote associated with a reference or package.

closes #28

uilianries commented 5 years ago

I know it's a draft, but the idea sounds good :+1:

jgsogo commented 5 years ago

It was a draft, but from my POV is ready to merge, right?

danimtb commented 5 years ago

I think it makes sense and it is safe to merge

jgsogo commented 5 years ago

My only concern is the subprocess.call(['conan', 'install', 'zlib/1.2.11@conan/stable'], env=env) line, I would love to remove it, but I need to initialize the settings.yml, remotes.json, profile-default,... all those files that are automagically created if they are not already there. If anyone thinks about an alternative, please, say, it would be needed.

uilianries commented 5 years ago

is possible using some wrong reference? you could try:

try:
    subprocess.call(['conan', 'install', 'foobar/0.1.0@conan/stable'], env=env)
except:
    pass
danimtb commented 5 years ago

What about just conan profile new default --detect? I think it initializes everything additionally to creating the default profile

jgsogo commented 5 years ago

Suggestion by @uilianries, works. If I just run conan profile. ... it doesn't initialize the remotes :/

uilianries commented 5 years ago

It looks nice, ready to go IMO