doomcc/dcc/fabricate.py

32 lines
1,016 B
Python
Raw Permalink Normal View History

import contextlib
import dcc.config
import dcc.doom_base
import shutil
import subprocess
import tempfile
2025-06-15 02:16:59 -04:00
class Fabricate(dcc.doom_base.WadMap):
2025-06-15 02:16:59 -04:00
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
parser.add_argument("--fg", action="store_true")
return parser
2025-06-15 02:16:59 -04:00
def take_action(self, parsed_args):
with tempfile.TemporaryDirectory() as td:
with contextlib.chdir(td):
command = [self.dsda]
if not parsed_args.fg and shutil.which("xvfb-run") is not None:
command = ["xvfb-run"] + command
subprocess.run(
command + self.dsda_preamble()
2025-06-15 02:16:59 -04:00
+ ["-timedemo", self.demo_in_path()]
+ ["-viddump", self.video_path()]
)
def options_dict(self):
opt_dict = super().options_dict()
for k, v in self._config.get("fabricate_options", {}).items():
opt_dict[k] = v
return opt_dict