summaryrefslogtreecommitdiff
path: root/config.py
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-04-11 12:39:40 -0500
committerJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-04-11 12:39:40 -0500
commit3e27d11f68571bce92138f6cbfcaecac75fa1644 (patch)
tree36647c3691da83e85a0e06ceff3a4b47adf9f49b /config.py
parent857ecbe794c714919612b533303e7a9ef781c75b (diff)
Fixed some errors
Diffstat (limited to 'config.py')
-rwxr-xr-xconfig.py35
1 files changed, 29 insertions, 6 deletions
diff --git a/config.py b/config.py
index f4089f9..8b48c66 100755
--- a/config.py
+++ b/config.py
@@ -3,11 +3,15 @@
try:
from subprocess import check_output
except(ImportError):
- from commands import getoutput as check_output
+ from commands import getoutput
+ def check_output(*popenargs,**kwargs):
+ cmd=" ".join(*popenargs)
+ return getoutput(cmd)
import os
-stringvars=("mirror", "mirrorpath", "logname", "tempdir", "archdb", "docs_dir",
- "repodir", "blacklist", "whitelist", "pending", "rsync_blacklist")
+stringvars=("mirror", "mirrorpath", "logname", "tempdir", "archdb",
+ "repodir", "blacklist", "whitelist", "pending",
+ "rsync_blacklist",)
listvars=("repo_list", "dir_list", "arch_list", "other",)
boolvars=("output", "debug",)
@@ -37,10 +41,29 @@ for var in boolvars:
# Rsync commands
rsync_list_command="rsync -a --no-motd --list-only "
+def printf(text,output=config["output"]):
+ """Guarda el texto en la variable log y puede imprimir en pantalla."""
+ log_file = open(config["logname"], 'a')
+ log_file.write("\n" + str(text) + "\n")
+ log_file.close()
+ if output:
+ print (str(text) + "\n")
+
+del exit_if_none
+
# Classes and Exceptions
-class NonValidFile(ValueError): pass
-class NonValidDir(ValueError): pass
-class NonValidCommand(ValueError): pass
+class NonValidFile(ValueError):
+ def __init__(self):
+ ValueError.__init__(self)
+ printf(self.message)
+class NonValidDir(ValueError):
+ def __init__(self):
+ ValueError.__init__(self)
+ printf(self.message)
+class NonValidCommand(ValueError):
+ def __init__(self):
+ ValueError.__init__(self)
+ printf(self.message)
class Package:
""" An object that has information about a package. """