Skip to content

Commit

Permalink
Add a version fallback in case versioneer can't extract the current t…
Browse files Browse the repository at this point in the history
…ag from _version.py.
  • Loading branch information
FormerLurker committed Mar 17, 2020
1 parent f9645c2 commit 9ec8128
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
7 changes: 4 additions & 3 deletions octoprint_octolapse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3710,9 +3710,6 @@ def admin_permission_validator(flask_request):
from ._version import get_versions
__version__ = get_versions()['version']
__git_version__ = get_versions()['full-revisionid']
# work around if zip is downloaded from github and current version does not have a tag.
if __version__ == '0+unknown':
__version__ = __git_version__
del get_versions

__plugin_name__ = "Octolapse"
Expand Down Expand Up @@ -3784,3 +3781,7 @@ def on_finish(self):
self._after_request_callback()



from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
2 changes: 1 addition & 1 deletion octoprint_octolapse/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_config():
cfg.tag_prefix = ""
cfg.parentdir_prefix = ""
cfg.versionfile_source = "octoprint_octolapse/_version.py"
cfg.verbose = True
cfg.verbose = False
return cfg


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ versionfile_source = octoprint_octolapse/_version.py
versionfile_build = octoprint_octolapse/_version.py
tag_prefix =
parentdir_prefix =
verbose = true

11 changes: 10 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@
# The plugin's human readable name. Can be overwritten within OctoPrint's internal data via __plugin_name__ in the
# plugin module
plugin_name = "Octolapse"
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
# The plugin's fallback version, in case versioneer can't extract the version from _version.py.
# This can happen if the user installs from one of the .zip links in github, not generated with git archive
fallback_version = "0.4.0rc1.dev5"
plugin_version = versioneer.get_version()
if plugin_version == "0+unknown":
plugin_version = fallback_version
try:
plugin_version += "+" + versioneer.get_versions()['full-revisionid']
except:
pass

plugin_cmdclass = versioneer.get_cmdclass()
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit 9ec8128

Please sign in to comment.