Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 23411 Details for
Bug 35535
[PATCH] `emerge sync` refactoring
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
new sync module using separated files
__init__.py (text/plain), 1.84 KB, created by
Marius Mauch (RETIRED)
on 2004-01-08 12:14:27 UTC
(
hide
)
Description:
new sync module using separated files
Filename:
MIME Type:
Creator:
Marius Mauch (RETIRED)
Created:
2004-01-08 12:14:27 UTC
Size:
1.84 KB
patch
obsolete
>from aux import * # to be removed >import portage, os, sys > >sys.path.insert(0, "/usr/lib/portage/pym") > >__transports__ = {} > >def addTransport(protocol, handler): > if not protocol in __transports__.keys(): > __transports__[protocol] = handler > else: > raise Exception("protocol %s already registered with %s" % (protocol, handler)) > > >def getTransport(protocol): > if protocol in __transports__.keys(): > return __transports__[protocol] > else: > return None > > >def removeTransport(protocol): > try: > __transports__.pop(protocol) > except: > pass > > >def getTransportList(): > return __transports__.keys() > > >class Connection: > def create(self, src, dest, settings): > src = src.strip() > dest = os.path.normpath(dest) > > pos = src.find("://") > if pos <= 0: > raise Exception("invalid SYNC setting: %s" % src) > elif src[:pos] not in getTransportList(): > raise Exception("unknown or unsupported transport type in SYNC: %s" % src[:pos]) > else: > transtype = src[:pos] > myconnection = getTransport(src[:pos]) > > os.umask(0022) > > if not os.path.exists(dest): > os.makedirs(dest, mode=0755) > > return myconnection(src, dest, settings) > > > # check if a given command is available > def toolcheck(self, cmd, pkg, quiet=True): > if os.access(cmd, os.X_OK) and os.path.isfile(cmd): > return True > elif quiet: > return False > else: > warn("%s does not exist or is not executable, so %s-sync support" % (cmd, self.transtype)) > warn("is disabled. Emerge \"%s\" to enable %s-sync support" % (pkg, self.transtype)) > return False > > create = classmethod(create) > toolcheck = classmethod(toolcheck) > > ># dynamically loading all sync modules >modulelist = portage.listdir("/usr/lib/portage/pym/sync", > filesonly=1, ignorecvs=1, > ignorelist=["aux.py", "__init__.py"]) >modulelist = filter(isPythonSourceFile, modulelist) >for m in modulelist: > __import__("sync."+m[:-3])
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 35535
:
22067
|
22068
|
22069
|
23407
|
23408
|
23409
|
23410
| 23411