Skip to content

Commit

Permalink
fix scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
yagebu committed May 30, 2020
1 parent 3d5be63 commit 07d4eb3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions contrib/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

from fava import LOCALES

BASE_PATH = Path(__file__).parent.parent / "fava"
BASE_PATH = Path(__file__).parent.parent
FAVA_PATH = BASE_PATH / "src" / "fava"


@click.group()
Expand Down Expand Up @@ -41,7 +42,7 @@ def generate_bql_grammar_json():
"functions": sorted(set(_env_to_list(target_env.functions))),
"keywords": sorted({kw.lower() for kw in query_parser.Lexer.keywords}),
}
path = BASE_PATH / "static/javascript/codemirror/bql-grammar.ts"
path = BASE_PATH / "frontend" / "src" / "codemirror" / "bql-grammar.ts"
path.write_text("export default " + json.dumps(data))


Expand All @@ -65,7 +66,7 @@ def upload_translations():
raise click.UsageError(
"The POEDITOR_TOKEN environment variable needs to be set."
)
path = BASE_PATH / f"translations/messages.pot"
path = FAVA_PATH / "translations" / "messages.pot"
click.echo(f"Uploading message catalog: {path}")
data = {
"api_token": token,
Expand Down Expand Up @@ -99,10 +100,10 @@ def download_from_poeditor(language, token):
)
url = request.json()["result"]["url"]
content = requests.get(url).content
folder = BASE_PATH / "translations" / language / "LC_MESSAGES"
folder = FAVA_PATH / "translations" / language / "LC_MESSAGES"
if not folder.exists():
folder.mkdir(parents=True)
path = folder / f"messages.po"
path = folder / "messages.po"
path.write_bytes(content)
click.echo(f'Downloaded to "{path}"')

Expand Down

0 comments on commit 07d4eb3

Please sign in to comment.