MCPcopy Create free account
hub / github.com/apache/solr / Commands

Class Commands

dev-tools/scripts/releaseWizard.py:1592–1789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1590 return platform.system().startswith("Linux")
1591
1592class Commands(SecretYamlObject):
1593 yaml_tag = u'!Commands'
1594 hidden_fields = ['todo_id']
1595 cmd_continuation_char = "^" if is_windows() else "\\"
1596 def __init__(self, root_folder, commands_text=None, commands=None, logs_prefix=None, run_text=None, enable_execute=None,
1597 confirm_each_command=None, env=None, vars=None, todo_id=None, remove_files=None):
1598 self.root_folder = root_folder
1599 self.commands_text = commands_text
1600 self.vars = vars
1601 self.env = env
1602 self.run_text = run_text
1603 self.remove_files = remove_files
1604 self.todo_id = todo_id
1605 self.logs_prefix = logs_prefix
1606 self.enable_execute = enable_execute
1607 self.confirm_each_command = confirm_each_command
1608 self.commands = commands
1609 for c in self.commands:
1610 c.todo_id = todo_id
1611
1612 @classmethod
1613 def from_yaml(cls, loader, node):
1614 fields = loader.construct_mapping(node, deep = True)
1615 return Commands(**fields)
1616
1617 def run(self): # pylint: disable=inconsistent-return-statements # TODO
1618 root = self.get_root_folder()
1619
1620 if self.commands_text:
1621 print(self.get_commands_text())
1622 if self.env:
1623 for key in self.env:
1624 val = self.jinjaify(self.env[key])
1625 os.environ[key] = val
1626 if is_windows():
1627 print("\n SET %s=%s" % (key, val))
1628 else:
1629 print("\n export %s=%s" % (key, val))
1630 print(abbreviate_homedir("\n cd %s" % root))
1631 commands = ensure_list(self.commands)
1632 for cmd in commands:
1633 for line in cmd.display_cmd():
1634 print(" %s" % line)
1635 print()
1636 confirm_each = (not self.confirm_each_command is False) and len(commands) > 1
1637 if not self.enable_execute is False:
1638 if self.run_text:
1639 print("\n%s\n" % self.get_run_text())
1640 if confirm_each:
1641 print("You will get prompted before running each individual command.")
1642 else:
1643 print(
1644 "You will not be prompted for each command but will see the output of each. If one command fails the execution will stop.")
1645 success = True
1646 if ask_yes_no("Do you want me to run these commands now?"):
1647 if self.remove_files:
1648 for _f in ensure_list(self.get_remove_files()):
1649 f = os.path.join(root, _f)

Callers 2

maybe_remove_rc_from_svnFunction · 0.70
from_yamlMethod · 0.70

Calls 1

is_windowsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…