Skip to content

Evaluate always SCM attribute before exporting the recipe #4088

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

Merged
merged 5 commits into from
Dec 18, 2018

Conversation

jgsogo
Copy link
Contributor

@jgsogo jgsogo commented Dec 7, 2018

Changelog: Fix: Evaluate always SCM attribute before exporting the recipe
Docs: conan-io/docs#981

--- Edited by @lasote ---


If the SCM attributes rely on data/status of the working copy we need to evaluate the SCM attributes there. It happens with the auto keywords, but it can happen with many other functions:

  • every function that needs to run a CVS (this is the test I have added)
  • a function that makes use of imported python from a file that belongs to the repo
  • ...

All those data/status won't be available in the exported folder of the cache.

@ghost ghost assigned jgsogo Dec 7, 2018
@ghost ghost added the stage: review label Dec 7, 2018
Copy link
Member

@danimtb danimtb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would need a further explanation about these changes

Copy link
Contributor

@lasote lasote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see if it works with python_requires (or clarify that it doesn't). Also, we have to document this with an example in the docs.

@ghost ghost assigned memsharded Dec 18, 2018
@memsharded memsharded merged commit 3abd192 into conan-io:develop Dec 18, 2018
Copy link
Contributor Author

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about these comments, @memsharded?


def get_commit():
here = os.path.dirname(__file__)
here = os.getcwd()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not exactly the same... as a test (someone can look at it as an example) I prefer the previous behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With __file__ it fails. The file of the python require is located in a different place than the repo

content = load(exported_conanfile)
self.assertIn(commit, content)
# Check that everything works and is usable
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I will remove these lines because they are related to python_requires machinery, not to the replacement of the SCM information. I know it is the reason why my previous test was wrong, but now that it is ok these lines are only adding more time to the test suite. If not, can they be conditionally included to the slow attribute tag?

@ghost ghost removed the stage: review label Dec 18, 2018
@jgsogo
Copy link
Contributor Author

jgsogo commented Dec 18, 2018

@lasote, do you think we need to write an example using this? I don't think so, it is expected behavior, just the combination of py_req and the early resolution of SCM

@jgsogo
Copy link
Contributor Author

jgsogo commented Dec 19, 2018

Updated with a link to the docs

grisumbras pushed a commit to grisumbras/conan that referenced this pull request Dec 27, 2018
Evaluate always SCM attribute before exporting the recipe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SCM] [SVN] auto feature behavior depends on how user has checked out local working copy [scm] Expressions not expanded when "auto" mode
4 participants