File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 branches : [ main, master ]
1111
1212 workflow_dispatch :
13+ workflow_call :
1314
1415jobs :
1516 build :
4041 - name : building addon
4142 run : scons && scons pot
4243
43- - uses : actions/upload-artifact@v6
44+ - uses : actions/upload-artifact@v5
4445 with :
4546 name : packaged_addon
4647 path : |
5657 steps :
5758 - uses : actions/checkout@v6
5859 - name : download releases files
59- uses : actions/download-artifact@v7
60+ uses : actions/download-artifact@v6
6061 - name : Display structure of downloaded files
6162 run : ls -R
6263 - name : Calculate sha256
Original file line number Diff line number Diff line change @@ -101,18 +101,18 @@ jobs:
101101
102102 Write-Host "PO not translated → skipping local update"
103103
104- if (Test-Path -PathType Leaf $localPoPath) {
104+ $addonName = "${{ steps.getAddonInfo.outputs.addonId }}"
105+ $crowdinFile = "$addonName.po"
105106
106- Write-Host "Local PO exists → uploading to Crowdin"
107+ if (Test-Path -PathType Leaf $localPoPath) {
107108
108- $tempFile = "$env:TEMP/$addonId-$langCode.po"
109- Copy-Item $localPoPath $tempFile -Force
109+ Write-Host "Uploading local PO to Crowdin (no translations found remotely)"
110110
111- ./l10nUtil.exe uploadTranslationFile $langCode $tempFile -c addon
111+ ./l10nUtil.exe uploadTranslationFile $langCode $crowdinFile $localPoPath -c addon
112112
113113 } else {
114114
115- Write-Host "No local PO → nothing to do (first run or new language) "
115+ Write-Host "Local PO file does not exist → skipping upload "
116116 }
117117 }
118118 }
Original file line number Diff line number Diff line change 1+ # Python-generated files
2+ __pycache__ /
3+ * .py [oc ]
4+ build /
5+ dist /
6+ wheels /
7+ * .egg-info
8+
9+ # Virtual environments
10+ .venv
11+
12+ # Files generated for add-ons
113addon /doc /* .css
214addon /doc /en /
315* _docHandler.py
416* .html
5- manifest.ini
17+ addon /* .ini
18+ addon /locale /* /* .ini
619* .mo
720* .pot
8- * .py [ co ]
21+ * .pyc
922* .nvda-addon
1023.sconsign.dblite
11- /[0-9 ]* . [0-9 ]* . [0-9 ]* .json
24+
25+ # act configuration
26+ .actrc
Original file line number Diff line number Diff line change @@ -76,7 +76,10 @@ repos:
7676 args : [ --fix ]
7777 - id : ruff-format
7878 name : format with ruff
79-
79+ - id : uv-lock
80+ name : Verify uv lock file
81+ # Override python interpreter from .python-versions as that is too strict for pre-commit.ci
82+ args : ["-p3.13"]
8083- repo : local
8184 hooks :
8285
Original file line number Diff line number Diff line change 1+ # Copyright (C) 2020-2025 NV Access Limited, Noelia Ruiz Martínez
2+ # This file may be used under the terms of the GNU General Public License, version 2 or later.
3+ # For more details see: https://www.gnu.org/licenses/gpl-2.0.html
4+
5+ import argparse
6+ import hashlib
7+ import typing
8+
9+ #: The read size for each chunk read from the file, prevents memory overuse with large files.
10+ BLOCK_SIZE = 65536
11+
12+
13+ def sha256_checksum (binaryReadModeFiles : list [typing .BinaryIO ], blockSize : int = BLOCK_SIZE ):
14+ """
15+ :param binaryReadModeFiles: A list of files (mode=='rb'). Calculate its sha256 hash.
16+ :param blockSize: The size of each read.
17+ :return: The Sha256 hex digest.
18+ """
19+ sha256 = hashlib .sha256 ()
20+ for f in binaryReadModeFiles :
21+ with open (f , "rb" ) as file :
22+ assert file .readable () and file .mode == "rb"
23+ for block in iter (lambda : file .read (blockSize ), b"" ):
24+ sha256 .update (block )
25+ return sha256 .hexdigest ()
26+
27+
28+ def main ():
29+ parser = argparse .ArgumentParser ()
30+ parser .add_argument (
31+ type = argparse .FileType ("rb" ),
32+ dest = "file" ,
33+ help = "The NVDA addon (*.nvda-addon) to use when computing the sha256." ,
34+ )
35+ args = parser .parse_args ()
36+ checksum = sha256_checksum (args .file )
37+ print (f"Sha256:\t { checksum } " )
38+
39+
40+ if __name__ == "__main__" :
41+ main ()
You can’t perform that action at this time.
0 commit comments