Skip to content

Commit

Permalink
Do not call _get_package_version() on import
Browse files Browse the repository at this point in the history
Hopefully, helps out an xonsh issue on fedora?

xonsh/xonsh#3607
  • Loading branch information
jquast committed Jun 8, 2020
1 parent baa4b75 commit 7918f58
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def main():
"""Setup.py entry point."""
setuptools.setup(
name='wcwidth',
# NOTE: manually manage __version__ in wcwidth/__init__.py !
version=_get_version(
_get_here(os.path.join('wcwidth', 'version.json'))),
description=(
Expand Down
14 changes: 11 additions & 3 deletions wcwidth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@
_bisearch,
list_versions,
_wcmatch_version,
_wcversion_value,
_get_package_version)
_wcversion_value)

# The __all__ attribute defines the items exported from statement,
# 'from wcwidth import *', but also to say, "This is the public API".
__all__ = ('wcwidth', 'wcswidth', 'list_versions')
__version__ = _get_package_version()

# I used to use a _get_package_version() function to use the `pkg_resources'
# module to parse the package version from our version.json file, but this blew
# some folks up, or more particularly, just the `xonsh' shell.
#
# Yikes! I always wanted to like xonsh and tried it many times but issues like
# these always bit me, too, so I can sympathize -- this version is now manually
# kept in sync with version.json to help them out. Shucks, this variable is just
# for legacy, from the days before 'pip freeze' was a thing.
__version__ = '0.2.4'
2 changes: 1 addition & 1 deletion wcwidth/version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tables": ["4.1.0", "5.0.0", "5.1.0", "5.2.0", "6.0.0", "6.1.0", "6.2.0", "6.3.0", "7.0.0", "8.0.0", "9.0.0", "10.0.0", "11.0.0", "12.0.0", "12.1.0", "13.0.0"], "package": "0.2.3", "default": "8.0.0"}
{"tables": ["4.1.0", "5.0.0", "5.1.0", "5.2.0", "6.0.0", "6.1.0", "6.2.0", "6.3.0", "7.0.0", "8.0.0", "9.0.0", "10.0.0", "11.0.0", "12.0.0", "12.1.0", "13.0.0"], "package": "0.2.4", "default": "8.0.0"}

0 comments on commit 7918f58

Please sign in to comment.