From deab65fad4ced009fb31f7033b1db8ef0af78aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Fri, 15 Apr 2011 04:53:27 -0500 Subject: Python parts ready for bash usage in python 2 and 3 --- pato2.py | 63 --------------------------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 pato2.py (limited to 'pato2.py') diff --git a/pato2.py b/pato2.py deleted file mode 100644 index 6daa8b8..0000000 --- a/pato2.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -""" - parabola.py - Copyright 2009 Rafik Mas'ad - Copyright 2010 Joshua Ismael Haase Hernández - - ---------- GNU General Public License 3 ---------- - - This file is part of Parabola. - - Parabola is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Parabola is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Parabola. If not, see . - - -""" -from repm.config import * -from repm.filter import * -import tarfile -from os.path import isdir, isfile - -def generate_rsync_command(base_command, - dir_list=(config["repo_list"] + - config["dir_list"]), - destdir=config["repodir"], - source=config["mirror"] +config["mirrorpath"]): - """ Generates an rsync command for executing - it by combining all parameters. - - Parameters: - ---------- - base_command -> str - dir_list -> list or tuple - destdir -> str Path to dir, dir must exist. - source -> str The source for rsync - blacklist_file -> False or str Path to file, file must exist. - - Return: - ---------- - rsync_command -> str """ - if not os.path.isdir(destdir): - print(destdir + " is not a directory") - raise NonValidDir - - dir_list="{" + ",".join(dir_list) + "}" - return " ".join((base_command, os.path.join(source, dir_list), - destdir)) - -def run_rsync(command,debug=config["debug"]): - """ Runs rsync and gets returns it's output """ - if debug: - printf("rsync_command: " + command) - return check_output(command.split()) -- cgit v1.2.3-2-g168b