1 |
commit: 0c9efb4ddce50c2c9e94100eb77812238650d7eb |
2 |
Author: André Erdmann <dywi <AT> mailerd <DOT> de> |
3 |
AuthorDate: Tue Jul 10 17:43:08 2012 +0000 |
4 |
Commit: André Erdmann <dywi <AT> mailerd <DOT> de> |
5 |
CommitDate: Tue Jul 10 17:43:08 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=0c9efb4d |
7 |
|
8 |
try to run without a config file |
9 |
|
10 |
--- |
11 |
roverlay/__init__.py | 3 ++- |
12 |
roverlay/argutil.py | 8 +++++++- |
13 |
2 files changed, 9 insertions(+), 2 deletions(-) |
14 |
|
15 |
diff --git a/roverlay/__init__.py b/roverlay/__init__.py |
16 |
index 1399df0..3d1ecfa 100644 |
17 |
--- a/roverlay/__init__.py |
18 |
+++ b/roverlay/__init__.py |
19 |
@@ -27,7 +27,8 @@ def load_config_file ( cfile, extraconf=None ): |
20 |
* extraconf -- a dict with additional config entries that will override |
21 |
entries read from cfile |
22 |
""" |
23 |
- roverlay.config.loader().load_config ( cfile ) |
24 |
+ if cfile: |
25 |
+ roverlay.config.loader().load_config ( cfile ) |
26 |
|
27 |
if extraconf is not None: |
28 |
roverlay.config.access().merge_with ( extraconf ) |
29 |
|
30 |
diff --git a/roverlay/argutil.py b/roverlay/argutil.py |
31 |
index 6249644..98a0406 100644 |
32 |
--- a/roverlay/argutil.py |
33 |
+++ b/roverlay/argutil.py |
34 |
@@ -29,6 +29,12 @@ def get_parser ( CMD_DESC, DEFAULT_CONFIG ): |
35 |
) |
36 |
return d |
37 |
|
38 |
+ def is_fs_file_or_void ( value ): |
39 |
+ if value: |
40 |
+ return is_fs_file ( value ) |
41 |
+ else: |
42 |
+ return '' |
43 |
+ |
44 |
parser = argparse.ArgumentParser ( |
45 |
description='\n'.join (( |
46 |
roverlay.description_str, roverlay.license_str, |
47 |
@@ -67,7 +73,7 @@ def get_parser ( CMD_DESC, DEFAULT_CONFIG ): |
48 |
'-c', '--config', |
49 |
default=DEFAULT_CONFIG, |
50 |
help="config file", |
51 |
- **fs_file |
52 |
+ type=is_fs_file_or_void, metavar="<file>" |
53 |
) |
54 |
arg ( |
55 |
'-F', '--field-definition', '--fdef', default=argparse.SUPPRESS, |