diff options
Diffstat (limited to 'config.py')
-rw-r--r-- | config.py | 77 |
1 files changed, 33 insertions, 44 deletions
@@ -1,53 +1,39 @@ -#!/usr/bin/python +#!/usr/bin/pythonn # -*- coding: utf-8 -*- -from user import home -import commands +try: + from subprocess import check_output +except(ImportError): + from commands import getoutput as check_output import os -time__ = commands.getoutput("date +%Y%m%d-%H:%M") - -# Mirror Parameters -mirror = "mirrors.eu.kernel.org" -mirrorpath = "::mirrors/archlinux" - -# Directories and files - -## Optionals -path = home + "/parabolagnulinux.org" -docs = path + "/docs" -logdir = path + "/log" - -## Must be defined -logname= logdir + "/" + time__ + "-repo-maintainer.log" -freedir= path + "/free/" -repodir= path + "/repo" -tmp = home + "/tmp" -archdb = tmp + "/db" - -free_path= path + "/free/" - -# Repo, arch, and other folders to use for repo -# This are tuples, so **always keep a comma before closing parenthesis ** -repo_list = ("core", "extra", "community", "testing", "community-testing", "multilib",) -dir_list = ("pool",) -arch_list = ("i686", "x86_64",) -other = ("any",) - -# Output -output = True -verbose = True - -# Files -blacklist = docs + "/blacklist.txt" -whitelist = docs + "/whitelist.txt" -pending = docs + "/pending" -rsync_blacklist = docs + "/rsyncBlacklist" +stringvars=("mirror", "mirrorpath", "logname", "tempdir", "docs_dir", + "repodir",) +listvars=("repo_list", "dir_list", "arch_list", "other",) +boolvars=("output", "debug",) + +config=dict() + +def exit_if_none: + if os.environ.get(var) is None: + exit("%s is not defined" % var) + +for var in stringvars: + exit_if_none(var) + config[var]=os.environ.get(var) +for var in listvars: + exit_if_none(var) + config[var]=tuple(os.environ.get(var).split(":")) +for var in boolvars: + exit_if_none(var) + if os.environ.get(var) == "True": + config[var]=True + elif os.environ.get(var) =="False": + config[var]=False + else: + print('%s is not True or False' % var) # Rsync commands - rsync_list_command="rsync -a --no-motd --list-only " -rsync_update_command="rsync -av --delay-updates --exclude=*.{abs|db}.tar.* " -rsync_post_command="rsync -av --delete --exclude=*.abs.tar.* " # Classes and Exceptions class NonValidFile(ValueError): pass @@ -91,3 +77,6 @@ class Package: else: return True +if __name__=="__main__": + for key in config.keys(): + print("%s : %s" % (key,config[key])) |