Move program handlers into own python module package.

This commit is contained in:
Bastian Kleineidam 2010-02-21 15:56:45 +01:00
parent 6790380c70
commit de4dd49e33
22 changed files with 24 additions and 11 deletions

View File

@ -1,2 +0,0 @@
- add create command
- move all program modules into subpackage

View File

@ -286,8 +286,8 @@ def _handle_archive (archive, command, *args, **kwargs):
# get python module for given archive program
key = os.path.basename(program).lower()
module = ProgramModules.get(key, key)
# import archive handler (eg. patoolib.star.extract_tar())
exec "from patoolib.%s import %s_%s as func" % (module, command, format)
# import archive handler (eg. patoolib.programs.star.extract_tar())
exec "from patoolib.programs.%s import %s_%s as func" % (module, command, format)
get_archive_cmdlist = locals()['func']
# prepare func() call arguments
kwargs = dict(verbose=config['verbose'])

View File

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Bastian Kleineidam
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the bzip2 program."""
import os
from . import util
from .. import util
def extract_bzip2 (archive, encoding, cmd, **kwargs):

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the uncompress.real program."""
from . import util
from .. import util
def create_compress (archive, encoding, cmd, *args, **kwargs):

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the cpio program."""
from . import util
from .. import util
def extract_cpio (archive, encoding, cmd, **kwargs):
"""Extract a CPIO archive."""

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the echo program."""
from . import util
from .. import util
def list_bzip2 (archive, encoding, cmd, **kwargs):

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the gzip program."""
import os
from . import util
from .. import util
def extract_gzip (archive, encoding, cmd, **kwargs):

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the rpm2cpio program."""
import os
from . import util
from .. import util
def extract_rpm (archive, encoding, cmd, **kwargs):
"""Extract a DEB archive."""

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the uncompress.real program."""
import os
from . import util
from .. import util
def extract_compress (archive, encoding, cmd, **kwargs):