Skip to content

Commit 7b9effa

Browse files
author
Sylvain MARIE
committed
0.5.5 - Own __version__ was incorrect, should be fixed now. Fixes #4
1 parent 67b6cbd commit 7b9effa

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### 0.5.5 - Own `__version__` was incorrect
4+
5+
Fixed [#4](https://github.com/smarie/python-getversion/issues/4).
6+
37
### 0.5.4 - Fixed bug in case of package both installed and in the path
48

59
Fixed bug (incorrect version number) happening when a package is both installed and available on python path. This typically happens when a developer is working on a new version of a package while an older version is already installed. Fixes [#3](https://github.com/smarie/python-getversion/issues/3).

docs/index.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,19 @@ If your project uses git, I would recommend the following:
131131

132132
try:
133133
# import version from _version.py generated by setuptools_scm
134-
from _version import version
135-
__version__ = version
136-
del version
134+
from <pkgname>._version import version as _v
135+
__version__ = _v
137136
except ImportError:
138137
# use setuptools_scm to get the current version using git
139-
from setuptools_scm import get_version
140-
from os.path import join, pardir, dirname
141-
__version__ = get_version(join(dirname(__file__), pardir))
138+
from setuptools_scm import get_version as _gv
139+
from os import path as _path
140+
__version__ = _gv(_path.join(_path.dirname(__file__), _path.pardir))
142141

143142
* then, EITHER in `setup.py`:
144143

145144
setup(
146145
...
147-
use_scm_version={'write_to': '%s/_version.py' % DISTNAME}
146+
use_scm_version={'write_to': '%s/_version.py' % <pkgname>}
148147
)
149148

150149
* OR when you wish to create releases, after git-tagging your project and before publishing it, do

getversion/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66

77
try:
88
# import version from _version.py generated by setuptools_scm
9-
from _version import version
10-
__version__ = version
11-
del version
9+
from getversion._version import version as _v
10+
__version__ = _v
1211
except ImportError:
1312
# use setuptools_scm to get the current version using git
1413
# we do not use this because our tests rely on the fact that this is NOT done correctly :)
15-
# from setuptools_scm import get_version
16-
# from os.path import join, pardir, dirname
17-
# __version__ = get_version(join(dirname(__file__), pardir))
14+
# from setuptools_scm import get_version as _gv
15+
# from os import path as _path
16+
# __version__ = _gv(_path.join(_path.dirname(__file__), _path.pardir))
1817
pass
1918

2019
__all__ = [

0 commit comments

Comments
 (0)