call site 3 for log.get
misc/testing/test_initpkg.py - line 83
81
82
83
   def check_import(modpath): 
       print "checking import", modpath
->     assert __import__(modpath) 
misc/dynpkg.py - line 11
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
   """
   
   """
   
   import py
   import sys
   
   log = py.log.get("dynpkg", 
->                  info=py.log.STDOUT, 
                    debug=py.log.STDOUT,
                    command=None) # py.log.STDOUT)
   
   from distutils import util
   
   class DistPython: 
       def __init__(self, location=None, python=None): 
           if python is None:
               python = py.std.sys.executable
           self.python = python
           if location is None:
               location = py.path.local()
           self.location = location 
           self.plat_specifier = '.%s-%s' % (util.get_platform(), sys.version[0:3])
   
       def clean(self):
           out = self._exec("clean -a")
           #print out
   
       def build(self):
           out = self._exec("build")
           #print out
   
       def _exec(self, cmd):
           python = self.python 
           old = self.location.chdir()
           try:
               cmd = "%(python)s setup.py %(cmd)s" % locals()
               log.command(cmd)
               out = py.process.cmdexec(cmd)
           finally:
               old.chdir()
           return out 
   
       def get_package_path(self, pkgname):
           pkg = self._get_package_path(pkgname) 
           if pkg is None:
               #self.clean()
               self.build()
               pkg = self._get_package_path(pkgname)
           assert pkg is not None 
           return pkg 
   
       def _get_package_path(self, pkgname):
           major, minor = py.std.sys.version_info[:2]
           #assert major >=2 and minor in (3,4,5)
           suffix = "%s.%s" %(major, minor)
           location = self.location
           for base in [location.join('build', 'lib'),
                        location.join('build', 'lib'+ self.plat_specifier)]:
               if base.check(dir=1):
                   for pkg in base.visit(lambda x: x.check(dir=1)):
                       if pkg.basename == pkgname:
                           # 
                           if pkg.dirpath().basename ==  'lib'+ self.plat_specifier or \
                              pkg.dirpath().basename == 'lib':
                               return pkg