def split(self, control_queue, jobs_queue): # In case of ctrl+c, control_queue will become empty while (not control_queue.empty()) and (not jobs_queue.empty()): product_title = jobs_queue.get() product_path = os.path.join(self.data_dir, product_title + ".SAFE") ref_data_path = os.path.join(self.data_dir, "Reference_dataset", product_title.replace("MSIL2A", "MSIL1C")) # Check for the existence of downloaded data if not Path(product_path).is_dir(): self.info("Could not find data for product " + product_title) continue # Create reference data if not Path(ref_data_path).is_dir(): self.info("Could not find reference dataset for product " + product_title) continue # Create link instead of coping, as this does not affect the size of the .SAFE dir # and therefore does not corrupt the check of the correctness of the dir utilities.execute("ln -s {} {}".format(ref_data_path, product_path + "/ref_dataset")) # Start the tiling process command = self.cvat_command + product_path self.info("Tiling product {} with command {}".format(product_title, command)) errcode, errmsg = utilities.execute(command) if errcode: self.info("Failed to tile product {}; error code: {}, error msg:\n{}" .format(product_title, errcode, errmsg))
def build_sketch(self, sketch, variant): #self._print(2, sketch, variant) sbase = os.path.splitext(os.path.split(sketch)[1])[0] vbase = variant.split(":")[-1] cmd = "%s "\ "--pref sketchbook.path=%s "\ "--pref build.path=%s/build/%s_%s "\ "--board %s "\ "--verify "\ "%s" cmd = cmd % (self.arduino_exe, self.workdir, self.workdir, sbase, vbase, self.variant, self.sketch) #self._print(2, "***", cmd) rc, so, se = execute(cmd) if rc != 0: self._print(2, "Build Arduino Sketch failed") self._print(2, "cmd: %s" % cmd) self._print(2, "rc = %d" % rc) self._print(2, "stderr: %s" % se.replace("\n", "\nstderr: ")) self._print(2, "stdout: %s" % so.replace("\n", "\nstdout: ")) return rc, so, se
def test_build_bootloader(self): rc, so, se = execute("make -C %s/hardware/uracoli/avr/bootloaders/radiofaro/ clean all" % self.workdir) if rc != 0: self._print(2, "Build Arduino Bootloader failed") self._print(2, "cmd: %s" % cmd) self._print(2, "rc = %d" % rc) self._print(2, "stderr: %s" % stderr.replace("\n", "\nstderr: ")) self._print(2, "stdout: %s" % stdout.replace("\n", "\nstdout: ")) return rc, so, se
def init(arguments): ''' Initializes (or re-initializes) a repository. ''' if "git" in arguments or isGit(): execute(["git", "init"]) if "hg" in arguments or isMercurial(): execute(["hg", "init"]) if "bzr" in arguments or isBazaar(): execute(["bzr", "init"])
def push(arguments): ''' Push commits to target. ''' if isGit(): command = ["git", "push"] command.extend(arguments) execute(command) if isMercurial(): command = ["hg", "push"] command.extend(arguments) execute(command) if isBazaar(): command = ["bzr", "push"] command.extend(arguments) execute(command)
def pull(arguments): ''' Pull the latest changes. ''' if isGit(): command = ["git", "pull"] command.extend(arguments) execute(command) if isMercurial(): command = ["hg", "pull", "-u"] command.extend(arguments) execute(command) if isBazaar(): command = ["bzr", "update"] command.extend(arguments) execute(command)
def merge(arguments): ''' Merge incoming changes with the current branch. ''' if isGit(): command = ["git", "merge"] command.extend(arguments) execute(command) if isMercurial(): command = ["hg", "merge"] command.extend(arguments) execute(command) if isBazaar(): command = ["bzr", "merge"] command.extend(arguments) execute(command)
def mv(arguments): ''' Move file(s) ''' if isGit(): command = ["git", "mv"] command.extend(arguments) execute(command) if isMercurial(): command = ["hg", "mv"] command.extend(arguments) execute(command) if isBazaar(): command = ["bzr", "mv"] command.extend(arguments) execute(command)
def rm(arguments): ''' Remove file(s) from the pending changes. ''' if isGit(): command = ["git", "rm"] command.extend(arguments) execute(command) if isMercurial(): command = ["hg", "rm"] command.extend(arguments) execute(command) if isBazaar(): command = ["bzr", "rm"] command.extend(arguments) execute(command)
def incoming(arguments): """ Shows incoming commits. """ if isGit(): out, err = executeAndReturnResponse(["git", "remote"]) if not err and out: executeAndReturnResponse(["git", "remote", "update", "-p"]) execute(["git", "log", "..@{u}"]) if isMercurial(): out, err = executeAndReturnResponse(["hg", "paths"]) if not err and out: execute(["hg", "incoming"]) if isBazaar(): out, err = executeAndReturnResponse(["bzr", "missing"]) if not err and out: execute(["bzr", "missing"])
def add(arguments): ''' Add file(s) to the pending changes. ''' if isGit(): # If no additional arguments were passed assume # we want to add all pending changes. if len(arguments) == 0: arguments.append(".") command = ["git", "add"] command.extend(arguments) execute(command) if isMercurial(): command = ["hg", "add"] command.extend(arguments) execute(command) if isBazaar(): command = ["bzr", "add"] command.extend(arguments) execute(command)
options.load() config = options.configure() build = config['steambridge']['build'] prefix = config['steambridge']['prefix'] if not os.path.isfile(build['bridge_lib']): error("Install", "Winelib bridge library isn't compiled (run make)!") if not os.path.isfile(build['proxy_dll']): error("Install", "Win32 proxy library isn't found") try: # os.makedirs raise an exception(!) if the directory already exists # Thanks Python! execute('mkdir -p {}'.format(prefix['shared'])) execute('mkdir -p {}'.format(prefix['bin'])) execute('mkdir -p {}'.format(prefix['pysteambridge'])) execute('mkdir -p {}'.format(prefix['winedllpath'])) execute('mkdir -p {}'.format(prefix['documentation'])) execute('mkdir -p {}'.format(prefix['licenses'])) # shutils.copy and friends seem to work kinda weird and not Unixy, so just use the system cp cp = 'cp --no-preserve=mode {} {}' execute(cp.format(build['bridge_lib'], prefix['bridge_lib'])) execute(cp.format(build['proxy_dll'], prefix['proxy_dll'])) execute(cp.format(build['steam_api_lib'], prefix['steam_api_lib'])) execute(cp.format(build['pysteambridge'], prefix['pysteambridge'])) execute(cp.format(build['documentation'], prefix['documentation'])) execute(cp.format(build['licenses'], prefix['licenses']))