本文整理汇总了Python中portage.shutil.rmtree函数的典型用法代码示例。如果您正苦于以下问题:Python rmtree函数的具体用法?Python rmtree怎么用?Python rmtree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rmtree函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: binTestsCleanup
def binTestsCleanup():
global basedir
if basedir is None:
return
if os.access(basedir, os.W_OK):
shutil.rmtree(basedir)
basedir = None
开发者ID:gentoo,项目名称:portage,代码行数:7,代码来源:setup_env.py
示例2: _testAsynchronousLockWait
def _testAsynchronousLockWait(self):
scheduler = global_event_loop()
tempdir = tempfile.mkdtemp()
try:
path = os.path.join(tempdir, 'lock_me')
lock1 = AsynchronousLock(path=path, scheduler=scheduler)
lock1.start()
self.assertEqual(lock1.wait(), os.EX_OK)
self.assertEqual(lock1.returncode, os.EX_OK)
# lock2 requires _force_async=True since the portage.locks
# module is not designed to work as intended here if the
# same process tries to lock the same file more than
# one time concurrently.
lock2 = AsynchronousLock(path=path, scheduler=scheduler,
_force_async=True, _force_process=True)
lock2.start()
# lock2 should be waiting for lock1 to release
self.assertEqual(lock2.poll(), None)
self.assertEqual(lock2.returncode, None)
lock1.unlock()
self.assertEqual(lock2.wait(), os.EX_OK)
self.assertEqual(lock2.returncode, os.EX_OK)
lock2.unlock()
finally:
shutil.rmtree(tempdir)
开发者ID:dol-sen,项目名称:portage,代码行数:27,代码来源:test_asynchronous_lock.py
示例3: _chpathtool_exit
def _chpathtool_exit(self, chpathtool):
if self._final_exit(chpathtool) != os.EX_OK:
self._unlock_builddir()
self._writemsg_level("!!! Error Adjusting Prefix to %s\n" %
(self.settings["EPREFIX"],),
noiselevel=-1, level=logging.ERROR)
self.wait()
return
# We want to install in "our" prefix, not the binary one
with io.open(_unicode_encode(os.path.join(self._infloc, "EPREFIX"),
encoding=_encodings['fs'], errors='strict'), mode='w',
encoding=_encodings['repo.content'], errors='strict') as f:
f.write(self.settings["EPREFIX"] + "\n")
# Move the files to the correct location for merge.
image_tmp_dir = os.path.join(
self.settings["PORTAGE_BUILDDIR"], "image_tmp")
build_d = os.path.join(self.settings["D"],
self._build_prefix.lstrip(os.sep))
if not os.path.isdir(build_d):
# Assume this is a virtual package or something.
shutil.rmtree(self._image_dir)
ensure_dirs(self.settings["ED"])
else:
os.rename(build_d, image_tmp_dir)
shutil.rmtree(self._image_dir)
ensure_dirs(os.path.dirname(self.settings["ED"].rstrip(os.sep)))
os.rename(image_tmp_dir, self.settings["ED"])
self.wait()
开发者ID:aeroniero33,项目名称:portage,代码行数:31,代码来源:Binpkg.py
示例4: _testAsynchronousLockWaitKill
def _testAsynchronousLockWaitKill(self):
scheduler = global_event_loop()
tempdir = tempfile.mkdtemp()
try:
path = os.path.join(tempdir, 'lock_me')
lock1 = AsynchronousLock(path=path, scheduler=scheduler)
lock1.start()
self.assertEqual(lock1.wait(), os.EX_OK)
self.assertEqual(lock1.returncode, os.EX_OK)
lock2 = AsynchronousLock(path=path, scheduler=scheduler,
_force_async=True, _force_process=True)
lock2.start()
# lock2 should be waiting for lock1 to release
self.assertEqual(lock2.poll(), None)
self.assertEqual(lock2.returncode, None)
# Kill lock2's process and then check wait() and
# returncode results. This is intended to simulate
# a SIGINT sent via the controlling tty.
self.assertEqual(lock2._imp is not None, True)
self.assertEqual(lock2._imp._proc is not None, True)
self.assertEqual(lock2._imp._proc.pid is not None, True)
lock2._imp._kill_test = True
os.kill(lock2._imp._proc.pid, signal.SIGTERM)
self.assertEqual(lock2.wait() == os.EX_OK, False)
self.assertEqual(lock2.returncode == os.EX_OK, False)
self.assertEqual(lock2.returncode is None, False)
lock1.unlock()
finally:
shutil.rmtree(tempdir)
开发者ID:dol-sen,项目名称:portage,代码行数:30,代码来源:test_asynchronous_lock.py
示例5: _testLockNonblock
def _testLockNonblock(self):
tempdir = tempfile.mkdtemp()
try:
path = os.path.join(tempdir, 'lock_me')
lock1 = portage.locks.lockfile(path)
pid = os.fork()
if pid == 0:
portage.locks._close_fds()
# Disable close_fds since we don't exec
# (see _setup_pipes docstring).
portage.process._setup_pipes({0:0, 1:1, 2:2}, close_fds=False)
rval = 2
try:
try:
lock2 = portage.locks.lockfile(path, flags=os.O_NONBLOCK)
except portage.exception.TryAgain:
rval = os.EX_OK
else:
rval = 1
portage.locks.unlockfile(lock2)
except SystemExit:
raise
except:
traceback.print_exc()
finally:
os._exit(rval)
self.assertEqual(pid > 0, True)
pid, status = os.waitpid(pid, 0)
self.assertEqual(os.WIFEXITED(status), True)
self.assertEqual(os.WEXITSTATUS(status), os.EX_OK)
portage.locks.unlockfile(lock1)
finally:
shutil.rmtree(tempdir)
开发者ID:Spencerx,项目名称:portage,代码行数:35,代码来源:test_lock_nonblock.py
示例6: _prepare_fake_distdir
def _prepare_fake_distdir(settings, alist):
orig_distdir = settings["DISTDIR"]
edpath = os.path.join(settings["PORTAGE_BUILDDIR"], "distdir")
portage.util.ensure_dirs(edpath, gid=portage_gid, mode=0o755)
# Remove any unexpected files or directories.
for x in os.listdir(edpath):
symlink_path = os.path.join(edpath, x)
st = os.lstat(symlink_path)
if x in alist and stat.S_ISLNK(st.st_mode):
continue
if stat.S_ISDIR(st.st_mode):
shutil.rmtree(symlink_path)
else:
os.unlink(symlink_path)
# Check for existing symlinks and recreate if necessary.
for x in alist:
symlink_path = os.path.join(edpath, x)
target = os.path.join(orig_distdir, x)
try:
link_target = os.readlink(symlink_path)
except OSError:
os.symlink(target, symlink_path)
else:
if link_target != target:
os.unlink(symlink_path)
os.symlink(target, symlink_path)
开发者ID:gentoo,项目名称:portage,代码行数:28,代码来源:prepare_build_dirs.py
示例7: _testAsynchronousLock
def _testAsynchronousLock(self):
scheduler = global_event_loop()
tempdir = tempfile.mkdtemp()
try:
path = os.path.join(tempdir, 'lock_me')
for force_async, async_unlock in itertools.product(
(True, False), repeat=2):
for force_dummy in (True, False):
async_lock = AsynchronousLock(path=path,
scheduler=scheduler, _force_async=force_async,
_force_thread=True,
_force_dummy=force_dummy)
async_lock.start()
self.assertEqual(async_lock.wait(), os.EX_OK)
self.assertEqual(async_lock.returncode, os.EX_OK)
if async_unlock:
scheduler.run_until_complete(async_lock.async_unlock())
else:
async_lock.unlock()
async_lock = AsynchronousLock(path=path,
scheduler=scheduler, _force_async=force_async,
_force_process=True)
async_lock.start()
self.assertEqual(async_lock.wait(), os.EX_OK)
self.assertEqual(async_lock.returncode, os.EX_OK)
if async_unlock:
scheduler.run_until_complete(async_lock.async_unlock())
else:
async_lock.unlock()
finally:
shutil.rmtree(tempdir)
开发者ID:dol-sen,项目名称:portage,代码行数:32,代码来源:test_asynchronous_lock.py
示例8: testSetCpv
def testSetCpv(self):
"""
Test the clone via constructor.
"""
ebuilds = {
"dev-libs/A-1": {"IUSE": "static-libs"},
"dev-libs/B-1": {"IUSE": "static-libs"},
}
env_files = {
"A" : ("USE=\"static-libs\"",)
}
package_env = (
"dev-libs/A A",
)
eprefix = normalize_path(tempfile.mkdtemp())
playground = None
try:
user_config_dir = os.path.join(eprefix, USER_CONFIG_PATH)
os.makedirs(user_config_dir)
with io.open(os.path.join(user_config_dir, "package.env"),
mode='w', encoding=_encodings['content']) as f:
for line in package_env:
f.write(line + "\n")
env_dir = os.path.join(user_config_dir, "env")
os.makedirs(env_dir)
for k, v in env_files.items():
with io.open(os.path.join(env_dir, k), mode='w',
encoding=_encodings['content']) as f:
for line in v:
f.write(line + "\n")
playground = ResolverPlayground(eprefix=eprefix, ebuilds=ebuilds)
settings = config(clone=playground.settings)
result = playground.run(["=dev-libs/A-1"])
pkg, existing_node = result.depgraph._select_package(
playground.eroot, Atom("=dev-libs/A-1"))
settings.setcpv(pkg)
self.assertTrue("static-libs" in
settings["PORTAGE_USE"].split())
# Test bug #522362, where a USE=static-libs package.env
# setting leaked from one setcpv call to the next.
pkg, existing_node = result.depgraph._select_package(
playground.eroot, Atom("=dev-libs/B-1"))
settings.setcpv(pkg)
self.assertTrue("static-libs" not in
settings["PORTAGE_USE"].split())
finally:
if playground is None:
shutil.rmtree(eprefix)
else:
playground.cleanup()
开发者ID:gentoo,项目名称:portage,代码行数:60,代码来源:test_config.py
示例9: _testAsynchronousLock
def _testAsynchronousLock(self):
scheduler = global_event_loop()
tempdir = tempfile.mkdtemp()
try:
path = os.path.join(tempdir, 'lock_me')
for force_async in (True, False):
for force_dummy in (True, False):
async_lock = AsynchronousLock(path=path,
scheduler=scheduler, _force_async=force_async,
_force_thread=True,
_force_dummy=force_dummy)
async_lock.start()
self.assertEqual(async_lock.wait(), os.EX_OK)
self.assertEqual(async_lock.returncode, os.EX_OK)
async_lock.unlock()
async_lock = AsynchronousLock(path=path,
scheduler=scheduler, _force_async=force_async,
_force_process=True)
async_lock.start()
self.assertEqual(async_lock.wait(), os.EX_OK)
self.assertEqual(async_lock.returncode, os.EX_OK)
async_lock.unlock()
finally:
shutil.rmtree(tempdir)
开发者ID:Spencerx,项目名称:portage,代码行数:26,代码来源:test_asynchronous_lock.py
示例10: testGetConfigSourceLex
def testGetConfigSourceLex(self):
try:
tempdir = tempfile.mkdtemp()
make_conf_file = os.path.join(tempdir, 'make.conf')
with open(make_conf_file, 'w') as f:
f.write('source "${DIR}/sourced_file"\n')
sourced_file = os.path.join(tempdir, 'sourced_file')
with open(sourced_file, 'w') as f:
f.write('PASSES_SOURCING_TEST="True"\n')
d = getconfig(
make_conf_file, allow_sourcing=True, expand={"DIR": tempdir})
# PASSES_SOURCING_TEST should exist in getconfig result.
self.assertTrue(d is not None)
self.assertEqual("True", d['PASSES_SOURCING_TEST'])
# With allow_sourcing=True and empty expand map, this should
# throw a FileNotFound exception.
self.assertRaisesMsg(
"An empty expand map should throw an exception",
ParseError,
getconfig,
make_conf_file,
allow_sourcing=True,
expand={})
finally:
shutil.rmtree(tempdir)
开发者ID:amadio,项目名称:portage,代码行数:28,代码来源:test_getconfig.py
示例11: cleanup
def cleanup(self):
for eroot in self.trees:
portdb = self.trees[eroot]["porttree"].dbapi
portdb.close_caches()
if self.debug:
print("\nEROOT=%s" % self.eroot)
else:
shutil.rmtree(self.eroot)
开发者ID:monsieurp,项目名称:portage,代码行数:8,代码来源:ResolverPlayground.py
示例12: cleanup
def cleanup(self):
portdb = self.trees[self.eroot]["porttree"].dbapi
portdb.close_caches()
portage.dbapi.porttree.portdbapi.portdbapi_instances.remove(portdb)
if self.debug:
print("\nEROOT=%s" % self.eroot)
else:
shutil.rmtree(self.eroot)
开发者ID:zy-sunshine,项目名称:easymgc,代码行数:8,代码来源:ResolverPlayground.py
示例13: testFakedbapi
def testFakedbapi(self):
packages = (
("sys-apps/portage-2.1.10", {
"EAPI" : "2",
"IUSE" : "ipc doc",
"repository" : "gentoo",
"SLOT" : "0",
"USE" : "ipc missing-iuse",
}),
("virtual/package-manager-0", {
"EAPI" : "0",
"repository" : "gentoo",
"SLOT" : "0",
}),
)
match_tests = (
("sys-apps/portage:0[ipc]", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0[-ipc]", []),
("sys-apps/portage:0[doc]", []),
("sys-apps/portage:0[-doc]", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0[missing-iuse]", []),
("sys-apps/portage:0[-missing-iuse]", []),
("sys-apps/portage:0::gentoo[ipc]", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0::multilib[ipc]", []),
("virtual/package-manager", ["virtual/package-manager-0"]),
)
tempdir = tempfile.mkdtemp()
try:
test_repo = os.path.join(tempdir, "var", "repositories", "test_repo")
os.makedirs(os.path.join(test_repo, "profiles"))
with open(os.path.join(test_repo, "profiles", "repo_name"), "w") as f:
f.write("test_repo")
env = {
"PORTAGE_REPOSITORIES": "[DEFAULT]\nmain-repo = test_repo\n[test_repo]\nlocation = %s" % test_repo
}
# Tests may override portage.const.EPREFIX in order to
# simulate a prefix installation. It's reasonable to do
# this because tests should be self-contained such that
# the "real" value of portage.const.EPREFIX is entirely
# irrelevant (see bug #492932).
portage.const.EPREFIX = tempdir
fakedb = fakedbapi(settings=config(config_profile_path="",
env=env, eprefix=tempdir))
for cpv, metadata in packages:
fakedb.cpv_inject(cpv, metadata=metadata)
for atom, expected_result in match_tests:
result = fakedb.match(atom)
self.assertEqual(fakedb.match(atom), expected_result,
"fakedb.match('%s') = %s != %s" %
(atom, result, expected_result))
finally:
shutil.rmtree(tempdir)
开发者ID:aeroniero33,项目名称:portage,代码行数:58,代码来源:test_fakedbapi.py
示例14: cleanup
def cleanup(self, datadir):
datadir_split = os.path.split(datadir)
if len(datadir_split) >= 2 and len(datadir_split[1]) > 0:
# This is potentially dangerous,
# thus the above sanity check.
try:
shutil.rmtree(datadir)
except OSError as oe:
if oe.errno == errno.ENOENT:
pass
else:
raise oe
开发者ID:amadio,项目名称:portage,代码行数:12,代码来源:xpak.py
示例15: get_commit_message_with_editor
def get_commit_message_with_editor(editor, message=None, prefix=""):
"""
Execute editor with a temporary file as it's argument
and return the file content afterwards.
@param editor: An EDITOR value from the environment
@type: string
@param message: An iterable of lines to show in the editor.
@type: iterable
@param prefix: Suggested prefix for the commit message summary line.
@type: string
@rtype: string or None
@return: A string on success or None if an error occurs.
"""
commitmessagedir = tempfile.mkdtemp(".repoman.msg")
filename = os.path.join(commitmessagedir, "COMMIT_EDITMSG")
try:
with open(filename, "wb") as mymsg:
mymsg.write(
_unicode_encode(_(
prefix +
"\n\n# Please enter the commit message "
"for your changes.\n# (Comment lines starting "
"with '#' will not be included)\n"),
encoding=_encodings['content'], errors='backslashreplace'))
if message:
mymsg.write(b"#\n")
for line in message:
mymsg.write(
_unicode_encode(
"#" + line, encoding=_encodings['content'],
errors='backslashreplace'))
retval = os.system(editor + " '%s'" % filename)
if not (os.WIFEXITED(retval) and os.WEXITSTATUS(retval) == os.EX_OK):
return None
try:
with io.open(_unicode_encode(
filename, encoding=_encodings['fs'], errors='strict'),
mode='r', encoding=_encodings['content'], errors='replace') as f:
mylines = f.readlines()
except OSError as e:
if e.errno != errno.ENOENT:
raise
del e
return None
return "".join(line for line in mylines if not line.startswith("#"))
finally:
try:
shutil.rmtree(commitmessagedir)
except OSError:
pass
开发者ID:mgorny,项目名称:portage,代码行数:51,代码来源:utilities.py
示例16: testFakedbapi
def testFakedbapi(self):
packages = (
("sys-apps/portage-2.1.10", {
"EAPI" : "2",
"IUSE" : "ipc doc",
"repository" : "gentoo",
"SLOT" : "0",
"USE" : "ipc missing-iuse",
}),
("virtual/package-manager-0", {
"EAPI" : "0",
"repository" : "gentoo",
"SLOT" : "0",
}),
)
match_tests = (
("sys-apps/portage:0[ipc]", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0[-ipc]", []),
("sys-apps/portage:0[doc]", []),
("sys-apps/portage:0[-doc]", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0[missing-iuse]", []),
("sys-apps/portage:0[-missing-iuse]", []),
("sys-apps/portage:0::gentoo[ipc]", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0::multilib[ipc]", []),
("virtual/package-manager", ["virtual/package-manager-0"]),
)
tempdir = tempfile.mkdtemp()
try:
portdir = os.path.join(tempdir, "usr/portage")
os.makedirs(portdir)
env = {
"PORTDIR": portdir,
}
fakedb = fakedbapi(settings=config(config_profile_path="",
env=env, eprefix=tempdir))
for cpv, metadata in packages:
fakedb.cpv_inject(cpv, metadata=metadata)
for atom, expected_result in match_tests:
result = fakedb.match(atom)
self.assertEqual(fakedb.match(atom), expected_result,
"fakedb.match('%s') = %s != %s" %
(atom, result, expected_result))
finally:
shutil.rmtree(tempdir)
开发者ID:clickbeetle,项目名称:portage-cb,代码行数:48,代码来源:test_fakedbapi.py
示例17: diff_mixed
def diff_mixed(func, file1, file2):
tempdir = None
try:
if os.path.islink(file1) and \
not os.path.islink(file2) and \
os.path.isfile(file1) and \
os.path.isfile(file2):
# If a regular file replaces a symlink to a regular
# file, then show the diff between the regular files
# (bug #330221).
diff_files = (file2, file2)
else:
files = [file1, file2]
diff_files = [file1, file2]
for i in range(len(diff_files)):
try:
st = os.lstat(diff_files[i])
except OSError:
st = None
if st is not None and stat.S_ISREG(st.st_mode):
continue
if tempdir is None:
tempdir = tempfile.mkdtemp()
diff_files[i] = os.path.join(tempdir, "%d" % i)
if st is None:
content = "/dev/null\n"
elif stat.S_ISLNK(st.st_mode):
link_dest = os.readlink(files[i])
content = "SYM: %s -> %s\n" % \
(file1, link_dest)
elif stat.S_ISDIR(st.st_mode):
content = "DIR: %s\n" % (file1,)
elif stat.S_ISFIFO(st.st_mode):
content = "FIF: %s\n" % (file1,)
else:
content = "DEV: %s\n" % (file1,)
with io.open(diff_files[i], mode='w',
encoding=_encodings['stdio']) as f:
f.write(content)
return func(diff_files[0], diff_files[1])
finally:
if tempdir is not None:
shutil.rmtree(tempdir)
开发者ID:aeroniero33,项目名称:portage,代码行数:46,代码来源:dispatch_conf.py
示例18: testFakedbapi
def testFakedbapi(self):
packages = (
(
"sys-apps/portage-2.1.10",
{"EAPI": "2", "IUSE": "ipc doc", "repository": "gentoo", "SLOT": "0", "USE": "ipc missing-iuse"},
),
("virtual/package-manager-0", {"EAPI": "0", "repository": "gentoo", "SLOT": "0"}),
)
match_tests = (
("sys-apps/portage:0[ipc]", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0[-ipc]", []),
("sys-apps/portage:0[doc]", []),
("sys-apps/portage:0[-doc]", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0[missing-iuse]", []),
("sys-apps/portage:0[-missing-iuse]", []),
("sys-apps/portage:0::gentoo[ipc]", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0::multilib[ipc]", []),
("virtual/package-manager", ["virtual/package-manager-0"]),
)
tempdir = tempfile.mkdtemp()
try:
test_repo = os.path.join(tempdir, "var", "repositories", "test_repo")
os.makedirs(os.path.join(test_repo, "profiles"))
with open(os.path.join(test_repo, "profiles", "repo_name"), "w") as f:
f.write("test_repo")
env = {"PORTAGE_REPOSITORIES": "[DEFAULT]\nmain-repo = test_repo\n[test_repo]\nlocation = %s" % test_repo}
fakedb = fakedbapi(settings=config(config_profile_path="", env=env, eprefix=tempdir))
for cpv, metadata in packages:
fakedb.cpv_inject(cpv, metadata=metadata)
for atom, expected_result in match_tests:
result = fakedb.match(atom)
self.assertEqual(
fakedb.match(atom),
expected_result,
"fakedb.match('%s') = %s != %s" % (atom, result, expected_result),
)
finally:
shutil.rmtree(tempdir)
开发者ID:nullishzero,项目名称:portage-1,代码行数:42,代码来源:test_fakedbapi.py
示例19: _set_returncode
def _set_returncode(self, wait_retval):
SpawnProcess._set_returncode(self, wait_retval)
if self.cgroup is not None:
try:
shutil.rmtree(self.cgroup)
except EnvironmentError as e:
if e.errno != errno.ENOENT:
raise
if self._exit_timeout_id is not None:
self.scheduler.source_remove(self._exit_timeout_id)
self._exit_timeout_id = None
if self._ipc_daemon is not None:
self._ipc_daemon.cancel()
if self._exit_command.exitcode is not None:
self.returncode = self._exit_command.exitcode
else:
if self.returncode < 0:
if not self.cancelled:
self._killed_by_signal(-self.returncode)
else:
self.returncode = 1
if not self.cancelled:
self._unexpected_exit()
if self._build_dir is not None:
self._build_dir.unlock()
self._build_dir = None
elif not self.cancelled:
exit_file = self.settings.get('PORTAGE_EBUILD_EXIT_FILE')
if exit_file and not os.path.exists(exit_file):
if self.returncode < 0:
if not self.cancelled:
self._killed_by_signal(-self.returncode)
else:
self.returncode = 1
if not self.cancelled:
self._unexpected_exit()
开发者ID:helb,项目名称:portage,代码行数:39,代码来源:AbstractEbuildProcess.py
示例20: _testAsynchronousLockWaitCancel
def _testAsynchronousLockWaitCancel(self):
scheduler = global_event_loop()
tempdir = tempfile.mkdtemp()
try:
path = os.path.join(tempdir, 'lock_me')
lock1 = AsynchronousLock(path=path, scheduler=scheduler)
lock1.start()
self.assertEqual(lock1.wait(), os.EX_OK)
self.assertEqual(lock1.returncode, os.EX_OK)
lock2 = AsynchronousLock(path=path, scheduler=scheduler,
_force_async=True, _force_process=True)
lock2.start()
# lock2 should be waiting for lock1 to release
self.assertEqual(lock2.poll(), None)
self.assertEqual(lock2.returncode, None)
# Cancel lock2 and then check wait() and returncode results.
lock2.cancel()
self.assertEqual(lock2.wait() == os.EX_OK, False)
self.assertEqual(lock2.returncode == os.EX_OK, False)
self.assertEqual(lock2.returncode is None, False)
lock1.unlock()
finally:
shutil.rmtree(tempdir)
开发者ID:dol-sen,项目名称:portage,代码行数:24,代码来源:test_asynchronous_lock.py
注:本文中的portage.shutil.rmtree函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论