Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Merge branch 'master' into cfg-subcommand

Aathish114e676da448
diff --cc manim/utils/file_ops.py
index 008cf7686,5459ee4ba..186756821
--- a/manim/utils/file_ops.py
+++ b/manim/utils/file_ops.py
@@@ -59,19 -58,3 +60,19 @@@ def get_sorted_integer_files
os.remove(full_path)
indexed_files.sort(key=lambda p: p[0])
return list(map(lambda p: os.path.join(directory, p[1]), indexed_files))
+
+def open_file(file_path):
+ current_os = platform.system()
+ if current_os == "Windows":
+ os.startfile(file_path)
+ else:
+ if current_os == "Linux":
+ commands = ["xdg-open"]
+ elif current_os.startswith("CYGWIN"):
+ commands = ["cygstart"]
+ elif current_os == "Darwin":
+ commands = ["open"]
+ else:
+ raise OSError("Unable to identify your operating system...")
+ commands.append(file_path)
- sp.Popen(commands)
++ sp.Popen(commands)
diff --cc tests/test_cli/test_cli.py
index 11a7e7c63,ab350c841..b93c1fa88
--- a/tests/test_cli/test_cli.py
+++ b/tests/test_cli/test_cli.py
@@@ -49,10 -71,10 +74,11 @@@ def test_dash_as_name(python_version)
path_output = os.path.join("tests_cache", "media_temp")
command = [python_version, "-m", "manim", "-", "-l", "--media_dir", path_output]
out, err, exitcode = capture(
- command, open(os.path.join(os.path.dirname(__file__), "dash_test_script.txt"))
- )
+ command,
+ instream = open(os.path.join(os.path.dirname(__file__), "dash_test_script.txt"))
+ )
assert exitcode == 0, err
- assert os.path.exists(os.path.join(
- path_output, "videos", "-", "480p15", "DashAsNameTest.mp4")), err
+ assert os.path.exists(
+ os.path.join(path_output, "videos", "-", "480p15", "DashAsNameTest.mp4")
+ ), err
rmtree(path_output)