-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
Fixed the --version command when installed from source #347
Conversation
The command only worked when running it inside the git repository. Now, it works from everywhere, and the version is constructed using the latest git tag and the SHA of the latest commit, which may help with further debugging in future issues.
Changes, look great! Before I merge this, couple of questions.
Snap can be detected by using:
|
I really like this, very nice! 👍 Does this method also work on a release.tar.gz? Tested on 1.9.0 tar.gz and not seems happy.
Changing it to Version will return |
It needs to have a Git repository metadata inside. Since the tar.gz are packaged without the Git repository info, it would not work. A version_callback could be set to get around this. Also, after testing the Snap builds, I think that this approach might not be the best (?). I don't know if the Snap build can be fixed, but if not, another approach should be taken... |
Then, please push these changes, I want to merge this PR and make a new release 🙂
Yea, I thought this would be the case, but we don't need this as we already have a way to get Snap package version. Before I wrote my previous comment, I built a Snap package with your changes and it all worked fine. If you want to try it yourself you can follow instructions I outlined for @bobslept but you can also leave part of testing Snap package to me. I don't have a problem with leaving current version format to be part of Snap package. As this version will have the source code information based on which that Snap was built. Just make sure to incorporate version information you implemented with
As you see in
@bobslept btw, I just made minor change how snap version is outputted in
|
So, I updated the PR as you can see. Let me guide you through the changes and why I took this approach. I updated the way the Now, about Snap. I followed your instructions and could test all the changes (thanks for that!). As you can see, some changes have been made to the On the other hand, getting the Snap package to output the latest Git commit is possible, but I don't think it makes sense. Give me some feedback and let me know if I didn't explain myself well enough. EDIT: Sorry about the force-pushing, wanted to correct the commit title |
Renaming version_config to setuptools_git_versioning to be compliant with new plugin version. Formatted the version when a git hash is present for a better readability. The version is set in the setup.py file. This will be used for the tar.gz releases. Snap version is also retrieved from setup.py too, so we avoid code repetition.
@ariasmn could you please resolve the conflict before I do the final review? Thank you |
@AdnanHodzic Done, let me know if you need something |
@ariasmn LGTM and outstanding work, thank you for your contribution and I hope to see more of your PR in future 🙂 |
Changes are live as part of 1.9.1 release. |
Closes #344
The command only worked when running it inside the git repository.
Now, it works from everywhere, and the version is constructed using the latest git tag and the SHA (8 first symbols) of the latest commit, which may help with further debugging in future issues (since when installing from source you don't install a fixed version).
To do so, I have included this setuptools plugin. The template for the versioning can be changed by modifying the options in
setup.py
, but IMO this is a good approach, since, as I previously said, the version is constructed with the latest Git tag as well as the SHA of the latest commit, which may come in handy for debugging future specific issues.Waiting for your feedback!