Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
S
scom
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
SulinOS
scom
Commits
413c232d
Kaydet (Commit)
413c232d
authored
Eki 26, 2008
tarafından
Bahadır Kandemir
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
New release.
Good old friend, Link() is back. More info available at README file
üst
9ce1f029
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
147 additions
and
2 deletions
+147
-2
ChangeLog
api/ChangeLog
+6
-0
README
api/README
+36
-0
__init__.py
api/comar/__init__.py
+104
-1
setup.py
api/setup.py
+1
-1
No files found.
api/ChangeLog
Dosyayı görüntüle @
413c232d
2008-10-27 Bahadır Kandemir <bahadir@pardus.org.tr>
* comar: New release. Good old friend, Link() is back.
More info available at README file.
2008-10-05 Bahadır Kandemir <bahadir@pardus.org.tr>
* setup.py: New release
...
...
api/README
0 → 100644
Dosyayı görüntüle @
413c232d
COMAR API package offers modules for accessing COMAR over D-Bus without pain and
common mehtods/classess for COMAR scripts.
Here're some examples for accessing COMAR:
import comar
link = comar.Link()
# Get a list of packages that provide system.service method
packages = list(link.System.Service)
# Start a service
link.System.Service["kdebase"].start()
# Stop all services, ignore replies from packages.
link.System.Service.stop(quiet=False)
Async calls:
import gobject
import dbus.mainloop.glib
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
mainloop = gobject.MainLoop()
import comar
link = comar.Link()
# Make an asynchronous call to get service information
def handler(package, exception, result):
if exception:
print "%s error: %s" % (package, exception)
else:
print "%s result: %s" % (package, result)
link.System.Service.info(async=handler)
mainloop.run()
api/comar/__init__.py
Dosyayı görüntüle @
413c232d
...
...
@@ -9,4 +9,107 @@
# option) any later version. Please read the COPYING file.
#
__version__
=
'2.0_alpha1'
__version__
=
'2.1.0'
import
dbus
class
Call
:
def
__init__
(
self
,
link
,
group
,
class_
=
None
,
package
=
None
,
method
=
None
):
self
.
link
=
link
self
.
group
=
group
self
.
class_
=
class_
self
.
package
=
package
self
.
method
=
method
self
.
async
=
None
self
.
quiet
=
False
def
__getitem__
(
self
,
key
):
if
not
self
.
class_
:
raise
KeyError
,
"Package should be selected after class"
if
not
isinstance
(
key
,
basestring
):
raise
KeyError
return
Call
(
self
.
link
,
self
.
group
,
self
.
class_
,
key
)
def
__getattr__
(
self
,
name
):
if
self
.
class_
:
c
=
Call
(
self
.
link
,
self
.
group
,
self
.
class_
,
self
.
package
,
name
)
return
c
.
call
else
:
if
name
[
0
]
<
'A'
or
name
[
0
]
>
'Z'
:
raise
AttributeError
return
Call
(
self
.
link
,
self
.
group
,
name
)
def
__iter__
(
self
):
if
self
.
class_
:
obj
=
self
.
link
.
bus
.
get_object
(
self
.
link
.
address
,
"/"
,
introspect
=
False
)
packages
=
obj
.
listModelApplications
(
"
%
s.
%
s"
%
(
self
.
group
,
self
.
class_
),
dbus_interface
=
"tr.org.pardus.comar"
)
for
package
in
packages
:
yield
unicode
(
package
)
def
call
(
self
,
*
args
,
**
kwargs
):
self
.
async
=
kwargs
.
get
(
"async"
,
None
)
self
.
quiet
=
kwargs
.
get
(
"quiet"
,
False
)
if
self
.
async
and
self
.
quiet
:
raise
Exception
,
"async and quiet arguments can't be used together"
if
self
.
async
or
self
.
quiet
:
if
self
.
package
:
obj
=
self
.
link
.
bus
.
get_object
(
self
.
link
.
address
,
"/package/
%
s"
%
self
.
package
,
introspect
=
False
)
met
=
getattr
(
obj
,
self
.
method
)
def
handleResult
(
*
result
):
self
.
async
(
self
.
package
,
None
,
result
)
def
handleError
(
exception
):
self
.
async
(
self
.
package
,
exception
,
None
)
if
self
.
quiet
:
met
(
dbus_interface
=
"tr.org.pardus.comar.
%
s.
%
s"
%
(
self
.
group
,
self
.
class_
),
ignore_reply
=
True
,
*
args
)
else
:
met
(
dbus_interface
=
"tr.org.pardus.comar.
%
s.
%
s"
%
(
self
.
group
,
self
.
class_
),
reply_handler
=
handleResult
,
error_handler
=
handleError
,
*
args
)
else
:
def
handlePackages
(
packages
):
for
package
in
packages
:
obj
=
self
.
link
.
bus
.
get_object
(
self
.
link
.
address
,
"/package/
%
s"
%
package
,
introspect
=
False
)
met
=
getattr
(
obj
,
self
.
method
)
if
self
.
quiet
:
met
(
dbus_interface
=
"tr.org.pardus.comar.
%
s.
%
s"
%
(
self
.
group
,
self
.
class_
),
ignore_reply
=
True
,
*
args
)
else
:
def
handleResult
(
*
result
):
self
.
async
(
package
,
None
,
result
)
def
handleError
(
exception
):
self
.
async
(
package
,
exception
,
None
)
met
(
dbus_interface
=
"tr.org.pardus.comar.
%
s.
%
s"
%
(
self
.
group
,
self
.
class_
),
reply_handler
=
handleResult
,
error_handler
=
handleError
,
*
args
)
def
handlePackError
(
exception
):
if
self
.
quiet
:
pass
else
:
raise
exception
if
self
.
quiet
:
obj
=
self
.
link
.
bus
.
get_object
(
self
.
link
.
address
,
"/"
,
introspect
=
False
)
packages
=
obj
.
listModelApplications
(
"
%
s.
%
s"
%
(
self
.
group
,
self
.
class_
),
dbus_interface
=
"tr.org.pardus.comar"
)
handlePackages
(
packages
)
else
:
obj
=
self
.
link
.
bus
.
get_object
(
self
.
link
.
address
,
"/"
,
introspect
=
False
)
obj
.
listModelApplications
(
"
%
s.
%
s"
%
(
self
.
group
,
self
.
class_
),
dbus_interface
=
"tr.org.pardus.comar"
,
reply_handler
=
handlePackages
,
error_handler
=
handlePackError
)
else
:
if
self
.
package
:
obj
=
self
.
link
.
bus
.
get_object
(
self
.
link
.
address
,
"/package/
%
s"
%
self
.
package
,
introspect
=
False
)
met
=
getattr
(
obj
,
self
.
method
)
return
met
(
dbus_interface
=
"tr.org.pardus.comar.
%
s.
%
s"
%
(
self
.
group
,
self
.
class_
),
*
args
)
else
:
raise
AttributeError
,
"Package name required for non-async calls."
class
Link
:
def
__init__
(
self
,
address
=
"tr.org.pardus.comar"
):
self
.
address
=
address
self
.
bus
=
dbus
.
SystemBus
()
def
__getattr__
(
self
,
name
):
if
name
[
0
]
<
'A'
or
name
[
0
]
>
'Z'
:
raise
AttributeError
return
Call
(
self
,
name
)
api/setup.py
Dosyayı görüntüle @
413c232d
...
...
@@ -16,7 +16,7 @@ import shutil
from
distutils.core
import
setup
from
distutils.command.install
import
install
version
=
"2.
0.1
"
version
=
"2.
1.0
"
distfiles
=
"""
setup.py
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment