mock: Use of pbr breaks cx_freeze applications

The given code:

_v = VersionInfo('mock').semantic_version()
__version__ = _v.release_string()
version_info = _v.version_tuple()

is not really friendly to frozen applications… also, I’d say, it adds a lot of logic under the hood to just to the version (besides adding having a runtime requirement to setuptools, which is usually just a setup time requirement), so, I’d like to check how feasible it’d be to revert it to just coding the __version__ and version_info directly into the source code – also, I’d say it makes it easier to know the current version by looking at the source code and makes the code clearer 😉

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 25 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I’m generally in favor (+1). I don’t use the file-writing feature of setuptools_scm, but if that works for you, I think that approach alleviates a number of my concerns.

I see, thanks. Using setuptools_scm was my initial attempt to contribute to mock to solve this problem, but unfortunately I hit the problem of the version_info public variable and CHANGELOG generation mentioned at the beginning of the issue.

It must be resolved to something, which could perhaps fallback to a constant value like ‘unknown’ in cases where get_version() fails.

Sorry, I meant to use the current methods in a function, like this:

def get_version():
    import pkg_resources
    try:
        return pkg_resources.get_distribution('setuptools').version
    except Exception:
        return 'unknown'

And then users can get the version by calling setuptools.get_version() instead of setuptools.__version__.