瀏覽代碼

Merge test (#125)

* Yiddish transliteration via submodules.

* Update checkout workflow.

* Change refs for Yiddish submodules.

* Fix WORKDIR in Dockerfile

* Do not remove yiddish module.

* Manually add yiddish submodules.

* Use git clone instead of submodule.

* Move ext checkout to github actions.

* Chinese numerals (#97)

* WIP Parse Chinese numerals.

* WIP complete number parsing.

* Complete Chinese numerals:

* Use standard table override instead of pre-config hooks.
* Add few test strings.

* Complete numerals:

* Transliterate all numeric examples correctly
* Modify hook return logic for consistency
* WIP partial spacing fix.

* Some cleanup; upgrade docker OS.

* Add dependency for uwsgi.

* Squashed commit of the following: (#98)

commit 30859a52b9cc325c323b414133856d0af3ffc2a6
Author: scossu <stefano@cossu.cc>
Date:   Wed Feb 28 22:17:36 2024 -0500

    Move ext checkout to github actions.

commit 6d8da6df68ac764f90deb15861089095043fd4ba
Author: scossu <stefano@cossu.cc>
Date:   Wed Feb 28 21:45:01 2024 -0500

    Use git clone instead of submodule.

commit ade9da589179870d331b703ff526d7fff33e88bb
Author: scossu <stefano@cossu.cc>
Date:   Wed Feb 28 21:42:45 2024 -0500

    Manually add yiddish submodules.

commit 77cb9ef2959f611d0220cc405e0b584ece71147c
Author: scossu <stefano@cossu.cc>
Date:   Wed Feb 28 21:23:37 2024 -0500

    Do not remove yiddish module.

commit e405b3605dd2629ed5557ccc5fdd5fe8812799ed
Author: scossu <stefano@cossu.cc>
Date:   Wed Feb 28 09:11:41 2024 -0500

    Fix WORKDIR in Dockerfile

commit 95445ba642163e28b94df6736ad6946ad7dc76c0
Author: scossu <stefano@cossu.cc>
Date:   Wed Feb 28 09:07:50 2024 -0500

    Change refs for Yiddish submodules.

commit 208ea095e792195981f644497ccd5fcd55e15c1b
Author: scossu <stefano@cossu.cc>
Date:   Wed Feb 28 08:45:58 2024 -0500

    Update checkout workflow.

* Add debug output to /trans response.

* Split docker files and requirements.

* Add bad request debug handler.

* Adjust CI workflows.

* Fix image name typo.

* Refine triggers.

* Fix typo on test workflow trigger.

* Use JSON in POST body.

* Also use JSON in feedback request; update docs.

* Return json data in 400 debug.

* Update Aksharamukha.

* Add new set of languages; separate pre and post options in Aksharamukha. (#102)

* Add all remaining Devanagari scripts. (#107)

* Add R2S for Kurdish, Persian, Pushto, Urdu, and bidirectional Divehi.

* Add R2S for Kurdish, Persian, Pushto, Urdu, and bidirectional Divehi. (#108)

* Fix YAML syntax errors.

* P3 legacy mappings (#109)

* Add R2S for Kurdish, Persian, Pushto, Urdu, and bidirectional Divehi.

* Fix YAML syntax errors.

* Fix table section for Divehi.

* P3 legacy mappings (#110)

* Add R2S for Kurdish, Persian, Pushto, Urdu, and bidirectional Divehi.

* Fix YAML syntax errors.

* Fix table section for Divehi.

* Fix mapping for Divehi.

* Add Thai from Randy's table

* Fix YAML errors in Thai alt.

* Fix Tamil YAML.

* Fix Malayalam config.

* Fix Greek numerals logic; add test strings.

* Add Malayalam to index.

* Better exception handling.

* Add CORS to all routes.

* Add MARC codes to language index.

* Fix Greek S2R table.

* Tolerate and normalize nested tokens.

* Add Assamese table.

* Fix char index misalignment after ignoring.

* Yiddish (#123)

* Use yiddish package from pypi; add loshn_koydesh override.

* Remove yiddish submodule update from build automation.

* Add lk override path to example.env.

* Fix some CI issues.

* Test CI.

* test.

* Add git fetch --tags.

* Fix syntax.

* Add --always.

* Mirror config updates in push-app-image action.

* Add git info to home page.
Stefano Cossu 9 月之前
父節點
當前提交
ed5877ff00

+ 7 - 1
.github/workflows/push-app-image.yml

@@ -6,7 +6,7 @@ on:
     tags:
       - "v*.*.[1-9]*"
   workflow_run:
-    workflows: 
+    workflows:
       - "Push base image"
     types:
       - "completed"
@@ -25,6 +25,12 @@ jobs:
         with:
           submodules: recursive
 
+      - name: update version info
+        run: |
+          git fetch --tags
+          git describe --tags --always >| VERSION
+          git rev-parse HEAD >> VERSION
+
       - name: Build the Docker image
         run: >
           docker build -f Dockerfile .

+ 6 - 1
.github/workflows/push-test-image.yml

@@ -18,6 +18,12 @@ jobs:
         with:
           submodules: recursive
 
+      - name: update version info
+        run: |
+          git fetch --tags
+          git describe --tags --always >| VERSION
+          git rev-parse HEAD >> VERSION
+
       - name: Build the Docker image
         run: >
           docker build -f Dockerfile .
@@ -32,4 +38,3 @@ jobs:
 
       - name: Push to Docker Hub
         run: docker push $DOCKER_USER/$REPO_NAME:test
-

+ 1 - 0
.gitignore

@@ -138,3 +138,4 @@ tags.temp
 # Local
 ext/arabic_rom/data
 !.keep
+VERSION

+ 1 - 1
Dockerfile

@@ -3,7 +3,7 @@ ARG WORKROOT "/usr/local/scriptshifter/src"
 
 # Copy core application files.
 WORKDIR ${WORKROOT}
-COPY entrypoint.sh uwsgi.ini wsgi.py ./
+COPY entrypoint.sh uwsgi.ini wsgi.py VERSION ./
 COPY scriptshifter ./scriptshifter/
 COPY requirements.txt ./
 RUN pip install --no-cache-dir -r requirements.txt

+ 1 - 3
deps.txt

@@ -1,7 +1,5 @@
-# External dependencies.
-aksharamukha>=2.2,<3
+# Base image dependencies.
 camel-tools>=1.5
 funcy>=1.15,<2
 pymarc>=4.0,<5
 repackage>=0.7.3
-./ext/yiddish

+ 1 - 0
requirements.txt

@@ -1,4 +1,5 @@
 # Core application dependencies.
+aksharamukha>=2.2,<3
 flask>=2.3,<3
 flask-cors>=4.0,<5
 python-dotenv>=1.0,<2

+ 5 - 0
scriptshifter/__init__.py

@@ -18,6 +18,11 @@ The default is None in which causes the feedback form to be disabled.
 """
 SMTP_HOST = environ.get("TXL_SMTP_HOST")
 
+with open(path.join(path.dirname(APP_ROOT), "VERSION")) as fh:
+    version_info = fh.readlines()
+GIT_TAG = version_info[0].strip()
+GIT_COMMIT = version_info[1].strip()
+
 logging.basicConfig(
         # filename=environ.get("TXL_LOGFILE", "/dev/stdout"),
         level=environ.get("TXL_LOGLEVEL", logging.WARN))

+ 5 - 1
scriptshifter/rest_api.py

@@ -10,7 +10,10 @@ from smtplib import SMTP
 from flask import Flask, jsonify, render_template, request
 from flask_cors import CORS
 
-from scriptshifter import EMAIL_FROM, EMAIL_TO, SMTP_HOST, SMTP_PORT
+from scriptshifter import (
+        EMAIL_FROM, EMAIL_TO,
+        GIT_COMMIT, GIT_TAG,
+        SMTP_HOST, SMTP_PORT)
 from scriptshifter.exceptions import ApiError
 from scriptshifter.tables import list_tables, load_table
 from scriptshifter.trans import transliterate
@@ -69,6 +72,7 @@ def index():
     return render_template(
             "index.html",
             languages=list_tables(),
+            version_info=(GIT_TAG, GIT_COMMIT),
             feedback_form=SMTP_HOST is not None)
 
 

+ 4 - 0
scriptshifter/templates/layout.html

@@ -21,5 +21,9 @@
             </div>
           </section>
         </main>
+        <footer>
+            <p>Scriptshifter version: tag {{ version_info[0] }} &mdash;&nbsp;
+            commit # {{ version_info[1] }}</p>
+        </footer>
     </body>
 </html>