Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions nimp/unreal.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,18 +561,22 @@ def get_default_args_for_cli(env):
yield f"-DDC={ddc_env_override}"


def get_p4_args_for_commandlet(env):
def get_p4_args_for_commandlet(env) -> list[str]:
if getattr(env, 'nop4', False):
return ['-SCCProvider=None']

p4_args_for_commandlet = []
if env.has_attribute('nop4submit'):

if getattr(env, 'nop4submit', False):
p4_args_for_commandlet.append('-DisableSCCSubmit')
if env.has_attribute('p4port'):
p4_args_for_commandlet.append('-P4Port=%s' % env.p4port)
if env.has_attribute('p4user'):
p4_args_for_commandlet.append('-P4User=%s' % env.p4user)
if env.has_attribute('p4pass'):
p4_args_for_commandlet.append('-P4Passwd=%s' % env.p4pass)
if env.has_attribute('p4client'):
p4_args_for_commandlet.append('-P4Client=%s' % env.p4client)
if getattr(env, 'p4port', None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why replace env.has_attribute?

Copy link
Contributor Author

@jasugun jasugun Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because out of the box, short python achieves the same result as the helper, right?
The helper should be named attribute_is_not_none btw, it's misealding and was most likely the cause of the bug with bools.
@tdesveaux do you see any problem with taht?
If so I'll stick to changing the bools only.

p4_args_for_commandlet.append(f'-P4Port={env.p4port}')
if getattr(env, 'p4user', None):
p4_args_for_commandlet.append(f'-P4User={env.p4user}')
if getattr(env, 'p4pass', None):
p4_args_for_commandlet.append(f'-P4Passwd={env.p4pass}')
if getattr(env, 'p4client', None):
p4_args_for_commandlet.append(f'-P4Client={env.p4pass}')
if len(p4_args_for_commandlet) > 0:
p4_args_for_commandlet.append('-SCCProvider=Perforce')
if getattr(env, "auto_submit", False):
Expand Down
Loading