diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-02-11 11:02:36 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-02-11 11:02:36 (GMT) |
commit | fed821071d3dec99f36898434faf7528195db722 (patch) | |
tree | 3cc319af1f25f4f8ef174bc179c87940d1a1ce49 | |
parent | 7518cfcd0c4c17b979da49058eab8d3366baf3a8 (diff) |
Do not use SUGAR_PREFIX, sugar is not defining it anymore.
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/.gitignore | 1 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rwxr-xr-x | src/main.py (renamed from src/sugar-presence-service) | 63 | ||||
-rw-r--r-- | src/sugar-presence-service.in | 23 |
5 files changed, 60 insertions, 36 deletions
diff --git a/configure.ac b/configure.ac index ab0e187..edf42de 100644 --- a/configure.ac +++ b/configure.ac @@ -3,13 +3,17 @@ AC_INIT([Sugar Presence Service],[0.65],[],[sugar-presence-service]) AC_PREREQ([2.59]) AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_SRCDIR([src/sugar-presence-service]) +AC_CONFIG_SRCDIR([src/sugar-presence-service.in]) AM_INIT_AUTOMAKE([1.9 foreign dist-bzip2 no-dist-gzip]) AM_PATH_PYTHON AC_CONFIG_FILES([ + src/sugar-presence-service +]) + +AC_CONFIG_FILES([ Makefile src/Makefile ]) diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..d01b46a --- /dev/null +++ b/src/.gitignore @@ -0,0 +1 @@ +sugar-presence-service diff --git a/src/Makefile.am b/src/Makefile.am index ac32974..a93d71e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,13 +15,14 @@ psdata_PYTHON = \ buddy.py \ buddyiconcache.py \ linklocal_plugin.py \ + main.py \ presenceservice.py \ pstest.py \ psutils.py \ server_plugin.py \ telepathy_plugin.py -dist_bin_SCRIPTS = sugar-presence-service +bin_SCRIPTS = sugar-presence-service DISTCLEANFILES = $(service_DATA) diff --git a/src/sugar-presence-service b/src/main.py index bf9be20..ad6dd71 100755 --- a/src/sugar-presence-service +++ b/src/main.py @@ -31,38 +31,33 @@ _logger = logging.getLogger('s-p-s') def usage(): _logger.debug("Usage: sugar-presence-service [<test buddy number (1 - 10)>] [randomize]") -if not os.environ.has_key('SUGAR_PREFIX'): - print 'SUGAR_PREFIX must be set.' - sys.exit(0) -prefix = os.environ['SUGAR_PREFIX'] -sys.path.append(os.path.join(prefix, 'share/sugar-presence-service')) - -test_num = 0 -randomize = False -if len(sys.argv) in [2, 3]: - try: - test_num = int(sys.argv[1]) - except ValueError: - _logger.debug("Bad test user number.") - if test_num < 1 or test_num > 10: - _logger.debug("Bad test user number.") - - if len(sys.argv) == 3 and sys.argv[2] == "randomize": - randomize = True -elif len(sys.argv) == 1: - pass -else: - usage() - os._exit(1) - -if test_num > 0: - logger.start('test-%d-presenceservice' % test_num) -else: - logger.start('presenceservice') - -import presenceservice - -_logger.info('Starting presence service...') - -presenceservice.main(test_num, randomize) +def main(): + test_num = 0 + randomize = False + if len(sys.argv) in [2, 3]: + try: + test_num = int(sys.argv[1]) + except ValueError: + _logger.debug("Bad test user number.") + if test_num < 1 or test_num > 10: + _logger.debug("Bad test user number.") + + if len(sys.argv) == 3 and sys.argv[2] == "randomize": + randomize = True + elif len(sys.argv) == 1: + pass + else: + usage() + os._exit(1) + + if test_num > 0: + logger.start('test-%d-presenceservice' % test_num) + else: + logger.start('presenceservice') + + import presenceservice + + _logger.info('Starting presence service...') + + presenceservice.main(test_num, randomize) diff --git a/src/sugar-presence-service.in b/src/sugar-presence-service.in new file mode 100644 index 0000000..c2149ee --- /dev/null +++ b/src/sugar-presence-service.in @@ -0,0 +1,23 @@ +# Copyright (C) 2008, Red Hat, Inc. +# +# 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 St, Fifth Floor, Boston, MA 02110-1301 USA + +import sys + +sys.path.append('@prefix@/share/sugar-presence-service') + +import main + +main.main() |