Skip to content

Commit 3943aaf

Browse files
committed
reformat all, update to pyinstaller v6.9.0
1 parent b98584d commit 3943aaf

15 files changed

+623
-250
lines changed

pbpy/pbbutler.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,26 @@
66
from pbpy import pblog, pbtools, pbunreal
77

88

9-
def publish_build(branch_type, butler_exec_path, publish_stagedir, butler_project, butler_manifest):
9+
def publish_build(
10+
branch_type, butler_exec_path, publish_stagedir, butler_project, butler_manifest
11+
):
1012
# Test if our configuration values exist
1113
if not butler_project or not butler_manifest:
1214
pblog.error("butler was not configured.")
1315
return False
1416

1517
if branch_type == "default":
16-
branch_type = "internal"
18+
branch_type = "internal"
1719

1820
plat = platform.system()
1921
if plat == "Windows":
20-
plat = "win"
22+
plat = "win"
2123
elif plat == "Darwin":
22-
plat = "mac"
24+
plat = "mac"
2325
elif plat == "Linux":
24-
plat = "linux"
26+
plat = "linux"
2527
else:
26-
plat = plat.lower()
28+
plat = plat.lower()
2729

2830
manifest_path = Path(publish_stagedir) / ".itch.toml"
2931

@@ -32,7 +34,16 @@ def publish_build(branch_type, butler_exec_path, publish_stagedir, butler_projec
3234
channel = f"{branch_type}-{plat}"
3335

3436
# Push and Publish the build
35-
proc = pbtools.run([butler_exec_path, "push", publish_stagedir, f"{butler_project}:{channel}", "--userversion", pbunreal.get_project_version()])
37+
proc = pbtools.run(
38+
[
39+
butler_exec_path,
40+
"push",
41+
publish_stagedir,
42+
f"{butler_project}:{channel}",
43+
"--userversion",
44+
pbunreal.get_project_version(),
45+
]
46+
)
3647
result = proc.returncode
3748
manifest_path.unlink()
3849
return result

pbpy/pbconfig.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
user_config = None
1313

14+
1415
def get(key):
1516
if key is None or config is None or config.get(str(key)) is None:
1617
pbtools.error_state(f"Invalid config get request: {key}", hush=True)
@@ -23,7 +24,7 @@ def get(key):
2324

2425
@lru_cache()
2526
def get_user_config_filename():
26-
config_key = 'ci_config' if get("is_ci") else 'user_config'
27+
config_key = "ci_config" if get("is_ci") else "user_config"
2728
return get(config_key)
2829

2930

@@ -35,7 +36,9 @@ def __getitem__(self, key):
3536

3637

3738
class CustomInterpolation(configparser.BasicInterpolation):
38-
def before_get(self, parser, section: str, option: str, value: str, defaults) -> str:
39+
def before_get(
40+
self, parser, section: str, option: str, value: str, defaults
41+
) -> str:
3942
val = super().before_get(parser, section, option, value, defaults)
4043
if get("is_ci"):
4144
return os.getenv(val)
@@ -53,6 +56,7 @@ def get_user_config():
5356
init_user_config()
5457
return user_config
5558

59+
5660
def get_user(section, key, default=None):
5761
return get_user_config().get(section, key, fallback=default)
5862

@@ -64,10 +68,13 @@ def shutdown():
6468
restore_hidden = False
6569
if os.name == "nt" and os.path.exists(user_filename):
6670
import win32api, win32con
71+
6772
attributes = win32api.GetFileAttributes(user_filename)
6873
restore_hidden = attributes & win32con.FILE_ATTRIBUTE_HIDDEN
69-
win32api.SetFileAttributes(user_filename, attributes & ~win32con.FILE_ATTRIBUTE_HIDDEN)
70-
with open(user_filename, 'w') as user_config_file:
74+
win32api.SetFileAttributes(
75+
user_filename, attributes & ~win32con.FILE_ATTRIBUTE_HIDDEN
76+
)
77+
with open(user_filename, "w") as user_config_file:
7178
user_config.write(user_config_file)
7279
if restore_hidden:
7380
win32api.SetFileAttributes(user_filename, attributes)
@@ -95,7 +102,9 @@ def generate_config(config_path, parser_func):
95102
return False
96103

97104
# Add CI information
98-
config["is_ci"] = os.getenv('PBSYNC_CI') is not None or os.getenv('CI') is not None
105+
config["is_ci"] = (
106+
os.getenv("PBSYNC_CI") is not None or os.getenv("CI") is not None
107+
)
99108
config["checksum_file"] = ".checksum"
100109

101110
return True

pbpy/pbdatasync.py

+47-31
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,65 @@
55

66

77
def get_oid(path):
8-
oid_pairs = pbtools.get_combined_output(pbgit.get_lfs_executable(), "ls-files", "-l", "-I", path).splitlines()
9-
for oid_pair in oid_pairs:
10-
oid_pair = oid_pair.split(" * ")
11-
oid = oid_pair[0]
12-
file = oid_pair[1]
13-
yield oid, file
8+
oid_pairs = pbtools.get_combined_output(
9+
pbgit.get_lfs_executable(), "ls-files", "-l", "-I", path
10+
).splitlines()
11+
for oid_pair in oid_pairs:
12+
oid_pair = oid_pair.split(" * ")
13+
oid = oid_pair[0]
14+
file = oid_pair[1]
15+
yield oid, file
1416

1517

1618
def get_remote_file_name(file, oid=None):
17-
if oid is None:
18-
oid = get_oid(file)
19-
file = file.replace(".umap", "")
20-
return f"{file}/{file}_BuiltData_{oid}.uasset"
19+
if oid is None:
20+
oid = get_oid(file)
21+
file = file.replace(".umap", "")
22+
return f"{file}/{file}_BuiltData_{oid}.uasset"
2123

2224

2325
def get_remote_path(file, oid=None):
24-
file_name = get_remote_file_name(file, oid)
25-
gcs_uri = f"{pbunreal.get_ddc_gsuri()}{pbconfig.get('ddc_key')}"
26-
return f"{gcs_uri}/BuiltData/{file_name}"
26+
file_name = get_remote_file_name(file, oid)
27+
gcs_uri = f"{pbunreal.get_ddc_gsuri()}{pbconfig.get('ddc_key')}"
28+
return f"{gcs_uri}/BuiltData/{file_name}"
2729

2830

2931
def get_all_maps():
30-
include_globs = pbconfig.get_user("project", "include", default="Content").split(",")
31-
include_globs = [path.strip() for path in include_globs]
32-
for glob in include_globs:
33-
yield get_oid(f"{glob}/**/*.umap")
32+
include_globs = pbconfig.get_user("project", "include", default="Content").split(
33+
","
34+
)
35+
include_globs = [path.strip() for path in include_globs]
36+
for glob in include_globs:
37+
yield get_oid(f"{glob}/**/*.umap")
3438

3539

3640
def pull_data():
37-
for oid, file in get_all_maps():
38-
remote_file = get_remote_path(file, oid)
39-
data_path = file.replace(".umap", "_BuildData.uasset")
40-
command_runner = pbunreal.init_gcs()
41-
try:
42-
command_runner.RunNamedCommand('rsync', args=["-Cir", remote_file, data_path], collect_analytics=False, skip_update_check=True, parallel_operations=True)
43-
except:
44-
# keep going
45-
pass
41+
for oid, file in get_all_maps():
42+
remote_file = get_remote_path(file, oid)
43+
data_path = file.replace(".umap", "_BuildData.uasset")
44+
command_runner = pbunreal.init_gcs()
45+
try:
46+
command_runner.RunNamedCommand(
47+
"rsync",
48+
args=["-Cir", remote_file, data_path],
49+
collect_analytics=False,
50+
skip_update_check=True,
51+
parallel_operations=True,
52+
)
53+
except:
54+
# keep going
55+
pass
4656

4757

4858
def push_data():
49-
for oid, file in get_all_maps():
50-
remote_file = get_remote_path(file, oid)
51-
data_path = file.replace(".umap", "_BuildData.uasset")
52-
command_runner = pbunreal.init_gcs()
53-
command_runner.RunNamedCommand('rsync', args=["-Cir", data_path, remote_file], collect_analytics=False, skip_update_check=True, parallel_operations=True)
59+
for oid, file in get_all_maps():
60+
remote_file = get_remote_path(file, oid)
61+
data_path = file.replace(".umap", "_BuildData.uasset")
62+
command_runner = pbunreal.init_gcs()
63+
command_runner.RunNamedCommand(
64+
"rsync",
65+
args=["-Cir", data_path, remote_file],
66+
collect_analytics=False,
67+
skip_update_check=True,
68+
parallel_operations=True,
69+
)

pbpy/pbdispatch.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,34 @@
77

88
def publish_build(branch_type, dispath_exec_path, publish_stagedir, dispatch_config):
99
# Test if our configuration values exist
10-
app_id = pbconfig.get_user('dispatch', 'app_id')
10+
app_id = pbconfig.get_user("dispatch", "app_id")
1111
if not app_id or not dispatch_config:
1212
pblog.error("dispatch was not configured.")
1313
return False
1414

1515
if branch_type == "default":
16-
branch_type = "internal"
16+
branch_type = "internal"
1717

1818
branch_id_key = f"{branch_type}_bid"
19-
branch_id = pbconfig.get_user('dispatch', branch_id_key)
19+
branch_id = pbconfig.get_user("dispatch", branch_id_key)
2020
if branch_id is None or branch_id == "":
2121
pblog.error(f"{branch_id_key} was not configured.")
2222
return False
2323

2424
# Push and Publish the build
2525
retry = True
2626
while True:
27-
proc = pbtools.run([dispath_exec_path, "build", "push", branch_id, dispatch_config, publish_stagedir, "-p"])
27+
proc = pbtools.run(
28+
[
29+
dispath_exec_path,
30+
"build",
31+
"push",
32+
branch_id,
33+
dispatch_config,
34+
publish_stagedir,
35+
"-p",
36+
]
37+
)
2838
result = proc.returncode
2939
if result != 0:
3040
if not retry:

pbpy/pbengine.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
from pbpy import pbgit
99
from pbpy import pbuac
1010

11+
1112
def generate_module_changes(old_commitish, new_commitish):
12-
proc = pbtools.run_with_combined_output([
13-
pbgit.get_git_executable(),
14-
"diff",
15-
"--cumulative",
16-
f"{old_commitish}...{new_commitish}"
17-
])
13+
proc = pbtools.run_with_combined_output(
14+
[
15+
pbgit.get_git_executable(),
16+
"diff",
17+
"--cumulative",
18+
f"{old_commitish}...{new_commitish}",
19+
]
20+
)
1821
if proc.returncode != 0:
1922
pbtools.error_state(proc.stdout)
2023
diffs = reversed(proc.stdout.splitlines())
@@ -25,8 +28,5 @@ def generate_module_changes(old_commitish, new_commitish):
2528
folder = diff.split("% ")[1]
2629
folders.add(Path(folder))
2730
module_delta = dict()
28-
with open("modules.delta.json" , "w") as f:
31+
with open("modules.delta.json", "w") as f:
2932
json.dump(module_delta, f)
30-
31-
32-

0 commit comments

Comments
 (0)