X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fcontents.py;h=f9c1feb15708464e7e6a91e940d5552e8afa8dee;hb=2b8ba2f36f49583328b699763ecc2e9702deab72;hp=07734075ed4e4d779d221b08eb9799bc5d91d85b;hpb=74c42205ba675d0ab3481a5570ece6a051086e32;p=dak.git diff --git a/daklib/contents.py b/daklib/contents.py index 07734075..f9c1feb1 100644 --- a/daklib/contents.py +++ b/daklib/contents.py @@ -31,11 +31,10 @@ from daklib.filewriter import BinaryContentsFileWriter, SourceContentsFileWriter from multiprocessing import Pool from shutil import rmtree -from subprocess import Popen, PIPE, check_call from tempfile import mkdtemp +import daklib.daksubprocess import os.path -import signal class BinaryContentsWriter(object): ''' @@ -383,26 +382,21 @@ def binary_scan_helper(binary_id): scanner = BinaryContentsScanner(binary_id) scanner.scan() - -def subprocess_setup(): - # Python installs a SIGPIPE handler by default. This is usually not what - # non-Python subprocesses expect. - signal.signal(signal.SIGPIPE, signal.SIG_DFL) - class UnpackedSource(object): ''' UnpackedSource extracts a source package into a temporary location and gives you some convinient function for accessing it. ''' - def __init__(self, dscfilename): + def __init__(self, dscfilename, tmpbasedir=None): ''' The dscfilename is a name of a DSC file that will be extracted. ''' - temp_directory = mkdtemp(dir = Config()['Dir::TempPath']) + basedir = tmpbasedir if tmpbasedir else Config()['Dir::TempPath'] + temp_directory = mkdtemp(dir = basedir) self.root_directory = os.path.join(temp_directory, 'root') command = ('dpkg-source', '--no-copy', '--no-check', '-q', '-x', dscfilename, self.root_directory) - check_call(command, preexec_fn = subprocess_setup) + daklib.daksubprocess.check_call(command) def get_root_directory(self): ''' @@ -505,4 +499,3 @@ def source_scan_helper(source_id): scanner.scan() except Exception as e: print e -