Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Francis <francis@sugarlabs.org>2012-09-11 02:00:42 (GMT)
committer Daniel Francis <francis@sugarlabs.org>2012-09-11 02:00:42 (GMT)
commit9e393a0eafacc363d7c6b0ecb92773f384477ca5 (patch)
tree5c5eb261efe3d9f99e3178a611482d04b670e249
parent6671484a82d5e0bcfdd388495b6ace263c86174d (diff)
Use make install for local or for system instalation
-rw-r--r--.gitignore3
-rw-r--r--Makefile3
-rw-r--r--activity/activity.info9
-rw-r--r--info.py13
-rw-r--r--makescripts/command.py28
-rw-r--r--makescripts/desktop_luncher.py10
-rw-r--r--makescripts/systeminstall.py39
7 files changed, 93 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 5cb032c..d5eb2a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
*~
-activity.info
*.pyc
-app-entry.desktop
+hello-integration.desktop
hello-integration.png
diff --git a/Makefile b/Makefile
index 100721b..04eca7b 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,8 @@ activity: activity.info mimetypes.xml
if [ -f mimetypes.xml ]; then cp mimetypes.xml activity; fi
app-entry.desktop: app-icon
python makescripts/desktop_luncher.py
-local: app-entry.desktop mimetypes.xml
+install: app-entry.desktop mimetypes.xml
+ python makescripts/systeminstall.py
mv app-entry.desktop $N.desktop
xdg-desktop-menu install $N.desktop
if [ -f mimetypes.xml ]; then cp mimetypes.xml $M.xml; xdg-mime install $M.xml; python makescripts/svg2png.py activity/$M.svg ./mimetype.png; xdg-icon-resource install --context mimetypes --size 48 mimetype.png $M; fi
diff --git a/activity/activity.info b/activity/activity.info
new file mode 100644
index 0000000..34d8294
--- /dev/null
+++ b/activity/activity.info
@@ -0,0 +1,9 @@
+[Activity]
+name = Hello Integration
+activity_version = 1
+show_launcher = 1
+bundle_id = org.sugarlabs.HelloIntegration
+exec = sugar-activity activity.Activity -s
+icon = activity-hello
+license = GPLv3+
+
diff --git a/info.py b/info.py
index 1f12cda..d8f29bf 100644
--- a/info.py
+++ b/info.py
@@ -26,11 +26,12 @@ import os
this_dir = os.path.abspath('./')
import gettext
-if os.environ['PROGRAMRUNNING'] == 'DESKTOP':
- # init gettext
- locale_path = os.path.join(this_dir, 'locale')
- gettext.bindtextdomain(service_name, locale_path)
- gettext.textdomain(service_name)
+if 'PROGRAMRUNNING' in os.environ:
+ if os.environ['PROGRAMRUNNING'] == 'DESKTOP':
+ # init gettext
+ locale_path = os.path.join(this_dir, 'locale')
+ gettext.bindtextdomain(service_name, locale_path)
+ gettext.textdomain(service_name)
_ = gettext.gettext
@@ -51,7 +52,7 @@ categories = ['Application', 'Utility']
file_filter_name = None
file_filter_mime = None
-file_filter_pattern = None
+file_filter_patterns = []
# Refer to the COPYING
license = 'GPLv3'
diff --git a/makescripts/command.py b/makescripts/command.py
new file mode 100644
index 0000000..1b6c71d
--- /dev/null
+++ b/makescripts/command.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+#
+# Copyright 2012 Daniel Francis <francis@sugarlabs.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+import sys
+import os
+name = os.path.split(sys.argv[0])[-1]
+os.environ['DATADIR'] = '/usr/share/%s' % name
+os.environ['PROGRAMRUNNING'] = 'DESKTOP'
+os.environ['ICONDIR'] = '/usr/share/%s/icons' % name
+os.system('python /usr/share/%s/application.py %s' % (name,
+ ('"%s"' % sys.argv[1]) if len(sys.argv) > 1 else ''))
diff --git a/makescripts/desktop_luncher.py b/makescripts/desktop_luncher.py
index 89aaad9..18dbcc6 100644
--- a/makescripts/desktop_luncher.py
+++ b/makescripts/desktop_luncher.py
@@ -20,10 +20,14 @@
import sys
import os
-appdir = os.path.abspath('./')
-sys.path.append(appdir)
-
+import pwd
+sys.path.append(os.path.abspath('./'))
import info
+user = pwd.getpwuid(os.getuid()).pw_name
+execdir = '/usr/bin' if user == 'root' else os.path.abspath('./')
+appdir = '/usr/share/%s' % info.lower_name if user ==\
+ 'root' else os.path.abspath('./')
+
desktop_file = open('app-entry.desktop', 'w')
string = '[Desktop Entry]\nEncoding=UTF-8\n'
diff --git a/makescripts/systeminstall.py b/makescripts/systeminstall.py
new file mode 100644
index 0000000..6274f1e
--- /dev/null
+++ b/makescripts/systeminstall.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+import sys
+import os
+import pwd
+sys.path.append(os.path.abspath('./'))
+import info
+user = pwd.getpwuid(os.getuid()).pw_name
+
+if user == 'root':
+ os.system('cp makescripts/command.py /usr/bin/%s' % info.lower_name)
+ try:
+ os.mkdir('/usr/share/%s' % info.lower_name)
+ os.mkdir('/usr/share/%s/icons' % info.lower_name)
+ except:
+ pass
+ os.system('cp -R desktop/sweetener /usr/share/%s/sweetener' %\
+ info.lower_name)
+ os.system('cp data/* /usr/share/%s/' % info.lower_name)
+ os.system('cp *.py /usr/share/%s/' % info.lower_name)
+ os.system('cp *.svg /usr/share/%s/icons' % info.lower_name)