Ejemplo n.º 1
0
    def foreachDependency(self, command, recursive=False):
        if (self.config == None):
            return

        runCommand = command
        if (runCommand.startswith('!sh ')):
            runCommand = command[4:]
            i = runCommand.index(' ')
            task = Task(runCommand[:i])
            runCommand = runCommand[i + 1:]
        else:
            task = Task('git')

        for p in self.config.sections():
            d = GitDependenciesRepository(self.config[p]['url'],
                                          os.path.join(self.repositoryPath, p))
            wd = os.getcwd()
            os.chdir(d.repositoryPath)
            task.run(runCommand.split(' '))
            if (task.output != ''):
                print(task.output, file=sys.stderr)
            if (task.exitCode() != 0):
                sys.exit(task.exitCode())
            os.chdir(wd)
            if (recursive):
                d.foreachDependency(command, True)
Ejemplo n.º 2
0
	def clone(self, branch = None):
		if (os.path.exists(self.repositoryPath)):
			return
		arguments = ['clone', '--recursive']
		if (branch != None):
			arguments += ['--branch', branch]
		arguments += [self.remoteURL, self.repositoryPath]

		task = Task('git')
		task.run(arguments)
		if (task.exitCode() != 0):
			raise ValueError(task.output)

		self.__findGitRoot()
		self.__findGitDirectory()
Ejemplo n.º 3
0
    def clone(self, branch=None):
        if (os.path.exists(self.repositoryPath)):
            return
        arguments = ['clone', '--recursive']
        if (branch != None):
            arguments += ['--branch', branch]
        arguments += [self.remoteURL, self.repositoryPath]

        task = Task('git')
        task.run(arguments)
        if (task.exitCode() != 0):
            raise ValueError(task.output)

        self.__findGitRoot()
        self.__findGitDirectory()
Ejemplo n.º 4
0
    def __runGitTask(self, arguments, useConfig=True, exitOnError=True):
        wd = os.getcwd()
        if (useConfig):
            arguments = ['--work-tree=' + self.repositoryPath] + arguments
            if (self.gitPath != None):
                arguments = ['--git-dir=' + self.gitPath] + arguments
        else:
            os.chdir(self.repositoryPath)

        # print('zserhardt@zserhardt-iMac:' + os.getcwd() + '$ git ' + ' '.join(arguments))

        task = Task('git').run(arguments)
        if (task.exitCode() != 0 and exitOnError):
            print(task.output, file=sys.stderr)
            sys.exit(task.exitCode())

        if (not useConfig):
            os.chdir(wd)

        return task
Ejemplo n.º 5
0
	def __runGitTask(self, arguments, useConfig = True, exitOnError = True):
		wd = os.getcwd()
		if (useConfig):
			arguments = ['--work-tree=' + self.repositoryPath] + arguments
			if (self.gitPath != None):
				arguments = ['--git-dir=' + self.gitPath] + arguments
		else:
			os.chdir(self.repositoryPath)

		# print('zserhardt@zserhardt-iMac:' + os.getcwd() + '$ git ' + ' '.join(arguments))

		task = Task('git').run(arguments)
		if (task.exitCode() != 0 and exitOnError):
			print(task.output, file=sys.stderr)
			sys.exit(task.exitCode())

		if (not useConfig):
			os.chdir(wd)

		return task
Ejemplo n.º 6
0
	def foreachDependency(self, command, recursive = False):
		if (self.config == None):
			return

		runCommand = command
		if (runCommand.startswith('!sh ')):
			runCommand = command[4:]
			i = runCommand.index(' ')
			task = Task(runCommand[:i])
			runCommand = runCommand[i + 1:]
		else:
			task = Task('git')

		for p in self.config.sections():
			d = GitDependenciesRepository(self.config[p]['url'], os.path.join(self.repositoryPath, p))
			wd = os.getcwd()
			os.chdir(d.repositoryPath)
			task.run(runCommand.split(' '))
			if (task.output != ''):
				print(task.output, file=sys.stderr)
			if (task.exitCode() != 0):
				sys.exit(task.exitCode())
			os.chdir(wd)
			if (recursive):
				d.foreachDependency(command, True)
Ejemplo n.º 7
0
 def _shouldUsePools(self):
     task = Task('which').run(['git-pool'])
     if (task.exitCode() != 0):
         return False
     else:
         return True
Ejemplo n.º 8
0
	def _shouldUsePools(self):
		task = Task('which').run(['git-pool'])
		if (task.exitCode() != 0):
			return False
		else:
			return True