doomcc/dcc/fabricate.py

23 lines
669 B
Python
Raw Normal View History

import contextlib
import dcc.config
import dcc.doom_base
import shutil
import subprocess
import tempfile
class Fabricate(dcc.doom_base.WadMap):
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
parser.add_argument("--fg", action="store_true")
return parser
def take_action(self, parsed_args):
with tempfile.TemporaryDirectory() as td:
with contextlib.chdir(td):
command = [dcc.config.DSDA]
if not parsed_args.fg and shutil.which("xvfb-run") is not None:
command = ["xvfb-run"] + command
subprocess.run(command + self.dsda_preamble() +
["-timedemo", self.demo_in_path()] +
["-viddump", self.video_path()])