本文整理汇总了Python中egginst.main.EggInst类的典型用法代码示例。如果您正苦于以下问题:Python EggInst类的具体用法?Python EggInst怎么用?Python EggInst使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EggInst类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _compute_target_list
def _compute_target_list(path, d):
# FIXME: we need this hack as the internal EggInst zipfile
# object is only available within an EggInst.install call.
egg_inst = EggInst(path, d)
egg_inst.z = zp
return _compute_targets(egg_inst.iter_targets(), egg_inst.prefix)
示例2: test_simple_custom_egg_remove
def test_simple_custom_egg_remove(self):
egg = DUMMY_EGG
with assert_same_fs(self, self.base_dir):
egginst = EggInst(egg, self.base_dir)
egginst.install()
egginst.remove()
示例3: test_custom_egg_with_usr_files_remove
def test_custom_egg_with_usr_files_remove(self):
egg = NOSE_1_3_0
with assert_same_fs(self, self.base_dir):
egginst = EggInst(egg, self.base_dir)
egginst.install()
egginst.remove()
示例4: test_custom_egg_with_usr_files
def test_custom_egg_with_usr_files(self):
custom_egg_info_base = os.path.join(self.base_dir, "EGG-INFO", "nose")
egg_info_base = os.path.join(self.site_packages,
"nose-{0}.egg-info".
format("1.3.0-1"))
egg = NOSE_1_3_0
egginst = EggInst(egg, self.base_dir)
egginst.install()
# Check for files installed in $prefix/EGG-INFO
for f in DUMMY_EGG_METADATA_FILES:
path = os.path.join(custom_egg_info_base, f)
self.assertTrue(os.path.exists(path))
# Check for files installed in $site-packages/$package_egg_info-INFO
path = os.path.join(egg_info_base, "PKG-INFO")
self.assertTrue(os.path.exists(path))
path = os.path.join(egg_info_base, "spec/depend")
self.assertFalse(os.path.exists(path))
path = os.path.join(egg_info_base, "spec/summary")
self.assertFalse(os.path.exists(path))
path = os.path.join(egg_info_base, "usr/share/man/man1/nosetests.1")
self.assertFalse(os.path.exists(path))
示例5: test_custom_egg_legacy_egg_info_remove
def test_custom_egg_legacy_egg_info_remove(self):
egg = LEGACY_EGG_INFO_EGG
with assert_same_fs(self, self.base_dir):
egginst = EggInst(egg, self.base_dir)
egginst.install()
egginst.remove()
示例6: test_custom_egg_legacy_egg_info
def test_custom_egg_legacy_egg_info(self):
custom_egg_info_base = os.path.join(self.base_dir, "EGG-INFO", "flake8")
egg_info_base = os.path.join(self.site_packages,
"flake8-2.0.0-2.egg-info")
legacy_egg_info_base = os.path.join(self.site_packages, "flake8.egg-info")
custom_metadata = ("PKG-INFO.bak", "requires.txt", "spec/depend",
"spec/summary")
egg = LEGACY_EGG_INFO_EGG
egginst = EggInst(egg, self.base_dir)
egginst.install()
# Check for files installed in $prefix/EGG-INFO
for f in custom_metadata:
path = os.path.join(custom_egg_info_base, f)
self.assertTrue(os.path.exists(path))
# Check for files installed in $site-packages/$package_egg_info-INFO
for f in LEGACY_EGG_INFO_EGG_METADATA_FILES:
path = os.path.join(egg_info_base, f)
self.assertTrue(os.path.exists(path))
for f in LEGACY_EGG_INFO_EGG_METADATA_FILES:
path = os.path.join(legacy_egg_info_base, f)
self.assertFalse(os.path.exists(path))
示例7: test_symlink
def test_symlink(self):
"""Test installing an egg with softlink in it."""
# Given
if sys.platform == "win32":
incdir = os.path.join(self.prefix, "EGG-INFO", "foo", "usr",
"include")
header = os.path.join(incdir, "foo.h")
link = os.path.join(self.prefix, "EGG-INFO", "foo", "usr",
"HEADERS")
else:
incdir = os.path.join(self.prefix, "include")
header = os.path.join(incdir, "foo.h")
link = os.path.join(self.prefix, "HEADERS")
egg_filename = os.path.join(self.base_dir, "foo-1.0.egg")
_create_egg_with_symlink(egg_filename, "foo")
# When
installer = EggInst(egg_filename, prefix=self.prefix)
installer.install()
# Then
self.assertTrue(os.path.exists(header))
self.assertTrue(os.path.exists(link))
self.assertTrue(os.path.islink(link))
self.assertEqual(os.readlink(link), "include")
self.assertTrue(os.path.exists(os.path.join(link, "foo.h")))
示例8: test_old_appinst
def test_old_appinst(self):
"""
Test that we still work with old (<= 2.1.1) appinst, where
[un]install_from_dat only takes one argument (no prefix).
"""
egg_path = DUMMY_EGG_WITH_APPINST
appinst_path = os.path.join(self.meta_dir, "dummy_with_appinst", eggmeta.APPINST_PATH)
egginst = EggInst(egg_path, self.base_dir)
def mocked_old_install_from_dat(x):
pass
def mocked_old_uninstall_from_dat(x):
pass
# XXX: we use autospec to enforce function taking exactly one argument,
# otherwise the proper TypeError exception is not raised when calling
# it with two arguments, which is how old vs new appinst is detected.
with mock.patch("appinst.install_from_dat", autospec=mocked_old_install_from_dat) as m:
egginst.install()
m.assert_called_with(appinst_path)
with mock.patch("appinst.uninstall_from_dat", autospec=mocked_old_uninstall_from_dat) as m:
egginst.remove()
m.assert_called_with(appinst_path)
示例9: test_softlink_with_broken_entry
def test_softlink_with_broken_entry(self):
# Given
path = VTK_EGG_DEFERRED_SOFTLINK
# When
installer = EggInst(path, prefix=self.prefix)
installer.install()
示例10: test_standard_egg_remove
def test_standard_egg_remove(self):
egg = STANDARD_EGG
with assert_same_fs(self, self.base_dir):
egginst = EggInst(egg, self.base_dir)
egginst.install()
egginst.remove()
示例11: _install_egg_empty_egg_info_dir
def _install_egg_empty_egg_info_dir(self, egg_path):
installer = EggInst(egg_path, prefix=self.prefix)
installer.install()
egg_info_dir = os.path.join(installer.site_packages,
setuptools_egg_info_dir(egg_path))
shutil.rmtree(egg_info_dir)
os.makedirs(egg_info_dir)
示例12: test_simple
def test_simple(self):
egginst = EggInst(DUMMY_EGG, self.base_dir)
egginst.install()
self.assertTrue(os.path.exists(os.path.join(self.site_packages, "dummy.py")))
egginst.remove()
self.assertFalse(os.path.exists(os.path.join(self.site_packages, "dummy.py")))
示例13: _install_egg_file_egg_info_dir
def _install_egg_file_egg_info_dir(self, egg_path):
installer = EggInst(egg_path, prefix=self.prefix)
installer.install()
egg_info_dir = os.path.join(installer.site_packages,
setuptools_egg_info_dir(egg_path))
shutil.rmtree(egg_info_dir)
with open(egg_info_dir, "w") as fp:
fp.write("")
示例14: test_simple_custom_egg_remove
def test_simple_custom_egg_remove(self):
custom_egg_info_base = os.path.join(self.base_dir, "EGG-INFO", "dummy")
egg_info_base = os.path.join(self.site_packages,
"dummy-{0}.egg-info". \
format("1.0.1-1"))
egg = DUMMY_EGG
with assert_same_fs(self, self.base_dir):
egginst = EggInst(egg, self.base_dir)
egginst.install()
egginst.remove()
示例15: test_find_lib_with_targets
def test_find_lib_with_targets(self):
"""
Test we handle the targets.dat hack correctly in find_lib.
"""
with mkdtemp() as d:
with mock.patch("egginst.object_code._targets", []):
egg_inst = EggInst(DUMMY_EGG_WITH_INST_TARGETS, d)
egg_inst.install()
path = "libfoo.dylib"
self.assertEqual(find_lib(path), op.join(d, "lib", "foo-4.2", path))