Logo Search packages:      
Sourcecode: jockey version File versions  Download package

def sandbox::TestOSLib::_make_modinfo (   self  )  [private]

Create a dummy modinfo program which outputs the fake_modinfo data
and set self.modinfo_path.

Note that this fake modinfo only supports one module argument, not
several (as the original modinfo), and no options.

Definition at line 234 of file sandbox.py.

00234                            :
        '''Create a dummy modinfo program which outputs the fake_modinfo data
        and set self.modinfo_path.
        
        Note that this fake modinfo only supports one module argument, not
        several (as the original modinfo), and no options.'''

        os.mkdir(os.path.join(self.workdir, 'bin'))
        self.modinfo_path = os.path.join(self.workdir, 'bin', 'modinfo')
        mi = open(self.modinfo_path, 'w')
        mi.write('''#!/usr/bin/python
import sys

data = %s

if len(sys.argv) != 2:
    print >> sys.stderr, 'Usage: modinfo module'
    sys.exit(0)

m = sys.argv[1]
if m in data:
    attrs = data[m].keys()
    attrs.sort()
    for k in attrs:
        if hasattr(data[m][k], 'isspace'):
            print '%%-16s%%s' %% (k + ':', data[m][k])
        else:
            for i in data[m][k]:
                print '%%-16s%%s' %% (k + ':', i)
else:
    print >> sys.stderr, 'modinfo: could not find module', m
    sys.exit(1)

''' % repr(fake_modinfo))
        mi.close()
        os.chmod(self.modinfo_path, 0755)

    def _make_modprobe(self):


Generated by  Doxygen 1.6.0   Back to index