def main(): args = parser.parse() if args.increase_release_on_build: print("specfile is at {}".format(args.specfile)) _lines = file(args.specfile).read().split("\n") _new_lines = [] _modified = 0 _version, _release = (None, None) for _line in _lines: if _line.lower().startswith("version:") and _version is None: _version = _line.strip().split()[1] if _line.lower().startswith("release:") and _release is None: _release = _line.strip().split()[1] if _version and _release: if _line.lower().startswith("requires:"): for _sw in ["icsw-client", "icsw-server"]: if _line.count(_sw): _new_line = "Requires: {} >= {}-{}".format( _sw, _version, _release) if _line != _new_line: _line = _new_line _modified += 1 _new_lines.append(_line) if _modified: print( "Modified {:d} line(s), rewriting specfile".format(_modified)) file(args.specfile, "w").write("\n".join(_new_lines)) else: print("rebuild run, not modify specfile") sys.exit(0)
def fetch(self, playlistId): #returns the song's list songs = [] yt = build('youtube', 'v3', developerKey=self.api_key) nextPageToken = None # Extracting all the video titles into a single list while True: request = yt.playlistItems().list(part='snippet', playlistId=playlistId, maxResults=50, pageToken=nextPageToken) response = request.execute() nextPageToken = response.get('nextPageToken') songs += parse(response, 'title') if not nextPageToken: break # Preprocessing the extracted titles songs = clean(songs) return songs
def main(): build_dir = os.path.split(os.getcwd()) APP = build_dir[1] args = parser.parse() # sys.exit(0) if args.increase_release_on_build: # print args print("specfile is at {}".format(args.specfile)) _icsw_dir = os.path.normpath( os.path.join( os.path.dirname(args.specfile), "..", "..", APP, "initat", "cluster", )) binary_dir = os.path.join(args.binary_dir, APP) for _prod in [False, True]: os.chdir(_icsw_dir) print("current directory is '{}'".format(_icsw_dir)) _temp_dir = tempfile.mkdtemp(suffix="_{}_wc".format(APP)) _deploy_dir = os.path.join(_temp_dir, APP) _compile_dir = os.path.join(_temp_dir, "compile") _args = [ "gulp", "--deploy-dir", _deploy_dir, "--compile-dir", _compile_dir, "create-content", ] if _prod: _args.append("--production") print("calling gulp with '{}'".format(" ".join(_args))) # print("***", " ".join(_args)) subprocess.check_call(_args) _pf = "" if _prod else "-debug" tar_file_name = os.path.join(binary_dir, "webcontent{}.tar.gz".format(_pf)) tar_file = tarfile.open(tar_file_name, "w:gz") os.chdir(os.path.join(_temp_dir)) tar_file.add(APP) tar_file.close() shutil.rmtree(_temp_dir) else: print("rebuild run, not modify specfile") sys.exit(0)
def start(ctrl): """Start the Helper controller either in the foreground or as a daemon process. :param ctrl helper.Controller: The controller class handle to create and run """ args = parser.parse() obj = ctrl(args, platform.operating_system()) if args.foreground: try: obj.start() except KeyboardInterrupt: obj.stop() else: try: with platform.Daemon(obj) as daemon: daemon.start() except (OSError, ValueError) as error: sys.stderr.write('\nError starting %s: %s\n\n' % (sys.argv[0], error)) sys.exit(1)