Add a script to install external activities
This commit is contained in:
parent
3117d454b9
commit
167dbec0f5
2
.gitignore
vendored
2
.gitignore
vendored
@ -32,5 +32,5 @@ po/POTFILES
|
|||||||
po/stamp-it
|
po/stamp-it
|
||||||
po/sugar.pot
|
po/sugar.pot
|
||||||
po/*.gmo
|
po/*.gmo
|
||||||
|
|
||||||
sugar/__installed__.py
|
sugar/__installed__.py
|
||||||
|
tools/sugar-setup-activity
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
SUBDIRS = activities shell sugar
|
SUBDIRS = activities shell sugar tools
|
||||||
|
|
||||||
dbusconfdir = $(pkgdatadir)
|
dbusconfdir = $(pkgdatadir)
|
||||||
dbusconf_DATA = dbus-installed.conf
|
dbusconf_DATA = dbus-installed.conf
|
||||||
|
@ -40,4 +40,6 @@ sugar/p2p/Makefile
|
|||||||
sugar/p2p/model/Makefile
|
sugar/p2p/model/Makefile
|
||||||
sugar/presence/Makefile
|
sugar/presence/Makefile
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
|
tools/Makefile
|
||||||
|
tools/sugar-setup-activity
|
||||||
])
|
])
|
||||||
|
@ -11,8 +11,9 @@ class ServiceParser(ConfigParser):
|
|||||||
def optionxform(self, option):
|
def optionxform(self, option):
|
||||||
return option
|
return option
|
||||||
|
|
||||||
def _install_activity(activity_dir, filename, dest_path, bin):
|
def setup_activity(source, dest_path, bin):
|
||||||
source = os.path.join(activity_dir, filename)
|
"""Copy an activity to the destination path and setup it"""
|
||||||
|
filename = os.path.basename(source)
|
||||||
dest = os.path.join(dest_path, filename)
|
dest = os.path.join(dest_path, filename)
|
||||||
print 'Install ' + filename + ' ...'
|
print 'Install ' + filename + ' ...'
|
||||||
shutil.copyfile(source, dest)
|
shutil.copyfile(source, dest)
|
||||||
@ -53,7 +54,7 @@ def _install_activity(activity_dir, filename, dest_path, bin):
|
|||||||
service_cp.write(fileobject)
|
service_cp.write(fileobject)
|
||||||
fileobject.close()
|
fileobject.close()
|
||||||
|
|
||||||
def install_activities(source_path, dest_path, bin):
|
def setup_activities(source_path, dest_path, bin):
|
||||||
"""Scan a directory for activities and install them."""
|
"""Scan a directory for activities and install them."""
|
||||||
if os.path.isdir(source_path):
|
if os.path.isdir(source_path):
|
||||||
for filename in os.listdir(source_path):
|
for filename in os.listdir(source_path):
|
||||||
@ -61,7 +62,8 @@ def install_activities(source_path, dest_path, bin):
|
|||||||
if os.path.isdir(activity_dir):
|
if os.path.isdir(activity_dir):
|
||||||
for filename in os.listdir(activity_dir):
|
for filename in os.listdir(activity_dir):
|
||||||
if filename.endswith(".activity"):
|
if filename.endswith(".activity"):
|
||||||
_install_activity(activity_dir, filename, dest_path, bin)
|
source = os.path.join(activity_dir, filename)
|
||||||
|
setup_activity(source, dest_path, bin)
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
install_activities(sys.argv[1], sys.argv[2], sys.argv[3])
|
setup_activities(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||||
|
1
tools/Makefile.am
Normal file
1
tools/Makefile.am
Normal file
@ -0,0 +1 @@
|
|||||||
|
bin_SCRIPTS = sugar-setup-activity
|
10
tools/sugar-setup-activity.in
Normal file
10
tools/sugar-setup-activity.in
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from sugar import setup
|
||||||
|
|
||||||
|
setup.setup_activity(sys.argv[1],
|
||||||
|
'@prefix@/share/sugar/activities',
|
||||||
|
'@prefix@/bin/sugar-activity-factory')
|
||||||
|
|
||||||
|
print '%s installed.' % sys.argv[1]
|
Loading…
Reference in New Issue
Block a user