Coverage for jbank/management/commands/xmlsec1_examples.py: 0%

19 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-27 13:36 +0700

1import os 

2import subprocess 

3from django.core.management.base import CommandParser 

4from jutil.command import SafeCommand 

5import jbank 

6 

7 

8class Command(SafeCommand): 

9 help = "Compiles xmlsec1-examples" 

10 

11 def add_arguments(self, parser: CommandParser): 

12 parser.add_argument("--clean", action="store_true") 

13 parser.add_argument("--clean-only", action="store_true") 

14 

15 def do(self, *args, **options): 

16 package_path = os.path.dirname(jbank.__file__) 

17 xmlsec1_examples_path = os.path.join(package_path, "xmlsec1-examples") 

18 print("xmlsec1-examples @ {}".format(xmlsec1_examples_path)) 

19 os.chdir(xmlsec1_examples_path) 

20 if options["clean"] or options["clean_only"]: 

21 subprocess.run(["make", "clean"], check=True) 

22 if not options["clean_only"]: 

23 subprocess.run(["make"], check=True)