diff options
author | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-04-10 15:18:17 -0500 |
---|---|---|
committer | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-04-10 15:18:17 -0500 |
commit | 2b721124f5122faae5709e5e2dd8035f392c1361 (patch) | |
tree | c8bbe456ea7cee11923f11d4cdf77f5de077e9f0 /config.py | |
parent | 72d3e1102acf8e90a1646d5c9afa6fdd01b2aeca (diff) |
config.py import config.sh settings
Diffstat (limited to 'config.py')
-rw-r--r-- | config.py | 72 |
1 files changed, 34 insertions, 38 deletions
@@ -1,44 +1,36 @@ -#!/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") +stringvars=("mirror", "mirrorpath", "logname", "tempdir", "docs_dir", + "repodir",) +listvars=("repo_list", "dir_list", "arch_list", "other",) +boolvars=("output", "debug",) -# Mirror Parameters -mirror = "mirrors.eu.kernel.org" -mirrorpath = "::mirrors/archlinux" +config=dict() -# Directories and files +def exit_if_none: + if os.environ.get(var) is None: + exit("%s is not defined" % var) -## Optionals -path = home + "/parabolagnulinux.org" -docs = path + "/docs" -logdir = path + "/log" - -## Must be defined -logname= logdir + "/" + time__ + "-repo-maintainer.log" -repodir= path + "/repo" -tmp = home + "/tmp" -archdb = tmp + "/db" - -free_path= path + "/free/" - -# Repo, arch, and other folders to use for repo -repo_list = ("core", "extra", "community", "testing", "community-testing", "multilib") -dir_list = ("pool","sources") -arch_list = ("i686", "x86_64") -other = ("any",) - -# Output -output = True -verbose = False - -# Files -blacklist = docs + "/blacklist.txt" -whitelist = docs + "/whitelist.txt" -pending = docs + "/pending" -rsync_blacklist = docs + "/rsyncBlacklist" +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) # Classes and Exceptions class NonValidFile(ValueError): pass @@ -55,7 +47,8 @@ class Package: "release" : False, "arch" : False, "license" : False, - "location": False} + "location": False, + "depends" : False,} def __setitem__(self, key, item): if key in self.package_info.keys(): @@ -76,8 +69,11 @@ class Package: if not isinstance(x, Package): return False for key in self.package_info.keys(): - if x[key] != self[key]: + if x[key] != self.package_info[key]: return False else: return True +if __name__=="__main__": + for key in config.keys(): + print("%s : %s" % (key,config[key])) |