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
Add short git revision to 'topaz -v'. #514
Conversation
@@ -186,9 +186,10 @@ def _entry_point(space, argv): | |||
system, _, _, _, cpu = os.uname() | |||
platform = "%s-%s" % (cpu, system.lower()) | |||
engine = "topaz" | |||
git_hash = os.popen("git rev-parse --short HEAD", "r").readline() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't achieve what you're describing as the popen
call is during VM startup rather than being "frozen" at translation time. Perhaps if you move the call to the module namespace and assign it to a const a la (untested):
GIT_REV = os.popen("git rev-parse --short HEAD", "r").readline()
# ... then, in `_entry_point`
description = "%s (ruby-%sp%d) [%s] (git rev %s)" % (engine, version, patchlevel, platform, GIT_REV)
Also, please modify the associated tests (see Travis failure). Thank you! |
Not sure why I was getting the "ValueError: too many values to unpack" errors. I wasn't adding a newline anywhere and the call is to |
Figured it out. Will push a fix :) |
Also, I can't seem to run the tests locally. Every test gives me: I ran the following to install/run tests: /usr/local/share/pypy/pip install -r requirements.txt
/usr/local/share/pypy/py.test |
You need to have a clone of pypy on your PYTHONPATH *. It's somewhere in the docs... I think... 😕
|
A clone of the pypy repo? That's in the docs (in the README.md) but isn't that explicit. Seemed that having the pypy executable satisfied that requirement. |
@@ -275,7 +277,7 @@ def test_ruby_description(self, space, tmpdir, capfd): | |||
self.run(space, tmpdir, "puts RUBY_DESCRIPTION") | |||
out1, err1 = capfd.readouterr() | |||
self.run(space, tmpdir, """ | |||
puts "#{RUBY_ENGINE} (ruby-#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}]" | |||
puts "#{RUBY_ENGINE} (ruby-#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}] (git rev #{GIT_REV})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree - I think the TOPAZ_
prefix is better.
The colors produced by the translate test are MAD trippy. And super fun to watch. |
Fractals rule 🤘 |
Kind of sucks that the tests take 15 minutes to run. |
Translation is what takes so long. You don't need to run that locally, just run pytest and any specs that you're interested in untranslated. Also, you don't need a pypy executable at all, you only need the source tree. |
GIT_REV should be called RUBY_REVISION |
👍 to |
@@ -39,7 +39,7 @@ | |||
"" | |||
]) | |||
COPYRIGHT = "topaz - Copyright (c) Alex Gaynor and individual contributors\n" | |||
|
|||
RUBY_REVISION = os.popen("git rev-parse --short HEAD", "r").readline().rstrip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be named TOPAZ_REVISION
or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's undergone quite a long series of name changes. git_hash ~> GIT_REV ~> TOPAZ_GIT_REV ~> RUBY_REVISION
. Is TOPAZ_REVISION
your final answer? :jeopardy:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mri, Maglev, Rbx, and Jruby all define RUBY_RREVISON
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, then ignore me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rewrite the line as subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).rstrip()
@alex Donezo |
@alex @timfel @meatballhat Reverted the name change, using |
Looks like you're missing your python -m topaz -v -e "puts RUBY_REVISION" |
Add short git revision to 'topaz -v'.
Thank the Lord! That was quite a back-and-forth. Please make sure you close #482 as well! |
@parkr and you thought it was over! 😸 MRI does the revision before the architecture-platform string: ~$ ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin11.4.2] dunno how much we care about encouraging bad behavior around parsing that string, though... |
so you'd rather go with MRI's convention? |
Haha it's just so young that conventions are hard to infer :) |
👍 it's a land of opportunity! |
I'll let @timfel have teh final say, copying the style makes a bit of sense to me though. |
I agree with @alex, lets copy MRI where we can |
I think this just broke RVM installation as it now complains that "this" is not a git repository:
|
is the revision cached at translation time? |
Looks like RVM is running the translation (makes sense) so presumably we'll have to either fake out |
Rvm downloads a binary tarball ball unless you request a HEAD install. The head install does clone the proper git repository, but it may not start the translation from the topaz directory. From the looks of the suvprocess invocation you have to be in the topaz directory to run it, correct? Would a chdir to |
You'll have to be in the topaz directory, assuming it contains the |
Fix for #482. When using topaz, it's easier to submit bugs we encounter when we know how the git revision of topaz.