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

post-build version numbers #72

Closed
mwiebe opened this issue Mar 19, 2014 · 20 comments
Closed

post-build version numbers #72

mwiebe opened this issue Mar 19, 2014 · 20 comments
Labels
locked [bot] locked due to inactivity

Comments

@mwiebe
Copy link
Contributor

mwiebe commented Mar 19, 2014

For conda build to be useful in a CI setting, where builds are regularly created from a version control branch, the version number needs to be set after the build is finished. Maybe the version tag would be excluded from the build yaml, and a post_build_version tag or similar would be created, which is a script to execute on the built package to request its version number.

post_build_version=python -c 'import dynd;print(dynd.__version__)'
@asmeurer
Copy link
Contributor

Ah, so the version is there before the build, but it's not easy to get at because you can't just import dynd; dynd.__version__?

@mwiebe
Copy link
Contributor Author

mwiebe commented Mar 19, 2014

No, the version isn't there before the build, it gets constructed from a 'git describe' call during the build, and can be retrieved from the package at that point.

@asmeurer
Copy link
Contributor

I see. We should probably allow a similar thing for the build string.

How should we implement it? Maybe some flag that indicates to get the version from some environment variable, which is set in the build script.

@mwiebe
Copy link
Contributor Author

mwiebe commented Mar 19, 2014

Having the build script set it in an environment variable would work well, sure.

@asmeurer
Copy link
Contributor

Thoughts how to do this @ilanschnell?

@ilanschnell
Copy link
Contributor

If the build script sets an environment variable, how can we access it after the build script is finished?

@mwiebe
Copy link
Contributor Author

mwiebe commented Mar 19, 2014

If that's not feasible, I guess a different approach is needed

@ilanschnell
Copy link
Contributor

The build script write a special file, e.g. named __version_build__.txt, into the source directory. If conda-build sees this file after the build script is executed, it adjusts the version and build number accordingly.

@teoliphant
Copy link
Contributor

Why not call it __version__.txt? --- Alternatively the build script or meta.yaml file could specify the name of the file to look for.

Do you always have write access to the source directory? Perhaps we can look for this in the build directory instead?

@ilanschnell
Copy link
Contributor

The source directory is where things get build usually. There is always write access to the source directory, for example when you extract a tarball, you need to be able to write files like config.log, build/, or even apply patches to the source.

@asmeurer
Copy link
Contributor

Actually, one needs the ability to extract the source tarball there in the first place.

@ilanschnell
Copy link
Contributor

Good point, Aaron!

@asmeurer
Copy link
Contributor

What should be placed in the meta.yaml for the version in this case? Nothing? A special placeholder?

@ilanschnell
Copy link
Contributor

I would argue that nothing extra is put into the meta.yaml file. There can even be a version in it, but as soon as the special file is found, it uses that.

@asmeurer
Copy link
Contributor

OK, that is simple enough.

@mwiebe
Copy link
Contributor Author

mwiebe commented Mar 25, 2014

I disagree, I think a special tag should go in the meta.yaml, so that if a bug prevents the version file creation, an error is raised instead of silently producing a junk version.

@ilanschnell
Copy link
Contributor

I just tested this new feature and can verify that it works as expected.

@asmeurer
Copy link
Contributor

I have also updated the docs.

@ilanschnell
Copy link
Contributor

Just as a reference, __conda_version__.txt is the name we decided on.

@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically locked because it has not had recent activity after being closed.

Please open a new issue if needed.

Thanks!

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Apr 27, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

No branches or pull requests

4 participants