Skip to content

Commit c1a575f

Browse files
authored
Merge b48dbdc into e7ecce0
2 parents e7ecce0 + b48dbdc commit c1a575f

File tree

528 files changed

+40888
-30803
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

528 files changed

+40888
-30803
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ e6a639bfe237ff7f98c4cbec2094a34ac4b879db
1111
# Lint the repository with Ruff
1212
d3ce6b8879b14464058d5eaf3f914f803e8f22ac
1313
8bdfbc2e8da78945e20c3b203b39b9a81227d596
14+
d7b29daceb98e717aeb4828eb9e71e34e9e33b5e
15+
55fb00ad342b0cd4b0a8913cfc75e0ea61b28100
16+
b31c94cf5856832f2fff2c6270e1d5e44c9cd6af

appveyor/crowdinSync.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020

2121

2222
def request(
23-
path: str,
24-
method=requests.get,
25-
headers: dict[str, str] | None = None,
26-
**kwargs
23+
path: str,
24+
method=requests.get,
25+
headers: dict[str, str] | None = None,
26+
**kwargs,
2727
) -> requests.Response:
2828
if headers is None:
2929
headers = {}
3030
headers["Authorization"] = f"Bearer {AUTH_TOKEN}"
3131
r = method(
3232
f"https://api.crowdin.com/api/v2/{path}",
3333
headers=headers,
34-
**kwargs
34+
**kwargs,
3535
)
3636
# Convert errors to exceptions, but print the response before raising.
3737
try:
@@ -54,27 +54,27 @@ def uploadSourceFile(crowdinFileID: int, localFilePath: str) -> None:
5454
"storages",
5555
method=requests.post,
5656
headers={"Crowdin-API-FileName": fn},
57-
data=f
57+
data=f,
5858
)
5959
storageID = r.json()["data"]["id"]
6060
print(f"Updating file {crowdinFileID} on Crowdin with storage ID {storageID}")
6161
r = projectRequest(
6262
f"files/{crowdinFileID}",
6363
method=requests.put,
64-
json={"storageId": storageID}
64+
json={"storageId": storageID},
6565
)
6666
revisionId = r.json()["data"]["revisionId"]
6767
print(f"Updated to revision {revisionId}")
6868

6969

7070
def main():
7171
parser = argparse.ArgumentParser(
72-
description="Syncs translations with Crowdin."
72+
description="Syncs translations with Crowdin.",
7373
)
7474
commands = parser.add_subparsers(dest="command", required=True)
7575
uploadCommand = commands.add_parser(
7676
"uploadSourceFile",
77-
help="Upload a source file to Crowdin."
77+
help="Upload a source file to Crowdin.",
7878
)
7979
uploadCommand.add_argument("crowdinFileID", type=int, help="The Crowdin file ID.")
8080
uploadCommand.add_argument("localFilePath", help="The path to the local file.")

appveyor/mozillaSyms.py

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
NVDA_LIB = os.path.join(NVDA_SOURCE, "lib")
1919
NVDA_LIB64 = os.path.join(NVDA_SOURCE, "lib64")
2020
ZIP_FILE = os.path.join(SCRIPT_DIR, "mozillaSyms.zip")
21-
URL = 'https://symbols.mozilla.org/upload/'
21+
URL = "https://symbols.mozilla.org/upload/"
2222

2323
# The dlls for which symbols are to be uploaded to Mozilla.
2424
# This only needs to include dlls injected into Mozilla products.
@@ -27,56 +27,64 @@
2727
"ISimpleDOM.dll",
2828
"nvdaHelperRemote.dll",
2929
]
30-
DLL_FILES = [f
30+
DLL_FILES = [
31+
f
3132
for dll in DLL_NAMES
3233
# We need both the 32 bit and 64 bit symbols.
33-
for f in (os.path.join(NVDA_LIB, dll), os.path.join(NVDA_LIB64, dll))]
34+
for f in (os.path.join(NVDA_LIB, dll), os.path.join(NVDA_LIB64, dll))
35+
]
36+
3437

3538
class ProcError(Exception):
3639
def __init__(self, returncode, stderr):
3740
self.returncode = returncode
3841
self.stderr = stderr
3942

43+
4044
def check_output(command):
41-
proc = subprocess.Popen(command,
45+
proc = subprocess.Popen(
46+
command,
4247
stdout=subprocess.PIPE,
4348
stderr=subprocess.PIPE,
44-
text=True)
49+
text=True,
50+
)
4551
stdout, stderr = proc.communicate()
4652
if proc.returncode != 0:
4753
raise ProcError(proc.returncode, stderr)
4854
return stdout
4955

56+
5057
def processFile(path):
51-
print("dump_syms %s"%path)
58+
print("dump_syms %s" % path)
5259
try:
5360
stdout = check_output([DUMP_SYMS, path])
5461
except ProcError as e:
5562
print('Error: running "%s %s": %s' % (DUMP_SYMS, path, e.stderr))
5663
return None, None, None
57-
bits = stdout.splitlines()[0].split(' ', 4)
64+
bits = stdout.splitlines()[0].split(" ", 4)
5865
if len(bits) != 5:
5966
return None, None, None
6067
_, platform, cpu_arch, debug_id, debug_file = bits
6168
# debug_file will have a .pdb extension; e.g. nvdaHelperRemote.dll.pdb.
6269
# The output file format should have a .sym extension instead.
6370
# Strip .pdb and add .sym.
64-
sym_file = debug_file[:-4] + '.sym'
71+
sym_file = debug_file[:-4] + ".sym"
6572
filename = os.path.join(debug_file, debug_id, sym_file)
6673
debug_filename = os.path.join(debug_file, debug_id, debug_file)
6774
return filename, stdout, debug_filename
6875

76+
6977
def generate():
7078
count = 0
71-
with zipfile.ZipFile(ZIP_FILE, 'w', zipfile.ZIP_DEFLATED) as zf:
79+
with zipfile.ZipFile(ZIP_FILE, "w", zipfile.ZIP_DEFLATED) as zf:
7280
for f in DLL_FILES:
7381
filename, contents, debug_filename = processFile(f)
7482
if not (filename and contents):
75-
print('Error dumping symbols')
83+
print("Error dumping symbols")
7684
raise RuntimeError
7785
zf.writestr(filename, contents)
7886
count += 1
79-
print('Added %d files to %s' % (count, ZIP_FILE))
87+
print("Added %d files to %s" % (count, ZIP_FILE))
8088

8189

8290
def upload():
@@ -85,37 +93,36 @@ def upload():
8593
if i > 0:
8694
print("Sleeping for 15 seconds before next attempt.")
8795
import time
96+
8897
time.sleep(15)
8998
try:
9099
r = requests.post(
91100
URL,
92-
files={'symbols.zip': open(ZIP_FILE, 'rb')},
93-
headers={'Auth-Token': os.getenv('mozillaSymsAuthToken')},
94-
allow_redirects=False
101+
files={"symbols.zip": open(ZIP_FILE, "rb")},
102+
headers={"Auth-Token": os.getenv("mozillaSymsAuthToken")},
103+
allow_redirects=False,
95104
)
96105
break # success
97106
except Exception as e:
98107
print(f"Attempt {i + 1} failed: {e!r}")
99108
errors.append(repr(e))
100109
else: # no break in for loop
101-
allErrors = "\n".join(
102-
f"Attempt {index + 1} error: \n{e}"
103-
for index, e in enumerate(errors)
104-
)
110+
allErrors = "\n".join(f"Attempt {index + 1} error: \n{e}" for index, e in enumerate(errors))
105111
raise RuntimeError(allErrors)
106112

107113
if 200 <= r.status_code < 300:
108-
print('Uploaded successfully!')
114+
print("Uploaded successfully!")
109115
elif r.status_code < 400:
110-
print('Error: bad auth token? (%d)' % r.status_code)
116+
print("Error: bad auth token? (%d)" % r.status_code)
111117
raise RuntimeError
112118
else:
113-
print('Error: %d' % r.status_code)
119+
print("Error: %d" % r.status_code)
114120
print(r.text)
115121
raise RuntimeError
116122
return 0
117123

118-
if __name__ == '__main__':
124+
125+
if __name__ == "__main__":
119126
try:
120127
generate()
121128
upload()

appx/sconscript

Lines changed: 75 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,118 @@
11
###
2-
#This file is a part of the NVDA project.
3-
#URL: https://www.nvaccess.org/
4-
#Copyright 2018-2019 NV Access Limited
5-
#This program is free software: you can redistribute it and/or modify
6-
#it under the terms of the GNU General Public License version 2.0, as published by
7-
#the Free Software Foundation.
8-
#This program is distributed in the hope that it will be useful,
9-
#but WITHOUT ANY WARRANTY; without even the implied warranty of
10-
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11-
#This license can be found at:
12-
#http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2+
# This file is a part of the NVDA project.
3+
# URL: https://www.nvaccess.org/
4+
# Copyright 2018-2019 NV Access Limited
5+
# This program is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License version 2.0, as published by
7+
# the Free Software Foundation.
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
# This license can be found at:
12+
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
1313
###
1414

1515
import subprocess
1616
import versionInfo
1717
import os
1818

19-
Import([
20-
'env',
21-
'outFilePrefix',
22-
'isStoreSubmission',
23-
])
19+
Import(
20+
[
21+
"env",
22+
"outFilePrefix",
23+
"isStoreSubmission",
24+
]
25+
)
26+
2427

2528
def getCertPublisher(env):
2629
"""
2730
If no signing certificate is provided, then the given publisher is used as is.
2831
If a signing certificate is given, then the publisher is extracted from the certificate.
2932
"""
30-
certFilePath = env.get('certFile')
33+
certFilePath = env.get("certFile")
3134
if not certFilePath:
32-
return env['publisher']
33-
certPassword=env.get('certPassword','')
35+
return env["publisher"]
36+
certPassword = env.get("certPassword", "")
3437
if not os.path.isabs(certFilePath):
3538
# If path is not absolute it is assumed that it is being given relative to the top dir of the repo
36-
repoTopDir = Dir('#').abspath
39+
repoTopDir = Dir("#").abspath
3740
certFilePath = os.path.abspath(os.path.normpath(os.path.join(repoTopDir, certFilePath)))
38-
cmd=['certutil', '-dump', '-p', certPassword, certFilePath]
39-
lines=subprocess.run(cmd,check=True,capture_output=True,text=True).stdout.splitlines()
40-
linePrefix='Subject: '
41+
cmd = ["certutil", "-dump", "-p", certPassword, certFilePath]
42+
lines = subprocess.run(cmd, check=True, capture_output=True, text=True).stdout.splitlines()
43+
linePrefix = "Subject: "
4144
for line in lines:
4245
if line.startswith(linePrefix):
43-
subject=line[len(linePrefix):].rstrip()
46+
subject = line[len(linePrefix) :].rstrip()
4447
return subject
4548

46-
packageName="NVAccessLimited.NVDANonVisualDesktopAccess"
47-
packageVersion="%s.%s.%s.%s"%(versionInfo.version_year,versionInfo.version_major,env['version_build'],0)
49+
50+
packageName = "NVAccessLimited.NVDANonVisualDesktopAccess"
51+
packageVersion = "%s.%s.%s.%s" % (
52+
versionInfo.version_year,
53+
versionInfo.version_major,
54+
env["version_build"],
55+
0,
56+
)
4857
if isStoreSubmission:
49-
packageFileName=outFilePrefix+"_storeSubmission.appx"
58+
packageFileName = outFilePrefix + "_storeSubmission.appx"
5059
# NV Access Limited's Windows Store publisher ID
5160
# It is okay to be here as the only way to submit, validate and sign the package is via the NV Access store account.
52-
packagePublisher="CN=83B1DA31-9B66-442C-88AB-77B4B815E1DE"
53-
packagePublisherDisplayName="NV Access Limited"
54-
productName="NVDA Screen Reader (Windows Store Edition)"
55-
else: # not for submission, just side-loadable
56-
packageFileName=outFilePrefix+"_sideLoadable.appx"
57-
packagePublisher=getCertPublisher(env)
58-
packagePublisherDisplayName=env['publisher']
59-
productName="NVDA Screen Reader (Windows Desktop Bridge Edition)"
61+
packagePublisher = "CN=83B1DA31-9B66-442C-88AB-77B4B815E1DE"
62+
packagePublisherDisplayName = "NV Access Limited"
63+
productName = "NVDA Screen Reader (Windows Store Edition)"
64+
else: # not for submission, just side-loadable
65+
packageFileName = outFilePrefix + "_sideLoadable.appx"
66+
packagePublisher = getCertPublisher(env)
67+
packagePublisherDisplayName = env["publisher"]
68+
productName = "NVDA Screen Reader (Windows Desktop Bridge Edition)"
6069

61-
signExec = env['signExec'] if (bool(env['certFile']) ^ bool(env['apiSigningToken'])) else None
70+
signExec = env["signExec"] if (bool(env["certFile"]) ^ bool(env["apiSigningToken"])) else None
6271

6372

6473
# Files from NVDA's distribution that cannot be included in the appx due to policy or security restrictions
6574
excludedDistFiles = [
66-
'nvda_slave.exe',
67-
'nvda_noUIAccess.exe',
68-
'lib/IAccessible2Proxy.dll',
69-
'lib/ISimpleDOM.dll',
70-
'lib/NVDAHelperRemote.dll',
71-
'lib64/',
72-
'libArm64/',
73-
'uninstall.exe',
75+
"nvda_slave.exe",
76+
"nvda_noUIAccess.exe",
77+
"lib/IAccessible2Proxy.dll",
78+
"lib/ISimpleDOM.dll",
79+
"lib/NVDAHelperRemote.dll",
80+
"lib64/",
81+
"libArm64/",
82+
"uninstall.exe",
7483
]
7584

76-
# Create an appx manifest with version and publisher etc all filled in
77-
manifest=env.Substfile(
85+
# Create an appx manifest with version and publisher etc all filled in
86+
manifest = env.Substfile(
7887
"AppxManifest.xml",
79-
'manifest.xml.subst',
88+
"manifest.xml.subst",
8089
SUBST_DICT={
81-
'%packageName%':packageName,
82-
'%packageVersion%':packageVersion,
83-
'%packagePublisher%':packagePublisher,
84-
'%publisher%':packagePublisherDisplayName,
85-
'%productName%':productName,
86-
'%description%':versionInfo.description,
90+
"%packageName%": packageName,
91+
"%packageVersion%": packageVersion,
92+
"%packagePublisher%": packagePublisher,
93+
"%publisher%": packagePublisherDisplayName,
94+
"%productName%": productName,
95+
"%description%": versionInfo.description,
8796
},
8897
)
89-
# Make a copy of the dist dir produced by py2exe
98+
# Make a copy of the dist dir produced by py2exe
9099
# And also place some extra appx specific images in there
91-
appxContent=env.Command(
92-
target='content',
93-
source=[Dir("#dist"),Dir('#appx/appx_images'),manifest],
100+
appxContent = env.Command(
101+
target="content",
102+
source=[Dir("#dist"), Dir("#appx/appx_images"), manifest],
94103
action=[
95104
Delete("$TARGET"),
96-
Copy("$TARGET","${SOURCES[0]}"),
97-
Copy("${TARGET}\\appx_images","${SOURCES[1]}"),
98-
Copy("${TARGET}\\AppxManifest.xml","${SOURCES[2]}"),
99-
]+[Delete("${TARGET}/%s"%excludeFile) for excludeFile in excludedDistFiles],
105+
Copy("$TARGET", "${SOURCES[0]}"),
106+
Copy("${TARGET}\\appx_images", "${SOURCES[1]}"),
107+
Copy("${TARGET}\\AppxManifest.xml", "${SOURCES[2]}"),
108+
]
109+
+ [Delete("${TARGET}/%s" % excludeFile) for excludeFile in excludedDistFiles],
100110
)
101-
# Ensure that it is always copied as we can't tell if dist changed
111+
# Ensure that it is always copied as we can't tell if dist changed
102112
env.AlwaysBuild(appxContent)
103113
# Package the appx
104-
appx=env.Command(packageFileName,appxContent,"makeappx pack /p $TARGET /d $SOURCE")
114+
appx = env.Command(packageFileName, appxContent, "makeappx pack /p $TARGET /d $SOURCE")
105115
if signExec and not isStoreSubmission:
106-
env.AddPostAction(appx,signExec)
116+
env.AddPostAction(appx, signExec)
107117

108-
Return(['appx'])
118+
Return(["appx"])

0 commit comments

Comments
 (0)