def testPyPath(self):
     """testPyPath."""
     p = tmp
     bd = Buildout(fp, [])
     bd.offline = False
     recipe = MinitageCommonRecipe(bd, '666', bd['part'])
     ppath = sys.path
     recipe._set_py_path()
     nppath = os.environ['PYTHONPATH']
     for elem in [recipe.buildout['buildout']['directory'],
                  recipe.options['location'],]\
                 + ['/eggs/egg1/parts/%s' % (
                         recipe.site_packages
                     ),
                     '/eggs/egg2/parts/%s' % (
                        recipe.site_packages
                     ),
                     '/eggs/legg1/parts/%s' % (
                         recipe.site_packages
                     ),
                     '/eggs/egg3/parts/%s'  % (
                        recipe.site_packages
                     ),
                 ]:
         print elem
         self.assertTrue(elem in nppath)
Example #2
0
 def testdownload(self):
     """testDownload."""
     p = tmp
     bd = Buildout(fp, [])
     bd.offline = False
     recipe = MinitageCommonRecipe(bd, '666', bd['part'])
     ret = recipe._download()
     self.assertTrue(
         os.path.isfile(os.path.join(recipe.download_cache,
                                     'buildouttest')))
     p = tmp
     bd = Buildout(fp, [])
     bd.offline = True
     open(os.path.join(p, 'a'), 'w').write('test')
     recipe = MinitageCommonRecipe(bd, '666', bd['part'])
     recipe.url = 'http://foo/a'
     recipe.download_cache = p
     ret = recipe._download()
     self.assertEquals(ret, os.path.join(p, 'a'))
 def testPath(self):
     """testPath."""
     p = tmp
     bd = Buildout(fp, [])
     bd.offline = False
     recipe = MinitageCommonRecipe(bd, '666', bd['part'])
     recipe._set_path()
     path = os.environ['PATH']
     for elem in [recipe.buildout['buildout']['directory'],
                  recipe.options['location'],]\
                 + os.environ.get('PATH','').split(':') :
         self.assertTrue(elem in path)
 def testdownload(self):
     """testDownload."""
     p = tmp
     bd = Buildout(fp, [])
     bd.offline = False
     recipe = MinitageCommonRecipe(bd, '666', bd['part'])
     ret = recipe._download()
     self.assertTrue(
         os.path.isfile(
             os.path.join(recipe.download_cache, 'buildouttest')
         )
     )
     p = tmp
     bd = Buildout(fp, [])
     bd.offline = True
     open(os.path.join(p, 'a'), 'w').write('test')
     recipe = MinitageCommonRecipe(bd, '666', bd['part'])
     recipe.url = 'http://foo/a'
     recipe.download_cache = p
     ret = recipe._download()
     self.assertEquals(
         ret,
         os.path.join(p, 'a')
     )
    def testGetCompilDir(self):
        """testGetCompilDir."""
        p = tmp
        os.system("""
cd %s
mkdir .download
mkdir tutu
mkdir tutu/.download
""" % (tmp))
        bd = Buildout(fp, [])
        bd.offline = False
        recipe = MinitageCommonRecipe(bd, '666', bd['part'])
        directory = recipe._get_compil_dir(tmp)

        self.assertEquals(directory, os.path.join(tmp, 'tutu'))
 def testPkgconfigpath(self):
     """testPkgconfigpath."""
     p = tmp
     bd = Buildout(fp, [])
     bd.offline = False
     recipe = MinitageCommonRecipe(bd, '666', bd['part'])
     recipe._set_pkgconfigpath()
     path = os.environ.get(
         'PKG_CONFIG_PATH', ''
     )
     for elem in ['1a']\
                 + os.environ.get('PKG_CONFIG_PATH','').split(':')\
                 + ['%s/lib/pkgconfig' % dep \
                    for dep in recipe.minitage_dependencies]:
         self.assertTrue(elem in path)
    def testChooseConfigure(self):
        """testChooseConfigure."""
        p = tmp
        os.system("""
cd %s
touch configure
mkdir toto
touch toto/test
""" % (tmp))
        bd = Buildout(fp, [])
        bd.offline = False
        recipe = MinitageCommonRecipe(bd, '666', bd['part'])
        configure = recipe._choose_configure(tmp)
        self.assertEquals(configure, os.path.join(tmp, 'configure'))
        self.assertEquals(recipe.build_dir, tmp)

        recipe.build_dir = os.path.join(tmp, 'toto')
        recipe.configure = 'test'
        configure = recipe._choose_configure(recipe.build_dir)
        self.assertEquals(configure, os.path.join(tmp, 'toto', 'test'))
        self.assertEquals(recipe.build_dir, os.path.join(tmp, 'toto'))
Example #8
0
    def testChooseConfigure(self):
        """testChooseConfigure."""
        p = tmp
        os.system("""
cd %s
touch configure
mkdir toto
touch toto/test
""" % (tmp))
        bd = Buildout(fp, [])
        bd.offline = False
        recipe = MinitageCommonRecipe(bd, '666', bd['part'])
        configure = recipe._choose_configure(tmp)
        self.assertEquals(configure, os.path.join(tmp, 'configure'))
        self.assertEquals(recipe.build_dir, tmp)

        recipe.build_dir = os.path.join(tmp, 'toto')
        recipe.configure = 'test'
        configure = recipe._choose_configure(recipe.build_dir)
        self.assertEquals(configure, os.path.join(tmp, 'toto', 'test'))
        self.assertEquals(recipe.build_dir, os.path.join(tmp, 'toto'))
    def testCompilationFlags(self):
        """testCompilationFlags."""
        p = tmp
        bd = Buildout(fp, [])
        bd.offline = False
        os.environ['LD_RUN_PATH'] = ''
        os.environ['CFLAGS'] = ''
        os.environ['PKG_CONFIG_PATH'] = ''
        os.environ['LDFLAGS'] = ''
        recipe = MinitageCommonRecipe(bd, '666', bd['part'])
        recipe.uname = 'darwin'
        recipe._set_compilation_flags()

        a = os.environ.get('LD_RUN_PATH')
        b = 'a:b:c:d:e:f:%s/lib'% (
            '/lib:'.join(recipe.minitage_dependencies
                         + [recipe.prefix])
                          )
        self.assertEquals(a, b)

        a = os.environ.get('CFLAGS')
        b = '-Ia -Ib -Ic -Id -Ie -If %s' % (
            '-I%s/include' % (
                '/include -I'.join(
                    recipe.minitage_dependencies
                )
            )
        )
        self.assertEquals(a, b)

        self.assertTrue(os.path.join(d, 'dependencies', 'ldep2', 'parts', 'part') in recipe.minitage_dependencies)

        a = '%s%s' %(
                ''.join(['-L%s/lib -Wl,-rpath -Wl,%s/lib ' % (s,s) \
                         for s in ['a','b','c','d','e','f'] \
                         + recipe.minitage_dependencies + [recipe.prefix]]),
                ' -mmacosx-version-min=None   -lc',
            )
        b = os.environ.get('LDFLAGS')
        self.assertEquals(a.replace('   ', ' ').replace('  ', ' '), b)
    def testCallHook(self):
        """testCallHook."""
        p = tmp
        hook = os.path.join(tmp, 'toto.py')
        os.system("""
cd %s
cat << EOF  > %s
import os
def write(options, buildout):
    open(
        os.path.join('%s','foo'),
        'w').write('foo')
EOF""" % (tmp, hook, tmp))
        bd = Buildout(fp, [])
        bd.offline = False
        recipe = MinitageCommonRecipe(bd, '666', bd['part'])
        recipe.options['hook'] = '%s:write' % hook
        recipe._call_hook('hook')
        self.assertEquals(
            open(
                os.path.join(tmp, 'foo')
            ).read(),
            'foo'
        )