Skip to content

Commit

Permalink
add automatic redshift package requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
pedohorse committed Jan 27, 2025
1 parent 5f22d45 commit 01a3436
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 4 deletions.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,27 @@ return \"package.houdini.py%d_%d\" % (sys.version_info.major, sys.version_info.m

length = 0 accel = 0.33333333333333331 0.33333333333333331 expr = "\"~=\" + hou.applicationVersionString()" language = python }
}
channel env_arg_name_2 {
lefttype = extend
righttype = extend
defaultString = \"\"
flags = 0
segment { options = { autoslope ai ao }

length = 0 accel = 0.33333333333333331 0.33333333333333331 expr = "\"package.\" + hou.pwd().node(\"..\").evalParm(\"rs_pkg_name\")" language = python }
}
channel env_arg_val_2 {
lefttype = extend
righttype = extend
defaultString = \"\"
flags = 0
segment { options = { autoslope ai ao }

length = 0 accel = 0.33333333333333331 0.33333333333333331 expr = "if hasattr(hou.session, '_lifeblood__rs_ver_str'):
return '~=' + hou.session._lifeblood__rs_ver_str

return 'error! cannot autodetect'" language = python }
}
channel val_jsn_3 {
lefttype = extend
righttype = extend
Expand Down Expand Up @@ -781,7 +802,7 @@ priority [ 0 locks=0 ] ( [ priority 50 ] )
folder0 [ 0 locks=0 ] ( 0 0 )
attribs [ 0 locks=0 ] ( 6 )
env_resolver_name [ 0 locks=0 ] ( StandardEnvironmentResolver )
env_resolver_args [ 0 locks=0 ] ( 2 )
env_resolver_args [ 0 locks=0 ] ( 3 )
enable_0 [ 0 locks=0 ] ( "on" )
attr_name_0 [ 0 locks=0 ] ( hipfile )
attr_type_0 [ 0 locks=0 ] ( "str" )
Expand All @@ -795,6 +816,8 @@ env_arg_name_0 [ 0 locks=0 autoscope=1 autosel=4294967295 ] ( [ env_arg_name_0 "
env_arg_val_0 [ 0 locks=0 autoscope=1 autosel=4294967295 ] ( [ env_arg_val_0 "" ] )
env_arg_name_1 [ 0 locks=0 autoscope=1 autosel=4294967295 ] ( [ env_arg_name_1 "" ] )
env_arg_val_1 [ 0 locks=0 autoscope=1 autosel=4294967295 ] ( [ env_arg_val_1 "" ] )
env_arg_name_2 [ 0 locks=0 autoscope=1 autosel=4294967295 ] ( [ env_arg_name_2 "" ] )
env_arg_val_2 [ 0 locks=0 autoscope=1 autosel=4294967295 ] ( [ env_arg_val_2 "" ] )
_hidden2 [ 0 locks=0 ] ( 0 )
broadcast_parameters2 [ 0 locks=0 ] ( 0 )
sepparm [ 0 locks=0 ] ( )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
parmtag { "import_source" "op:./lifeblood_submitter" }
parmtag { "import_token" "roppath" }
parmtag { "opfilter" "!!ROP!!" }
parmtag { "oprelative" "." }
parmtag { "script_callback_language" "python" }
}
group {
Expand Down Expand Up @@ -275,6 +276,27 @@

}

group {
name "folder3_1"
label "Redshift Package"

parm {
name "rs_pkg_name"
label "Name"
type string
joinnext
default { "redshift" }
parmtag { "script_callback_language" "python" }
}
parm {
name "rs_pkg_ver"
label "Version"
type string
default { [ "if hasattr(hou.session, '_lifeblood__rs_ver_str'):\n return hou.session._lifeblood__rs_ver_str\n\nreturn 'error! cannot autodetect'" python ] }
parmtag { "script_callback_language" "python" }
}
}

}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
{
"PreFirstCreate/Cursor":{
"type":"intarray",
"value":[10,1]
},
"PreFirstCreate/IsExpr":{
"type":"bool",
"value":false
},
"PreFirstCreate/IsPython":{
"type":"bool",
"value":true
},
"PreFirstCreate/IsScript":{
"type":"bool",
"value":true
},
"PreFirstCreate/Source":{
"type":"string",
"value":""
},
"PythonModule/Cursor":{
"type":"intarray",
"value":[18,48]
"value":[18,1]
},
"PythonModule/IsExpr":{
"type":"bool",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import subprocess
import re

out, _ = subprocess.Popen(['redshiftCmdLine'], stdout=subprocess.PIPE).communicate()

node_type = kwargs['type']
for line in out.splitlines():
m = re.search(r'version (\d+)\.(\d+)(?:\.(\d+))', line.decode())
if m:
hou.session._lifeblood__rs_ver_str = f'{m.group(1)}.{m.group(2)}.{m.group(3) or 0}'
break
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ TypePropertiesOptions TypePropertiesOptions
Help Help
Tools.shelf Tools.shelf
PythonModule PythonModule
PreFirstCreate PreFirstCreate
ExtraFileOptions ExtraFileOptions

0 comments on commit 01a3436

Please sign in to comment.