replaced usage of run_subprocess in code

This commit is contained in:
iLLiCiTiT 2020-12-22 17:13:24 +01:00
parent 7c11ca59cf
commit 2acb4d52c0
11 changed files with 29 additions and 22 deletions

View file

@ -1,7 +1,7 @@
from pype.lib import (
PreLaunchHook,
ApplicationLaunchFailed,
_subprocess
run_subprocess
)
@ -25,7 +25,7 @@ class PreInstallPyWin(PreLaunchHook):
return
try:
output = _subprocess(
output = run_subprocess(
["pip", "install", "pywin32==227"]
)
self.log.debug("Pip install pywin32 output:\n{}'".format(output))

View file

@ -264,7 +264,9 @@ class ExtractBurnin(pype.api.Extractor):
self.log.debug("Executing: {}".format(subprcs_cmd))
# Run burnin script
pype.api.subprocess(subprcs_cmd, shell=True, logger=self.log)
pype.api.run_subprocess(
subprcs_cmd, shell=True, logger=self.log
)
# Remove the temporary json
os.remove(temporary_json_filepath)

View file

@ -107,7 +107,9 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin):
# run subprocess
self.log.debug("{}".format(subprocess_jpeg))
try: # temporary until oiiotool is supported cross platform
pype.api.subprocess(subprocess_jpeg, shell=True)
pype.api.run_subprocess(
subprocess_jpeg, shell=True, logger=self.log
)
except RuntimeError as exp:
if "Compression" in str(exp):
self.log.debug("Unsupported compression on input files. " +

View file

@ -206,7 +206,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
# run subprocess
self.log.debug("Executing: {}".format(subprcs_cmd))
pype.api.subprocess(
pype.api.run_subprocess(
subprcs_cmd, shell=True, logger=self.log
)
@ -1628,8 +1628,9 @@ class ExtractReview(pyblish.api.InstancePlugin):
# run subprocess
self.log.debug("Executing: {}".format(subprcs_cmd))
output = pype.api.subprocess(subprcs_cmd, shell=True)
self.log.debug("Output: {}".format(output))
output = pype.api.run_subprocess(
subprcs_cmd, shell=True, logger=self.log
)
# create representation data
repre_new.update({

View file

@ -186,8 +186,9 @@ class ExtractReviewSlate(pype.api.Extractor):
# run slate generation subprocess
self.log.debug("Slate Executing: {}".format(slate_subprcs_cmd))
slate_output = pype.api.subprocess(slate_subprcs_cmd, shell=True)
self.log.debug("Slate Output: {}".format(slate_output))
slate_output = pype.api.run_subprocess(
slate_subprcs_cmd, shell=True, logger=self.log
)
# create ffmpeg concat text file path
conc_text_file = input_file.replace(ext, "") + "_concat" + ".txt"
@ -221,8 +222,9 @@ class ExtractReviewSlate(pype.api.Extractor):
# ffmpeg concat subprocess
self.log.debug("Executing concat: {}".format(concat_subprcs_cmd))
concat_output = pype.api.subprocess(concat_subprcs_cmd, shell=True)
self.log.debug("Output concat: {}".format(concat_output))
concat_output = pype.api.run_subprocess(
concat_subprcs_cmd, shell=True, logger=self.log
)
self.log.debug("__ repre[tags]: {}".format(repre["tags"]))
repre_update = {

View file

@ -65,7 +65,7 @@ class ExtractScanlineExr(pyblish.api.InstancePlugin):
subprocess_exr = " ".join(oiio_cmd)
self.log.info(f"running: {subprocess_exr}")
pype.api.subprocess(subprocess_exr)
pype.api.run_subprocess(subprocess_exr, logger=self.log)
# raise error if there is no ouptput
if not os.path.exists(os.path.join(stagingdir, original_name)):

View file

@ -142,7 +142,7 @@ class ExtractReviewCutUp(pype.api.Extractor):
).format(**locals())
self.log.debug("ffprob_cmd: {}".format(ffprob_cmd))
audio_check_output = pype.api.subprocess(ffprob_cmd)
audio_check_output = pype.api.run_subprocess(ffprob_cmd)
self.log.debug(
"audio_check_output: {}".format(audio_check_output))
@ -177,7 +177,7 @@ class ExtractReviewCutUp(pype.api.Extractor):
# try to get video native resolution data
try:
resolution_output = pype.api.subprocess((
resolution_output = pype.api.run_subprocess((
"\"{ffprobe_path}\" -i \"{full_input_path}\""
" -v error "
"-select_streams v:0 -show_entries "
@ -290,8 +290,7 @@ class ExtractReviewCutUp(pype.api.Extractor):
# run subprocess
self.log.debug("Executing: {}".format(subprcs_cmd))
output = pype.api.subprocess(subprcs_cmd)
self.log.debug("Output: {}".format(output))
pype.api.run_subprocess(subprcs_cmd, logger=self.log)
repre_new = {
"files": new_files,

View file

@ -60,7 +60,7 @@ class ExtractReview(pype.api.Extractor):
"-vframes", "1",
thumbnail_path
]
output = pype.lib._subprocess(args)
output = pype.lib.run_subprocess(args)
instance.data["representations"].append({
"name": "thumbnail",
@ -78,7 +78,7 @@ class ExtractReview(pype.api.Extractor):
"-vframes", "1",
mov_path
]
output = pype.lib._subprocess(args)
output = pype.lib.run_subprocess(args)
self.log.debug(output)
instance.data["representations"].append({
"name": "mov",

View file

@ -35,7 +35,7 @@ class OTIO_View(pyblish.api.Action):
file_path = os.path.join(
representation["stagingDir"], representation["files"]
)
plib._subprocess(["otioview", file_path])
plib.run_subprocess(["otioview", file_path])
class CollectEditorial(pyblish.api.InstancePlugin):

View file

@ -80,8 +80,9 @@ class ExtractTrimVideoAudio(pype.api.Extractor):
self.log.info(f"Processing: {args}")
ffmpeg_args = " ".join(args)
output = pype.api.subprocess(ffmpeg_args, shell=True)
self.log.info(output)
pype.api.run_subprocess(
ffmpeg_args, shell=True, logger=self.log
)
repr = {
"name": ext[1:],

View file

@ -29,7 +29,7 @@ def test_backward_compatibility(printer):
from pype.hosts.fusion.lib import switch_item
from pype.lib import source_hash
from pype.lib import _subprocess
from pype.lib import run_subprocess
except ImportError as e:
raise