Removed support for setting options via config file.
This commit is contained in:
parent
f41fc584b6
commit
9c3fd7c2fa
|
@ -1,7 +1,8 @@
|
||||||
0.5 "" (released xx.xx.2010)
|
0.5 "Vanishing Point" (released 4.3.2010)
|
||||||
|
|
||||||
* Ported to Python 2.4.
|
* Ported to Python 2.4.
|
||||||
* Added support for LZIP (.lz) archives.
|
* Added support for LZIP (.lz) archives.
|
||||||
|
* Removed support for setting options via config file.
|
||||||
|
|
||||||
0.4 "Nikita" (released 3.3.2010)
|
0.4 "Nikita" (released 3.3.2010)
|
||||||
|
|
||||||
|
|
26
doc/patool.1
26
doc/patool.1
|
@ -83,32 +83,6 @@ Show all supported archive formats.
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-help\fP
|
\fB\-\-help\fP
|
||||||
Show help for this command.
|
Show help for this command.
|
||||||
.SH CONFIGURATION
|
|
||||||
The configuration files (see FILES) can specify which program to use
|
|
||||||
for each archive format. Per default a list of programs are searched
|
|
||||||
and the first one will be used for an archive.
|
|
||||||
.br
|
|
||||||
Additionally, default options like verbosity and force overwrite can
|
|
||||||
be configured.
|
|
||||||
.br
|
|
||||||
The configuration format is the Windows INI format.
|
|
||||||
|
|
||||||
.SS \fB[DEFAULT]\fP
|
|
||||||
.TP
|
|
||||||
\fBforce=0\fP
|
|
||||||
Set the force option to 1 or 0.
|
|
||||||
.TP
|
|
||||||
\fBverbose=0\fP
|
|
||||||
Set the verbose option to 1 or 0.
|
|
||||||
.SS \fB[\fP\fI<archive format>\fP\fB]\fP
|
|
||||||
Supported archive formats are listed by the \fBformats\fP command.
|
|
||||||
.TP
|
|
||||||
\fIcommand\fP\fB=/usr/bin/mycommand\fP
|
|
||||||
Set the application to handle the archive format for given command.
|
|
||||||
\fIcommand\fP can be one of (\fBextract\fP, \fBlist\fP, \fBtest\fP, \fBcreate\fP).
|
|
||||||
.SH FILES
|
|
||||||
\fB/etc/patool.conf\fP, \fB~/.patool.conf\fP -
|
|
||||||
configuration files
|
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
Bastian Kleineidam <calvin@users.sourceforge.net>
|
Bastian Kleineidam <calvin@users.sourceforge.net>
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
|
|
|
@ -68,29 +68,6 @@ COMMANDS
|
||||||
|
|
||||||
--help Show help for this command.
|
--help Show help for this command.
|
||||||
|
|
||||||
CONFIGURATION
|
|
||||||
The configuration files (see FILES) can specify which program to use for each archive format. Per default a list of programs are searched and the first one will be used
|
|
||||||
for an archive.
|
|
||||||
Additionally, default options like verbosity and force overwrite can be configured.
|
|
||||||
The configuration format is the Windows INI format.
|
|
||||||
|
|
||||||
|
|
||||||
[DEFAULT]
|
|
||||||
force=0
|
|
||||||
Set the force option to 1 or 0.
|
|
||||||
|
|
||||||
verbose=0
|
|
||||||
Set the verbose option to 1 or 0.
|
|
||||||
|
|
||||||
[<archive format>]
|
|
||||||
Supported archive formats are listed by the formats command.
|
|
||||||
|
|
||||||
command=/usr/bin/mycommand
|
|
||||||
Set the application to handle the archive format for given command. command can be one of (extract, list, test, create).
|
|
||||||
|
|
||||||
FILES
|
|
||||||
/etc/patool.conf, ~/.patool.conf - configuration files
|
|
||||||
|
|
||||||
AUTHOR
|
AUTHOR
|
||||||
Bastian Kleineidam <calvin@users.sourceforge.net>
|
Bastian Kleineidam <calvin@users.sourceforge.net>
|
||||||
|
|
||||||
|
|
|
@ -269,15 +269,7 @@ def parse_config (archive, format, encoding, command, **kwargs):
|
||||||
'verbose': False,
|
'verbose': False,
|
||||||
'force': False,
|
'force': False,
|
||||||
}
|
}
|
||||||
configfile = parse_config_file()
|
config['program'] = find_archive_program(format, command)
|
||||||
if configfile.has_option(None, "verbose"):
|
|
||||||
config['verbose'] = configfile.getboolean(None, "verbose")
|
|
||||||
if configfile.has_option(None, "force"):
|
|
||||||
config['verbose'] = configfile.getboolean(None, "force")
|
|
||||||
if configfile.has_option(format, command):
|
|
||||||
config['program'] = configfile.get(format, command)
|
|
||||||
else:
|
|
||||||
config['program'] = find_archive_program(format, command)
|
|
||||||
for key, value in kwargs.items():
|
for key, value in kwargs.items():
|
||||||
if value is not None:
|
if value is not None:
|
||||||
if key == 'program':
|
if key == 'program':
|
||||||
|
@ -291,21 +283,6 @@ def parse_config (archive, format, encoding, command, **kwargs):
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
def parse_config_file ():
|
|
||||||
"""Parse system-wide and then user-specific configuration."""
|
|
||||||
import ConfigParser
|
|
||||||
config = ConfigParser.RawConfigParser()
|
|
||||||
files = []
|
|
||||||
# system wide config settings
|
|
||||||
files.append("/etc/patool.conf")
|
|
||||||
# per user config settings
|
|
||||||
files.append(os.path.expanduser("~/.patool.conf"))
|
|
||||||
# weed out invalid files
|
|
||||||
files = [f for f in files if os.path.isfile(f) and os.path.exists(f)]
|
|
||||||
config.read(files)
|
|
||||||
return config
|
|
||||||
|
|
||||||
|
|
||||||
def move_outdir_orphan (outdir, force):
|
def move_outdir_orphan (outdir, force):
|
||||||
"""Move a single file or directory inside outdir a level up.
|
"""Move a single file or directory inside outdir a level up.
|
||||||
Overwrite files if force evaluates True.
|
Overwrite files if force evaluates True.
|
||||||
|
|
Loading…
Reference in New Issue