Commit 50958d2e authored by Jondy Zhao's avatar Jondy Zhao Committed by Cédric de Saint Martin

Add support for multiple platforms.

parent f10c38e3
This diff is collapsed.
This diff is collapsed.
......@@ -60,6 +60,7 @@ class NonInformativeTests(unittest.TestCase):
}
}
bo.update(buildout)
bo['buildout'].update(buildout_options)
return Recipe(bo, name, options)
def test_working_directory_restored_after_failure(self):
......@@ -199,6 +200,111 @@ class NonInformativeTests(unittest.TestCase):
except ValueError as e:
self.assertEqual(str(e), 'sentinel bar')
def no_test_make_target_with_prefix(self):
recipe = self.make_recipe({}, 'test', {
'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
'configure-command' : './configure',
'pre-install' : 'sed -i -e "s/installing package/installing package at \$\$prefix /g" Makefile',
})
os.chdir(self.dir)
recipe.install()
recipe = self.make_recipe({}, 'test', {
'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
'pre-install' : 'sed -i -e "s/installing package/installing package at \$\$prefix /g" Makefile',
'make-targets' : 'install-lib prefix=%(prefix)s',
})
recipe.install()
def test_download_file(self):
recipe = self.make_recipe({}, 'test', {
'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
})
url = '%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__)
file, is_temp = recipe.download_file(url)
self.assertFalse(is_temp)
self.assertEquals(file, url)
url = 'ftp://ftp.gnu.org/welcome.msg'
file, is_temp = recipe.download_file(url)
self.assertTrue(is_temp)
self.assertTrue(os.path.exists(file))
url = 'ftp://ftp.gnu.org/welcome.msg#ec7ab8024467ba3b6e173c57fd4990f6'
file, is_temp = recipe.download_file(url)
self.assertTrue(is_temp)
self.assertTrue(os.path.exists(file))
url = 'ftp://ftp.gnu.org/welcome.msg#0205'
self.assertRaises(zc.buildout.download.ChecksumError, recipe.download_file, url)
def test_buildout_prefix(self):
buildout_prefix = os.path.join(self.dir, 'test_parts/test_local')
os.makedirs(buildout_prefix)
recipe = self.make_recipe({}, 'test', {
'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
},
prefix=buildout_prefix
)
self.assertEquals(recipe.options.get('prefix'), buildout_prefix)
recipe = self.make_recipe({}, 'test', {
'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
'prefix' : self.dir,
},
prefix=buildout_prefix
)
self.assertEquals(recipe.options.get('prefix'), self.dir)
def test_get_installed_files(self):
prefix = os.path.join(self.dir, 'test_parts/test_local')
os.makedirs(prefix)
recipe = self.make_recipe({}, 'test', {
'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
})
os.chdir(self.dir)
# The hook script does not return anything so we (ab)use exceptions
# as a mechanism for asserting the function behaviour.
no_installed_files = ('a.txt', 'b.txt', 'c', 'c/d.txt')
installed_files = ['e.txt', 'f.txt', 'g', 'g/h.txt']
for s in no_installed_files:
if s.endswith('.txt'):
f = open(os.path.join(prefix, s), 'w')
f.write(s)
f.close()
else:
os.makedirs(os.path.join(prefix, s))
sleep(2)
ref_path = os.path.join(self.dir, 'refs')
os.makedirs(ref_path)
sleep(2)
for s in installed_files:
if s.endswith('.txt'):
f = open(os.path.join(prefix, s), 'w')
f.write(s)
f.close()
else:
os.makedirs(os.path.join(prefix, s))
recipe.buildout_prefix = prefix
file_list = recipe.get_installed_files(ref_path)
installed_files.pop(2)
self.assertEquals([os.path.relpath(f, prefix) for f in file_list], installed_files)
def test_honor_buidlout_keep_compile_directory(self):
buildout = {'keep-compile-dir' : 'true'}
recipe = self.make_recipe({}, 'test', {
'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
},
**buildout
)
os.chdir(self.dir)
recipe.install()
build_directory = os.path.join(self.dir, 'test_parts/test__compile__')
self.assertTrue(os.path.exists(build_directory))
def test_suite():
suite = unittest.TestSuite((
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment