mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
b00566bce7
2 changed files with 57 additions and 12 deletions
|
|
@ -9,7 +9,7 @@ class SeedDebugProject(BaseAction):
|
|||
#: Action identifier.
|
||||
identifier = "seed.debug.project"
|
||||
#: Action label.
|
||||
label = "SeedDebugProject"
|
||||
label = "Seed Debug Project"
|
||||
#: Action description.
|
||||
description = "Description"
|
||||
#: priority
|
||||
|
|
@ -265,6 +265,15 @@ class SeedDebugProject(BaseAction):
|
|||
def create_assets(self, project, asset_count):
|
||||
self.log.debug("*** Creating assets:")
|
||||
|
||||
try:
|
||||
asset_count = int(asset_count)
|
||||
except ValueError:
|
||||
asset_count = 0
|
||||
|
||||
if asset_count <= 0:
|
||||
self.log.debug("No assets to create")
|
||||
return
|
||||
|
||||
main_entity = self.session.create("Folder", {
|
||||
"name": "Assets",
|
||||
"parent": project
|
||||
|
|
@ -305,6 +314,31 @@ class SeedDebugProject(BaseAction):
|
|||
|
||||
def create_shots(self, project, seq_count, shots_count):
|
||||
self.log.debug("*** Creating shots:")
|
||||
|
||||
# Convert counts to integers
|
||||
try:
|
||||
seq_count = int(seq_count)
|
||||
except ValueError:
|
||||
seq_count = 0
|
||||
|
||||
try:
|
||||
shots_count = int(shots_count)
|
||||
except ValueError:
|
||||
shots_count = 0
|
||||
|
||||
# Check if both are higher than 0
|
||||
missing = []
|
||||
if seq_count <= 0:
|
||||
missing.append("sequences")
|
||||
|
||||
if shots_count <= 0:
|
||||
missing.append("shots")
|
||||
|
||||
if missing:
|
||||
self.log.debug("No {} to create".format(" and ".join(missing)))
|
||||
return
|
||||
|
||||
# Create Folder "Shots"
|
||||
main_entity = self.session.create("Folder", {
|
||||
"name": "Shots",
|
||||
"parent": project
|
||||
|
|
|
|||
33
pype/lib.py
33
pype/lib.py
|
|
@ -14,24 +14,35 @@ log = logging.getLogger(__name__)
|
|||
|
||||
|
||||
# Special naming case for subprocess since its a built-in method.
|
||||
def _subprocess(args):
|
||||
def _subprocess(*args, **kwargs):
|
||||
"""Convenience method for getting output errors for subprocess."""
|
||||
|
||||
# make sure environment contains only strings
|
||||
env = {k: str(v) for k, v in os.environ.items()}
|
||||
filtered_env = {k: str(v) for k, v in os.environ.items()}
|
||||
|
||||
proc = subprocess.Popen(
|
||||
args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
stdin=subprocess.PIPE,
|
||||
env=env
|
||||
)
|
||||
# set overrides
|
||||
kwargs['stdout'] = kwargs.get('stdout', subprocess.PIPE)
|
||||
kwargs['stderr'] = kwargs.get('stderr', subprocess.STDOUT)
|
||||
kwargs['stdin'] = kwargs.get('stdin', subprocess.PIPE)
|
||||
kwargs['env'] = kwargs.get('env',filtered_env)
|
||||
|
||||
output = proc.communicate()[0]
|
||||
proc = subprocess.Popen(*args, **kwargs)
|
||||
|
||||
output, error = proc.communicate()
|
||||
|
||||
if output:
|
||||
output = output.decode("utf-8")
|
||||
output += "\n"
|
||||
for line in output.strip().split("\n"):
|
||||
log.info(line)
|
||||
|
||||
if error:
|
||||
error = error.decode("utf-8")
|
||||
error += "\n"
|
||||
for line in error.strip().split("\n"):
|
||||
log.error(line)
|
||||
|
||||
if proc.returncode != 0:
|
||||
log.error(output)
|
||||
raise ValueError("\"{}\" was not successful: {}".format(args, output))
|
||||
return output
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue