本文整理汇总了Python中portage.os.makedirs函数的典型用法代码示例。如果您正苦于以下问题:Python makedirs函数的具体用法?Python makedirs怎么用?Python makedirs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makedirs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
super(RepomanEchangelogTestCase, self).setUp()
self.tmpdir = tempfile.mkdtemp(prefix='repoman.echangelog.')
self.skel_changelog = os.path.join(self.tmpdir, 'skel.ChangeLog')
skel = [
'# ChangeLog for <CATEGORY>/<PACKAGE_NAME>\n',
'# Copyright 1999-2000 Gentoo Foundation; Distributed under the GPL v2\n',
'# $Header: $\n'
]
self._writelines(self.skel_changelog, skel)
self.cat = 'mycat'
self.pkg = 'mypkg'
self.pkgdir = os.path.join(self.tmpdir, self.cat, self.pkg)
os.makedirs(self.pkgdir)
self.header_pkg = '# ChangeLog for %s/%s\n' % (self.cat, self.pkg)
self.header_copyright = '# Copyright 1999-%s Gentoo Foundation; Distributed under the GPL v2\n' % \
time.strftime('%Y', time.gmtime())
self.header_cvs = '# $Header: $\n'
self.changelog = os.path.join(self.pkgdir, 'ChangeLog')
self.user = 'Testing User <[email protected]>'
开发者ID:Spencerx,项目名称:portage,代码行数:26,代码来源:test_echangelog.py
示例2: __init__
def __init__(self, ebuilds={}, installed={}, profile={}, repo_configs={}, \
user_config={}, sets={}, world=[], world_sets=[], distfiles={}, debug=False):
"""
ebuilds: cpv -> metadata mapping simulating available ebuilds.
installed: cpv -> metadata mapping simulating installed packages.
If a metadata key is missing, it gets a default value.
profile: settings defined by the profile.
"""
self.debug = debug
self.eprefix = normalize_path(tempfile.mkdtemp())
self.eroot = self.eprefix + os.sep
self.distdir = os.path.join(self.eroot, "var", "portage", "distfiles")
self.portdir = os.path.join(self.eroot, "usr/portage")
self.vdbdir = os.path.join(self.eroot, "var/db/pkg")
os.makedirs(self.portdir)
os.makedirs(self.vdbdir)
if not debug:
portage.util.noiselimit = -2
self.repo_dirs = {}
#Make sure the main repo is always created
self._get_repo_dir("test_repo")
self._create_distfiles(distfiles)
self._create_ebuilds(ebuilds)
self._create_installed(installed)
self._create_profile(ebuilds, installed, profile, repo_configs, user_config, sets)
self._create_world(world, world_sets)
self.settings, self.trees = self._load_config()
self._create_ebuild_manifests(ebuilds)
portage.util.noiselimit = 0
开发者ID:zy-sunshine,项目名称:easymgc,代码行数:35,代码来源:ResolverPlayground.py
示例3: __init__
def __init__(self, ebuilds={}, installed={}, profile={}, user_config={}, sets={}, world=[], debug=False):
"""
ebuilds: cpv -> metadata mapping simulating avaiable ebuilds.
installed: cpv -> metadata mapping simulating installed packages.
If a metadata key is missing, it gets a default value.
profile: settings defined by the profile.
"""
self.debug = debug
self.root = "/"
self.eprefix = tempfile.mkdtemp()
self.eroot = self.root + self.eprefix.lstrip(os.sep) + os.sep
self.portdir = os.path.join(self.eroot, "usr/portage")
self.vdbdir = os.path.join(self.eroot, "var/db/pkg")
os.makedirs(self.portdir)
os.makedirs(self.vdbdir)
if not debug:
portage.util.noiselimit = -2
self._create_ebuilds(ebuilds)
self._create_installed(installed)
self._create_profile(ebuilds, installed, profile, user_config, sets)
self._create_world(world)
self.settings, self.trees = self._load_config()
self._create_ebuild_manifests(ebuilds)
portage.util.noiselimit = 0
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:29,代码来源:ResolverPlayground.py
示例4: save_cache
def save_cache(logger, to_save={}, temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
''' Tries to store caching information.
@param logger
@param to_save have to be dict with keys:
libraries, la_libraries, libraries_links and binaries
'''
if not os.path.exists(temp_path):
os.makedirs(temp_path)
try:
_file = open(_unicode_encode(os.path.join(temp_path, 'timestamp'),
encoding=_encodings['fs']), mode='w', encoding=_encodings['content'])
_file.write(_unicode(int(time.time())))
_file.close()
for key,val in to_save.items():
_file = open(_unicode_encode(os.path.join(temp_path, key),
encoding=_encodings['fs']), mode='w',
encoding=_encodings['content'])
for line in val:
_file.write(line + '\n')
_file.close()
except Exception as ex:
logger.warning('\t' + red('Could not save cache: %s' %str(ex)))
开发者ID:zmedico,项目名称:gentoolkit,代码行数:25,代码来源:cache.py
示例5: xpand
def xpand(myid, mydest):
mydest = normalize_path(mydest) + os.sep
myindex = myid[0]
mydata = myid[1]
myindexlen = len(myindex)
startpos = 0
while ((startpos + 8) < myindexlen):
namelen = decodeint(myindex[startpos:startpos + 4])
datapos = decodeint(myindex[startpos + 4 + namelen:startpos + 8 + namelen])
datalen = decodeint(myindex[startpos + 8 + namelen:startpos + 12 + namelen])
myname = myindex[startpos + 4:startpos + 4 + namelen]
myname = _unicode_decode(myname,
encoding=_encodings['repo.content'], errors='replace')
filename = os.path.join(mydest, myname.lstrip(os.sep))
filename = normalize_path(filename)
if not filename.startswith(mydest):
# myname contains invalid ../ component(s)
continue
dirname = os.path.dirname(filename)
if dirname:
if not os.path.exists(dirname):
os.makedirs(dirname)
mydat = open(_unicode_encode(filename,
encoding=_encodings['fs'], errors='strict'), 'wb')
mydat.write(mydata[datapos:datapos + datalen])
mydat.close()
startpos = startpos + namelen + 12
开发者ID:amadio,项目名称:portage,代码行数:27,代码来源:xpak.py
示例6: _file_archive_ensure_dir
def _file_archive_ensure_dir(parent_dir):
"""
Ensure that the parent directory for an archive exists.
If a file exists where a directory is needed, then rename
it (see bug 256376).
@param parent_dir: path of parent directory
@type parent_dir: str
"""
for parent in iter_parents(parent_dir):
# Use lstat because a symlink to a directory might point
# to a directory outside of the config archive, making
# it an unsuitable parent.
try:
parent_st = os.lstat(parent)
except OSError:
pass
else:
if not stat.S_ISDIR(parent_st.st_mode):
_file_archive_rotate(parent)
break
try:
os.makedirs(parent_dir)
except OSError:
pass
开发者ID:aeroniero33,项目名称:portage,代码行数:27,代码来源:dispatch_conf.py
示例7: _create_installed
def _create_installed(self, installed):
for cpv in installed:
a = Atom("=" + cpv, allow_repo=True)
repo = a.repo
if repo is None:
repo = "test_repo"
vdb_pkg_dir = os.path.join(self.vdbdir, a.cpv)
try:
os.makedirs(vdb_pkg_dir)
except os.error:
pass
metadata = installed[cpv].copy()
metadata.setdefault("SLOT", "0")
metadata.setdefault("BUILD_TIME", "0")
metadata.setdefault("COUNTER", "0")
metadata.setdefault("KEYWORDS", "~x86")
unknown_keys = set(metadata).difference(
portage.dbapi.dbapi._known_keys)
unknown_keys.discard("BUILD_TIME")
unknown_keys.discard("COUNTER")
unknown_keys.discard("repository")
unknown_keys.discard("USE")
if unknown_keys:
raise ValueError("metadata of installed '%s' contains unknown keys: %s" %
(cpv, sorted(unknown_keys)))
metadata["repository"] = repo
for k, v in metadata.items():
with open(os.path.join(vdb_pkg_dir, k), "w") as f:
f.write("%s\n" % v)
开发者ID:nullishzero,项目名称:Portage,代码行数:33,代码来源:ResolverPlayground.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: new
def new(self, **kwargs):
'''Do the initial clone of the repository'''
if kwargs:
self._kwargs(kwargs)
emerge_config = self.options.get('emerge_config', None)
portdb = self.options.get('portdb', None)
try:
if not os.path.exists(self.repo.location):
os.makedirs(self.repo.location)
self.logger(self.xterm_titles,
'Created new directory %s' % self.repo.location)
except IOError:
return (1, False)
msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n")
sync_uri = self.repo.sync_uri
if sync_uri.startswith("file://"):
sync_uri = sync_uri[6:]
exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \
(portage._shell_quote(self.repo.location),
self.bin_command,
portage._shell_quote(sync_uri)),
**portage._native_kwargs(self.spawn_kwargs))
if exitcode != os.EX_OK:
msg = "!!! git clone error in %s" % self.repo.location
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
return (exitcode, False)
msg = ">>> Git clone successful"
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n")
return (os.EX_OK, True)
开发者ID:jonasstein,项目名称:portage,代码行数:33,代码来源:git.py
示例10: new
def new(self, **kwargs):
'''Do the initial clone of the repository'''
if kwargs:
self._kwargs(kwargs)
try:
if not os.path.exists(self.repo.location):
os.makedirs(self.repo.location)
self.logger(self.xterm_titles,
'Created new directory %s' % self.repo.location)
except IOError:
return (1, False)
sync_uri = self.repo.sync_uri
if sync_uri.startswith("file://"):
sync_uri = sync_uri[6:]
git_cmd_opts = ""
if self.settings.get("PORTAGE_QUIET") == "1":
git_cmd_opts += " --quiet"
if self.repo.sync_depth is not None:
git_cmd_opts += " --depth %d" % self.repo.sync_depth
git_cmd = "%s clone%s %s ." % (self.bin_command, git_cmd_opts,
portage._shell_quote(sync_uri))
writemsg_level(git_cmd + "\n")
exitcode = portage.process.spawn_bash("cd %s ; exec %s" % (
portage._shell_quote(self.repo.location), git_cmd),
**portage._native_kwargs(self.spawn_kwargs))
if exitcode != os.EX_OK:
msg = "!!! git clone error in %s" % self.repo.location
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
return (exitcode, False)
return (os.EX_OK, True)
开发者ID:gmt,项目名称:portage,代码行数:34,代码来源:git.py
示例11: unpackinfo
def unpackinfo(self, mydest):
"""Unpacks all the files from the dataSegment into 'mydest'."""
if not self.scan():
return 0
mydest = normalize_path(mydest) + os.sep
a = open(_unicode_encode(self.file,
encoding=_encodings['fs'], errors='strict'), 'rb')
if not os.path.exists(mydest):
os.makedirs(mydest)
startpos = 0
while ((startpos + 8) < self.indexsize):
namelen = decodeint(self.index[startpos:startpos + 4])
datapos = decodeint(self.index[startpos + 4 + namelen:startpos + 8 + namelen])
datalen = decodeint(self.index[startpos + 8 + namelen:startpos + 12 + namelen])
myname = self.index[startpos + 4:startpos + 4 + namelen]
myname = _unicode_decode(myname,
encoding=_encodings['repo.content'], errors='replace')
filename = os.path.join(mydest, myname.lstrip(os.sep))
filename = normalize_path(filename)
if not filename.startswith(mydest):
# myname contains invalid ../ component(s)
continue
dirname = os.path.dirname(filename)
if dirname:
if not os.path.exists(dirname):
os.makedirs(dirname)
mydat = open(_unicode_encode(filename,
encoding=_encodings['fs'], errors='strict'), 'wb')
a.seek(self.datapos + datapos)
mydat.write(a.read(datalen))
mydat.close()
startpos = startpos + namelen + 12
a.close()
return 1
开发者ID:amadio,项目名称:portage,代码行数:34,代码来源:xpak.py
示例12: dodir
def dodir(path):
try:
os.makedirs(path, 0o755)
except OSError:
if not os.path.isdir(path):
raise
os.chmod(path, 0o755)
开发者ID:aeroniero33,项目名称:portage,代码行数:7,代码来源:dohtml.py
示例13: ensure_dirs
def ensure_dirs(dir_path, *args, **kwargs):
"""Create a directory and call apply_permissions.
Returns True if a directory is created or the permissions needed to be
modified, and False otherwise."""
created_dir = False
try:
os.makedirs(dir_path)
created_dir = True
except OSError as oe:
func_call = "makedirs('%s')" % dir_path
if oe.errno in (errno.EEXIST, errno.EISDIR):
pass
else:
if os.path.isdir(dir_path):
# NOTE: DragonFly raises EPERM for makedir('/')
# and that is supposed to be ignored here.
pass
elif oe.errno == errno.EPERM:
raise OperationNotPermitted(func_call)
elif oe.errno == errno.EACCES:
raise PermissionDenied(func_call)
elif oe.errno == errno.EROFS:
raise ReadOnlyFileSystem(func_call)
else:
raise
perms_modified = apply_permissions(dir_path, *args, **kwargs)
return created_dir or perms_modified
开发者ID:fastinetserver,项目名称:portage-idfetch,代码行数:29,代码来源:__init__.py
示例14: xpand
def xpand(myid,mydest):
myindex=myid[0]
mydata=myid[1]
try:
origdir=os.getcwd()
except SystemExit as e:
raise
except:
os.chdir("/")
origdir="/"
os.chdir(mydest)
myindexlen=len(myindex)
startpos=0
while ((startpos+8)<myindexlen):
namelen=decodeint(myindex[startpos:startpos+4])
datapos=decodeint(myindex[startpos+4+namelen:startpos+8+namelen]);
datalen=decodeint(myindex[startpos+8+namelen:startpos+12+namelen]);
myname=myindex[startpos+4:startpos+4+namelen]
dirname=os.path.dirname(myname)
if dirname:
if not os.path.exists(dirname):
os.makedirs(dirname)
mydat = open(_unicode_encode(myname,
encoding=_encodings['fs'], errors='strict'), 'wb')
mydat.write(mydata[datapos:datapos+datalen])
mydat.close()
startpos=startpos+namelen+12
os.chdir(origdir)
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:28,代码来源:xpak.py
示例15: testDoebuildSpawn
def testDoebuildSpawn(self):
playground = ResolverPlayground()
try:
settings = config(clone=playground.settings)
cpv = 'sys-apps/portage-2.1'
metadata = {
'EAPI' : '2',
'INHERITED' : 'python eutils',
'IUSE' : 'build doc epydoc python3 selinux',
'LICENSE' : 'GPL-2',
'PROVIDE' : 'virtual/portage',
'RDEPEND' : '>=app-shells/bash-3.2_p17 >=dev-lang/python-2.6',
'SLOT' : '0',
}
root_config = playground.trees[playground.eroot]['root_config']
pkg = Package(built=False, cpv=cpv, installed=False,
metadata=metadata, root_config=root_config,
type_name='ebuild')
settings.setcpv(pkg)
settings['PORTAGE_PYTHON'] = _python_interpreter
settings['PORTAGE_BUILDDIR'] = os.path.join(
settings['PORTAGE_TMPDIR'], cpv)
settings['T'] = os.path.join(
settings['PORTAGE_BUILDDIR'], 'temp')
for x in ('PORTAGE_BUILDDIR', 'T'):
os.makedirs(settings[x])
# Create a fake environment, to pretend as if the ebuild
# has been sourced already.
open(os.path.join(settings['T'], 'environment'), 'wb').close()
scheduler = PollScheduler().sched_iface
for phase in ('_internal_test',):
# Test EbuildSpawnProcess by calling doebuild.spawn() with
# returnpid=False. This case is no longer used by portage
# internals since EbuildPhase is used instead and that passes
# returnpid=True to doebuild.spawn().
rval = doebuild_spawn("%s %s" % (_shell_quote(
os.path.join(settings["PORTAGE_BIN_PATH"],
os.path.basename(EBUILD_SH_BINARY))), phase),
settings, free=1)
self.assertEqual(rval, os.EX_OK)
ebuild_phase = EbuildPhase(background=False,
phase=phase, scheduler=scheduler,
settings=settings)
ebuild_phase.start()
ebuild_phase.wait()
self.assertEqual(ebuild_phase.returncode, os.EX_OK)
ebuild_phase = MiscFunctionsProcess(background=False,
commands=['success_hooks'],
scheduler=scheduler, settings=settings)
ebuild_phase.start()
ebuild_phase.wait()
self.assertEqual(ebuild_phase.returncode, os.EX_OK)
finally:
playground.cleanup()
开发者ID:Acidburn0zzz,项目名称:portage-funtoo,代码行数:58,代码来源:test_doebuild_spawn.py
示例16: new
def new(self, **kwargs):
'''Do the initial clone of the repository'''
if kwargs:
self._kwargs(kwargs)
if not self.has_bin:
return (1, False)
try:
if not os.path.exists(self.repo.location):
os.makedirs(self.repo.location)
self.logger(self.xterm_titles,
'Created new directory %s' % self.repo.location)
except IOError:
return (1, False)
sync_uri = self.repo.sync_uri
if sync_uri.startswith("file://"):
sync_uri = sync_uri[7:]
git_cmd_opts = ""
if self.repo.module_specific_options.get('sync-git-env'):
shlexed_env = shlex_split(self.repo.module_specific_options['sync-git-env'])
env = dict((k, v) for k, _, v in (assignment.partition('=') for assignment in shlexed_env) if k)
self.spawn_kwargs['env'].update(env)
if self.repo.module_specific_options.get('sync-git-clone-env'):
shlexed_env = shlex_split(self.repo.module_specific_options['sync-git-clone-env'])
clone_env = dict((k, v) for k, _, v in (assignment.partition('=') for assignment in shlexed_env) if k)
self.spawn_kwargs['env'].update(clone_env)
if self.settings.get("PORTAGE_QUIET") == "1":
git_cmd_opts += " --quiet"
if self.repo.clone_depth is not None:
if self.repo.clone_depth != 0:
git_cmd_opts += " --depth %d" % self.repo.clone_depth
elif self.repo.sync_depth is not None:
if self.repo.sync_depth != 0:
git_cmd_opts += " --depth %d" % self.repo.sync_depth
else:
# default
git_cmd_opts += " --depth 1"
if self.repo.module_specific_options.get('sync-git-clone-extra-opts'):
git_cmd_opts += " %s" % self.repo.module_specific_options['sync-git-clone-extra-opts']
git_cmd = "%s clone%s %s ." % (self.bin_command, git_cmd_opts,
portage._shell_quote(sync_uri))
writemsg_level(git_cmd + "\n")
exitcode = portage.process.spawn_bash("cd %s ; exec %s" % (
portage._shell_quote(self.repo.location), git_cmd),
**self.spawn_kwargs)
if exitcode != os.EX_OK:
msg = "!!! git clone error in %s" % self.repo.location
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
return (exitcode, False)
if not self.verify_head():
return (1, False)
return (os.EX_OK, True)
开发者ID:mgorny,项目名称:portage,代码行数:58,代码来源:git.py
示例17: 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
示例18: _create_installed
def _create_installed(self, installed):
for cpv in installed:
a = Atom("=" + cpv, allow_repo=True)
repo = a.repo
if repo is None:
repo = "test_repo"
vdb_pkg_dir = os.path.join(self.vdbdir, a.cpv)
try:
os.makedirs(vdb_pkg_dir)
except os.error:
pass
metadata = installed[cpv].copy()
eapi = metadata.pop("EAPI", 0)
lic = metadata.pop("LICENSE", "")
properties = metadata.pop("PROPERTIES", "")
slot = metadata.pop("SLOT", 0)
build_time = metadata.pop("BUILD_TIME", "0")
keywords = metadata.pop("KEYWORDS", "~x86")
iuse = metadata.pop("IUSE", "")
use = metadata.pop("USE", "")
provide = metadata.pop("PROVIDE", None)
depend = metadata.pop("DEPEND", "")
rdepend = metadata.pop("RDEPEND", None)
pdepend = metadata.pop("PDEPEND", None)
required_use = metadata.pop("REQUIRED_USE", None)
if metadata:
raise ValueError("metadata of installed '%s' contains unknown keys: %s" % (cpv, metadata.keys()))
def write_key(key, value):
f = open(os.path.join(vdb_pkg_dir, key), "w")
f.write(str(value) + "\n")
f.close()
write_key("EAPI", eapi)
write_key("BUILD_TIME", build_time)
write_key("COUNTER", "0")
write_key("LICENSE", lic)
write_key("PROPERTIES", properties)
write_key("SLOT", slot)
write_key("LICENSE", lic)
write_key("PROPERTIES", properties)
write_key("repository", repo)
write_key("KEYWORDS", keywords)
write_key("IUSE", iuse)
write_key("USE", use)
if provide is not None:
write_key("PROVIDE", provide)
write_key("DEPEND", depend)
if rdepend is not None:
write_key("RDEPEND", rdepend)
if pdepend is not None:
write_key("PDEPEND", pdepend)
if required_use is not None:
write_key("REQUIRED_USE", required_use)
开发者ID:devurandom,项目名称:portage,代码行数:57,代码来源:ResolverPlayground.py
示例19: new
def new(self, **kwargs):
if kwargs:
self._kwargs(kwargs)
try:
if not os.path.exists(self.repo.location):
os.makedirs(self.repo.location)
self.logger(self.self.xterm_titles, "Created New Directory %s " % self.repo.location)
except IOError:
return (1, False)
return self.update()
开发者ID:helb,项目名称:portage,代码行数:10,代码来源:rsync.py
示例20: _create_world
def _create_world(self, world):
#Create /var/lib/portage/world
var_lib_portage = os.path.join(self.eroot, "var", "lib", "portage")
os.makedirs(var_lib_portage)
world_file = os.path.join(var_lib_portage, "world")
f = open(world_file, "w")
for atom in world:
f.write("%s\n" % atom)
f.close()
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:11,代码来源:ResolverPlayground.py
注:本文中的portage.os.makedirs函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论