fixed syntax problems with previous python versions, added additional error messages
This commit is contained in:
parent
378ebcebf6
commit
3b747f56ba
@ -76,10 +76,8 @@ def main():
|
|||||||
dest='file', action='store')
|
dest='file', action='store')
|
||||||
cmdline = parser.parse_args()
|
cmdline = parser.parse_args()
|
||||||
debug = Debug()
|
debug = Debug()
|
||||||
# debug.set_verbose(cmdline.verbose)
|
debug.set_verbose(cmdline.verbose)
|
||||||
# cfg = Conf(filename=cmdline.file, debug=debug)
|
cfg = Conf(filename=cmdline.file, debug=debug)
|
||||||
debug.set_verbose(3)
|
|
||||||
cfg = Conf(filename='/Users/lysis/userconfig2-test.conf', debug=debug)
|
|
||||||
uc = Userconfig(cfg)
|
uc = Userconfig(cfg)
|
||||||
|
|
||||||
cfg.debug.stdout(f'Verbose level: {cfg.debug.get_verbose()}', 1)
|
cfg.debug.stdout(f'Verbose level: {cfg.debug.get_verbose()}', 1)
|
||||||
@ -117,6 +115,7 @@ def main():
|
|||||||
continue
|
continue
|
||||||
if package.name in ['.svn', '.git']:
|
if package.name in ['.svn', '.git']:
|
||||||
cfg.debug.stdout(f'{package.path} is a svn or git data directory, skipping', 2, 'WARNING')
|
cfg.debug.stdout(f'{package.path} is a svn or git data directory, skipping', 2, 'WARNING')
|
||||||
|
continue
|
||||||
if os.path.isfile(f'{package.path}/.ignore'):
|
if os.path.isfile(f'{package.path}/.ignore'):
|
||||||
cfg.debug.stdout(f'{package.path} contains .ignore, skipping', 2, 'WARNING')
|
cfg.debug.stdout(f'{package.path} contains .ignore, skipping', 2, 'WARNING')
|
||||||
continue
|
continue
|
||||||
@ -124,9 +123,15 @@ def main():
|
|||||||
cfg.debug.stdout(f'Start Package {cfg.debug.green(package.path)}', 1, 'NOTICE')
|
cfg.debug.stdout(f'Start Package {cfg.debug.green(package.path)}', 1, 'NOTICE')
|
||||||
# Get all category directories for package
|
# Get all category directories for package
|
||||||
(category_dirs, dir_config) = uc.process_package_dir(package.path)
|
(category_dirs, dir_config) = uc.process_package_dir(package.path)
|
||||||
|
if not category_dirs:
|
||||||
|
cfg.debug.stdout(f'Could not get category_dirs for package {package.name}, skipping package.', 0, 'ERROR')
|
||||||
|
continue
|
||||||
|
if not dir_config:
|
||||||
|
cfg.debug.stdout(f'Could not get dir_config for package {package.name}, skipping package.', 0, 'ERROR')
|
||||||
|
continue
|
||||||
cfg.debug.stdout(f'Got categories: {category_dirs}', 2)
|
cfg.debug.stdout(f'Got categories: {category_dirs}', 2)
|
||||||
host_category_dirs = uc.filter_categories(category_dirs)
|
host_category_dirs = uc.filter_categories(category_dirs)
|
||||||
cfg.debug.stdout(f'Host uses categories: {", ".join([f'{v[1]}_{v[2]}' for v in host_category_dirs])}', 2)
|
cfg.debug.stdout('Host uses categories: %s' % ", ".join([f'{v[1]}_{v[2]}' for v in host_category_dirs]), 2)
|
||||||
file_list = dict()
|
file_list = dict()
|
||||||
for c in host_category_dirs:
|
for c in host_category_dirs:
|
||||||
file_list = uc.process_category_dir(c, file_list)
|
file_list = uc.process_category_dir(c, file_list)
|
||||||
@ -136,7 +141,7 @@ def main():
|
|||||||
subprocess.call([f'{package.path}/install.sh'])
|
subprocess.call([f'{package.path}/install.sh'])
|
||||||
for file in file_list:
|
for file in file_list:
|
||||||
dest = f'{dir_config.get(section="Main", option="dest")}/{file}'
|
dest = f'{dir_config.get(section="Main", option="dest")}/{file}'
|
||||||
cfg.debug.stdout(f'Generating {dest} from:\n {"\n ".join(file_list[file])}', 1)
|
cfg.debug.stdout('Generating %s from:\n %s' % (dest, "\n ".join(file_list[file])), 1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
comment_string = dir_config.get(section="Main", option="commentstring")
|
comment_string = dir_config.get(section="Main", option="commentstring")
|
||||||
|
@ -28,11 +28,11 @@ class Userconfig:
|
|||||||
if not os.path.isfile(package_config_file):
|
if not os.path.isfile(package_config_file):
|
||||||
self._cfg.debug.stdout(f'No config file {self._cfg.get("configfile")} in {package_dir}, skipping',
|
self._cfg.debug.stdout(f'No config file {self._cfg.get("configfile")} in {package_dir}, skipping',
|
||||||
0, 'ERROR')
|
0, 'ERROR')
|
||||||
return None
|
return None, None
|
||||||
dir_config = self.get_config(package_config_file)
|
dir_config = self.get_config(package_config_file)
|
||||||
if not dir_config:
|
if not dir_config:
|
||||||
self._cfg.debug.stdout(f'Cannot read config file {package_config_file}, skipping', 0, 'ERROR')
|
self._cfg.debug.stdout(f'Cannot read config file {package_config_file}, skipping', 0, 'ERROR')
|
||||||
return None
|
return None, None
|
||||||
classes = []
|
classes = []
|
||||||
for category in os.scandir(package_dir):
|
for category in os.scandir(package_dir):
|
||||||
if category.path == package_config_file:
|
if category.path == package_config_file:
|
||||||
|
Loading…
Reference in New Issue
Block a user