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

Include git commit hash in version for pre-release #89

Open
workhorsy opened this issue Jan 25, 2018 · 1 comment
Open

Include git commit hash in version for pre-release #89

workhorsy opened this issue Jan 25, 2018 · 1 comment

Comments

@workhorsy
Copy link
Owner

It would be nice to know the exact git checkout that the code originates from. We can do this by including the git commit hash in the py-cpuinfo version.

The cpuinfo version of a release:

CPUINFO_VERSION = (4, 0, 0)

The cpuinfo version before that release:

CPUINFO_VERSION = (4, 0, 0, 'pre-release', git-hash:a630dd823bbc3a640e666bc7a477fd99da8b72cb')

We can use a git pre-commit hook and sed to replace the old hash in the source code:

git rev-parse HEAD

The git hook can be installed like:

#!/bin/sh

cd .git/hooks/
rm -f pre-commit
ln -s ../../bin/pre-commit pre-commit
@workhorsy
Copy link
Owner Author

I need to do more research into this. I think there may be a better, more standard way of doing this.

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

No branches or pull requests

1 participant