Skip to content

Commit

Permalink
Use replace instead of rename for Windows compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
aMarcireau committed Apr 28, 2023
1 parent e769ad9 commit 73f2d64
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions charidotella/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def load_parameters(path: pathlib.Path):
def save_parameters(path: pathlib.Path, parameters: dict[str, typing.Any]):
with open(path.with_suffix(".part"), "w", encoding="utf-8") as file:
toml.dump(parameters, file)
path.with_suffix(".part").rename(path)
path.with_suffix(".part").replace(path)

def compare_parameters(a: dict[str, typing.Any], b: dict[str, typing.Any]):
return json.dumps(a, sort_keys=True, separators=(",", ":")) == json.dumps(
Expand Down Expand Up @@ -656,7 +656,7 @@ def run_generators(configuration: dict[str, typing.Any]):
toml.load(configuration_file),
configuration_schema(),
)
utilities.with_suffix(configuration_path, ".part").rename(configuration_path)
utilities.with_suffix(configuration_path, ".part").replace(configuration_path)
sys.exit(0)

if args.command == "run":
Expand Down Expand Up @@ -801,7 +801,7 @@ def run_generators(configuration: dict[str, typing.Any]):
)
utilities.with_suffix(
directory / name / attachment["target"], ".part"
).rename(directory / name / attachment["target"])
).replace(directory / name / attachment["target"])
parameters["attachments"][attachment["target"]] = attachment[
"source"
]
Expand All @@ -827,7 +827,7 @@ def run_generators(configuration: dict[str, typing.Any]):
end,
filter["parameters"],
)
utilities.with_suffix(output_path, ".part").rename(output_path)
utilities.with_suffix(output_path, ".part").replace(output_path)
parameters["filters"][filter_name] = filter["parameters"]
save_parameters(parameters_path, parameters)
else:
Expand Down Expand Up @@ -873,7 +873,7 @@ def run_generators(configuration: dict[str, typing.Any]):
)
input = output
parameters["filters"][filter_name] = filter["parameters"]
utilities.with_suffix(output_path, ".part").rename(output_path)
utilities.with_suffix(output_path, ".part").replace(output_path)
save_parameters(parameters_path, parameters)
for task_name in job["tasks"]:
task = configuration["tasks"][task_name]
Expand All @@ -898,7 +898,7 @@ def run_generators(configuration: dict[str, typing.Any]):
end,
task["parameters"],
)
utilities.with_suffix(task_output_path, ".part").rename(
utilities.with_suffix(task_output_path, ".part").replace(
task_output_path
)
parameters["tasks"][task_name] = task["parameters"]
Expand Down
2 changes: 1 addition & 1 deletion charidotella/tasks/wiggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def run(
shutil.copyfile(path, sorted_frames / f"{output_index:>06d}.ppm")
output_index += 1
for path in reversed(selected_paths[1:-1]):
path.rename(sorted_frames / f"{output_index:>06d}.ppm")
path.replace(sorted_frames / f"{output_index:>06d}.ppm")
output_index += 1
subprocess.run(
[
Expand Down
2 changes: 1 addition & 1 deletion charidotella/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9"
__version__ = "0.10"
2 changes: 1 addition & 1 deletion command_line_tools
Submodule command_line_tools updated 1 files
+3 −3 render.py
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"event_stream",
"jsonschema",
"matplotlib",
"pillow>=9.4",
"pillow>=9.1",
"scipy",
"toml",
],
Expand Down

0 comments on commit 73f2d64

Please sign in to comment.