mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-12-24 10:06:43 +02:00
Add VERSION
This commit is contained in:
parent
42c44a2ba1
commit
d12c81b773
10
app/app.py
10
app/app.py
@ -5,7 +5,6 @@ import uuid
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
import argostranslatefiles
|
import argostranslatefiles
|
||||||
import pkg_resources
|
|
||||||
from argostranslatefiles import get_supported_formats
|
from argostranslatefiles import get_supported_formats
|
||||||
from flask import Flask, abort, jsonify, render_template, request, url_for, send_file
|
from flask import Flask, abort, jsonify, render_template, request, url_for, send_file
|
||||||
from flask_swagger import swagger
|
from flask_swagger import swagger
|
||||||
@ -19,6 +18,13 @@ from .api_keys import Database
|
|||||||
from .suggestions import Database as SuggestionsDatabase
|
from .suggestions import Database as SuggestionsDatabase
|
||||||
|
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
try:
|
||||||
|
with open("VERSION") as f:
|
||||||
|
return f.read().strip()
|
||||||
|
except:
|
||||||
|
return "?"
|
||||||
|
|
||||||
def get_upload_dir():
|
def get_upload_dir():
|
||||||
upload_dir = os.path.join(tempfile.gettempdir(), "libretranslate-files-translate")
|
upload_dir = os.path.join(tempfile.gettempdir(), "libretranslate-files-translate")
|
||||||
|
|
||||||
@ -200,7 +206,7 @@ def create_app(args):
|
|||||||
frontendTimeout=args.frontend_timeout,
|
frontendTimeout=args.frontend_timeout,
|
||||||
api_keys=args.api_keys,
|
api_keys=args.api_keys,
|
||||||
web_version=os.environ.get("LT_WEB") is not None,
|
web_version=os.environ.get("LT_WEB") is not None,
|
||||||
version=pkg_resources.require("LibreTranslate")[0].version
|
version=get_version()
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/javascript-licenses", methods=["GET"])
|
@app.route("/javascript-licenses", methods=["GET"])
|
||||||
|
2
setup.py
2
setup.py
@ -3,7 +3,7 @@
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
version='1.2.5',
|
version=open('VERSION').read().strip(),
|
||||||
name='libretranslate',
|
name='libretranslate',
|
||||||
license='GNU Affero General Public License v3.0',
|
license='GNU Affero General Public License v3.0',
|
||||||
description='Free and Open Source Machine Translation API. Self-hosted, no limits, no ties to proprietary services.',
|
description='Free and Open Source Machine Translation API. Self-hosted, no limits, no ties to proprietary services.',
|
||||||
|
Loading…
Reference in New Issue
Block a user