Make version extraction more robust

The previous implementation would break if someone put a comment or
docstring in that file.