示例#1
0
	def get_local_version(self):
		git_describe = subprocess_check_output(["git", "-C", REPO_DIR, "describe", "--tags"]);
		if(not git_describe): raise Exception("git describe was unable to get version number");

		describe_version = Version.version_string(git_describe.decode("utf-8"))
		if(not describe_version): raise Exception("Unable to search version number from git describe");
		return Version(describe_version);
示例#2
0
	def get_remote_version(self):
		git_ls_remote = subprocess_check_output(["git", "-C", REPO_DIR, "ls-remote", "--tag", "origin"]);
		if(not git_ls_remote): raise Exception("git describe was unable to get version number");

		tag_strings = [Version.version_string(line) for line in git_ls_remote.decode("utf-8").rstrip().split("\n")];
		tag_strings = [tag_string for tag_string in tag_strings if(tag_string)];
		if(not tag_strings): raise Exception("Unable to find any version number from git describe");

		tags = [Version(tag) for tag in tag_strings];
		tags.sort();
		return tags[-1];
示例#3
0
def run_command(command):
  """Shim for running commands on the local operating system.
  This allows us to use either subprocess.check_output
  (Python 2.7+) or commands (before 2.7)."""
  try:
    import commands
    return commands.getoutput(command)
  except ImportError:
    try:
      # check_output was only used in Python 2.7+.
      from subprocess import check_output as subprocess_check_output
      command_arguments = command.split(" ")
      return str(subprocess_check_output(command_arguments))
    except ImportError:
      raise ImportError(
        "Neither modules 'commands' nor 'subprocess' were found.")
示例#4
0
 def check_output(popenargs):
     print("(running '%s')" % (' '.join(popenargs)))
     return subprocess_check_output(popenargs)
示例#5
0
文件: setup.py 项目: ovalhub/pyicu
 def check_output(popenargs):
     print("(running '%s')" %(' '.join(popenargs)))
     return subprocess_check_output(popenargs)
示例#6
0
	def branch_is_(self, branch_name: str) -> bool:
		git_branch = subprocess_check_output(["git", "-C", REPO_DIR, "branch"]);
		if(not git_branch): return False;

		local_branches = git_branch.decode("utf-8").rstrip().split("\n");
		return f"* {branch_name}" in local_branches;