6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 06:07:56 +00:00

Fix version information in bundle

`./dist/tutor --version` raises an error:

Traceback (most recent call last):
  File "main", line 4, in <module>
  File "tutor/cli.py", line 21, in main
  File "click/core.py", line 764, in __call__
  File "click/core.py", line 716, in main
  File "click/core.py", line 641, in make_context
  File "click/core.py", line 1089, in parse_args
  File "click/core.py", line 940, in parse_args
  File "click/core.py", line 1477, in handle_parse_result
  File "click/core.py", line 96, in invoke_param_callback
  File "click/decorators.py", line 270, in callback
RuntimeError: Could not determine version
[1659] Failed to execute script main

To address this, we pass the version value directly to click.

This is for issue #156.
This commit is contained in:
Régis Behmo 2019-02-10 18:31:48 +01:00 committed by Régis Behmo
parent 608e686198
commit d65a7a1b38
3 changed files with 8 additions and 2 deletions

View File

@ -7,9 +7,13 @@ here = os.path.abspath(os.path.dirname(__file__))
with io.open(os.path.join(here, "README.rst"), "rt", encoding="utf8") as f: with io.open(os.path.join(here, "README.rst"), "rt", encoding="utf8") as f:
readme = f.read() readme = f.read()
about = {}
with io.open(os.path.join(here, "tutor", "__about__.py"), "rt", encoding="utf-8") as f:
exec(f.read(), about)
setup( setup(
name="tutor-openedx", name="tutor-openedx",
version="3.0.0", version=about["__version__"],
url="http://docs.tutor.overhang.io/", url="http://docs.tutor.overhang.io/",
project_urls={ project_urls={
"Documentation": "https://docs.tutor.overhang.io/", "Documentation": "https://docs.tutor.overhang.io/",

1
tutor/__about__.py Normal file
View File

@ -0,0 +1 @@
__version__ = "3.0.0"

View File

@ -4,6 +4,7 @@ import sys
import click import click
import click_repl import click_repl
from .__about__ import __version__
from .android import android from .android import android
from .config import config from .config import config
from .dev import dev from .dev import dev
@ -24,7 +25,7 @@ def main():
sys.exit(1) sys.exit(1)
@click.group(context_settings={'help_option_names': ['-h', '--help', 'help']}) @click.group(context_settings={'help_option_names': ['-h', '--help', 'help']})
@click.version_option() @click.version_option(version=__version__)
def cli(): def cli():
pass pass