[Pymoul-svn] SF.net SVN: pymoul: [89] pymoul/trunk
Status: Alpha
Brought to you by:
tiran
|
From: <ti...@us...> - 2007-01-27 22:29:40
|
Revision: 89
http://pymoul.svn.sourceforge.net/pymoul/?rev=89&view=rev
Author: tiran
Date: 2007-01-27 14:29:40 -0800 (Sat, 27 Jan 2007)
Log Message:
-----------
Propset eol-style and keywords
Renamed Makefile to Makefile.in
Tests and better implementation for locking and singleapp
Modified Paths:
--------------
pymoul/trunk/compileui.py
pymoul/trunk/setup.py
pymoul/trunk/setup_win32.py
pymoul/trunk/src/moul/osdependent/__init__.py
pymoul/trunk/src/moul/osdependent/darwin/__init__.py
pymoul/trunk/src/moul/osdependent/linux/__init__.py
pymoul/trunk/src/moul/osdependent/processinfo.py
pymoul/trunk/src/moul/osdependent/singleapp.py
pymoul/trunk/src/moul/osdependent/tests/test_singleapp.py
pymoul/trunk/src/moul/osdependent/win32/__init__.py
pymoul/trunk/src/moul/qt/moulqt.py
Added Paths:
-----------
pymoul/trunk/Makefile.in
pymoul/trunk/src/moul/osdependent/tests/test_processinfo.py
Removed Paths:
-------------
pymoul/trunk/Makefile
Property Changed:
----------------
pymoul/trunk/AUTHORS.txt
pymoul/trunk/GPL.txt
pymoul/trunk/INSTALL.txt
pymoul/trunk/README.txt
pymoul/trunk/compileui.py
pymoul/trunk/distutils_upx.py
pymoul/trunk/ez_setup.py
pymoul/trunk/setup.py
pymoul/trunk/setup_win32.py
pymoul/trunk/src/moul/config/tests/test_config.py
pymoul/trunk/src/moul/file/tests/audio.txt
pymoul/trunk/src/moul/file/tests/audiocaps.0.txt
pymoul/trunk/src/moul/file/tests/graphics.txt
pymoul/trunk/src/moul/file/tests/test_chatlog.py
pymoul/trunk/src/moul/file/tests/test_kiimage.py
pymoul/trunk/src/moul/file/tests/test_localization.py
pymoul/trunk/src/moul/file/tests/test_plasmalog.py
pymoul/trunk/src/moul/file/tests/test_wdysini.py
pymoul/trunk/src/moul/osdependent/__init__.py
pymoul/trunk/src/moul/osdependent/darwin/__init__.py
pymoul/trunk/src/moul/osdependent/linux/__init__.py
pymoul/trunk/src/moul/osdependent/processinfo.py
pymoul/trunk/src/moul/osdependent/singleapp.py
pymoul/trunk/src/moul/osdependent/tests/__init__.py
pymoul/trunk/src/moul/osdependent/tests/test_osdependent.py
pymoul/trunk/src/moul/osdependent/tests/test_singleapp.py
pymoul/trunk/src/moul/osdependent/win32/__init__.py
pymoul/trunk/src/moul/osdependent/win32/registry.py
pymoul/trunk/src/moul/osdependent/win32/winpath.py
pymoul/trunk/src/moul/qt/localization.py
pymoul/trunk/src/moul/qt/ui/README.txt
pymoul/trunk/src/moul/server/__init__.py
pymoul/trunk/src/moul/server/ping.py
pymoul/trunk/src/moul/server/serverlist.py
pymoul/trunk/src/moul/server/tests/__init__.py
pymoul/trunk/src/moul/server/tests/test_ping.py
pymoul/trunk/src/moul/server/tests/test_serverlist.py
pymoul/trunk/src/moul/time/README.txt
pymoul/trunk/src/moul/time/tests/test_dni.py
pymoul/trunk/test.py
pymoul/trunk/version.txt
Property changes on: pymoul/trunk/AUTHORS.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revisioni
Property changes on: pymoul/trunk/GPL.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revisioni
Property changes on: pymoul/trunk/INSTALL.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revisioni
Deleted: pymoul/trunk/Makefile
===================================================================
--- pymoul/trunk/Makefile 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/Makefile 2007-01-27 22:29:40 UTC (rev 89)
@@ -1,61 +0,0 @@
-PYTHON?=python
-EPYDOC=$(PYTHON) -c "import epydoc.cli; epydoc.cli.cli()"
-TESTFLAGS=-v
-TESTOPTS=
-SETUPFLAGS=
-
-all: inplace
-
-# Build in-place
-inplace:
- PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) build_ext -i
-
-build: compileui
- PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) build
-
-py2exe:
- PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) py2exe
-
-innosetup:
- PYTHONPATH="src" INNOSETUP="yes" $(PYTHON) setup.py $(SETUPFLAGS) py2exe
-
-bdist_egg:
- PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) bdist_egg
-
-run: compileui
- PYTHONPATH="src" $(PYTHON) src/moul/qt/moulqt.py
-
-exerun: compileui py2exe
- dist/moulqt.exe
-
-compileui:
- $(PYTHON) compileui.py
-
-test_build: build compileui
- PYTHONPATH="src" $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
-
-test_inplace: compileui
- PYTHONPATH="src" $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
-
-doc_html:
- PYTHONPATH="src" $(EPYDOC) -v --html --output="doc/html" moul
-
-# What should the default be?
-test: test_inplace
-
-exe: py2exe
-
-installer: innosetup
-
-egg: bdist_egg
-
-doc: doc_html
-
-clean:
- find . \( -name '*.o' -o -name '*.c' -o -name '*.so' -o -name '*.py[cod]' -o -name '*.dll' \) -exec rm -f {} \;
- rm -rf build
-
-realclean: clean
- rm -f TAGS
- $(PYTHON) setup.py clean -a
-
Copied: pymoul/trunk/Makefile.in (from rev 88, pymoul/trunk/Makefile)
===================================================================
--- pymoul/trunk/Makefile.in (rev 0)
+++ pymoul/trunk/Makefile.in 2007-01-27 22:29:40 UTC (rev 89)
@@ -0,0 +1,67 @@
+PYTHON?=python
+EPYDOC=$(PYTHON) -c "import epydoc.cli; epydoc.cli.cli()"
+TESTFLAGS=-v
+TESTOPTS=
+SETUPFLAGS=
+
+all: inplace
+
+# Build in-place
+inplace:
+ PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) build_ext -i
+
+build: compileui
+ PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) build
+
+py2exe:
+ PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) py2exe
+
+innosetup:
+ PYTHONPATH="src" INNOSETUP="yes" $(PYTHON) setup.py $(SETUPFLAGS) py2exe
+
+bdist_egg:
+ PYTHONPATH="src" $(PYTHON) setup.py $(SETUPFLAGS) bdist_egg
+
+run: compileui
+ PYTHONPATH="src" $(PYTHON) src/moul/qt/moulqt.py
+
+exerun: compileui py2exe
+ dist/moulqt.exe
+
+compileui:
+ $(PYTHON) compileui.py
+
+test_build: build compileui
+ PYTHONPATH="src" $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
+
+test_inplace: compileui
+ PYTHONPATH="src" $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
+
+doc_html:
+ PYTHONPATH="src" $(EPYDOC) -v --html --output="doc/html" moul
+
+# What should the default be?
+test: test_inplace
+
+exe: py2exe
+
+installer: innosetup
+
+egg: bdist_egg
+
+doc: doc_html
+
+clean:
+ find . \( -name '*.o' -o -name '*.c' -o -name '*.so' -o -name '*.py[cod]' -o -name '*.dll' \) -exec rm -f {} \;
+ rm -rf build
+
+realclean: clean
+ rm -f TAGS
+ $(PYTHON) setup.py clean -a
+
+propset:
+ find src/moul \( -name '*.py' -o -name '*.txt' \) -a -not -wholename '*.svn*' | xargs svn propset svn:keywords "Id Revision"
+ find src/moul \( -name '*.py' -o -name '*.txt' -o -name '*.qrc' -o -name '*.ui' \) -a -not -wholename '*.svn*' | xargs svn propset svn:eol-style "native"
+ find . -maxdepth 1 \( -name '*.py' -o -name '*.txt' \) | xargs svn propset svn:keywords "Id Revisioni"
+ find . -maxdepth 1 \( -name '*.py' -o -name '*.txt' \) | xargs svn propset svn:eol-style "native"
+
Property changes on: pymoul/trunk/README.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revisioni
Modified: pymoul/trunk/compileui.py
===================================================================
--- pymoul/trunk/compileui.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/compileui.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -3,7 +3,7 @@
"""
__author__ = "Christian Heimes"
__version__ = "$Id$"
-__revision__ = "$Revision$"
+__revision__ = "$Revision: 45 $"
import os
import re
Property changes on: pymoul/trunk/compileui.py
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Id Revisioni
Property changes on: pymoul/trunk/distutils_upx.py
___________________________________________________________________
Name: svn:keywords
+ Id Revisioni
Property changes on: pymoul/trunk/ez_setup.py
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Id Revisioni
Modified: pymoul/trunk/setup.py
===================================================================
--- pymoul/trunk/setup.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/setup.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -5,7 +5,7 @@
"""
__author__ = "Christian Heimes"
__version__ = "$Id$"
-__revision__ = "$Revision$"
+__revision__ = "$Revision: 58 $"
import sys
import os
Property changes on: pymoul/trunk/setup.py
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Id Revisioni
Modified: pymoul/trunk/setup_win32.py
===================================================================
--- pymoul/trunk/setup_win32.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/setup_win32.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -2,7 +2,7 @@
"""
__author__ = "Christian Heimes"
__version__ = "$Id$"
-__revision__ = "$Revision$"
+__revision__ = "$Revision: 86 $"
import os
import sys
Property changes on: pymoul/trunk/setup_win32.py
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Id Revisioni
Property changes on: pymoul/trunk/src/moul/config/tests/test_config.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/file/tests/audio.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/file/tests/audiocaps.0.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/file/tests/graphics.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/file/tests/test_chatlog.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/file/tests/test_kiimage.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/file/tests/test_localization.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/file/tests/test_plasmalog.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/file/tests/test_wdysini.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Modified: pymoul/trunk/src/moul/osdependent/__init__.py
===================================================================
--- pymoul/trunk/src/moul/osdependent/__init__.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/src/moul/osdependent/__init__.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -1,136 +1,136 @@
-# pyMoul - Python interface to Myst Online URU Live
-# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
-
-# 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., 59
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-"""OS dependent code for linux, mac and win32
-
->>> pids = getPids()
->>> len(pids) > 1
-True
-
->>> pids = getPidNames()
->>> found = False
->>> for pid, name in pids.items():
-... if name.lower().startswith('python'):
-... found = True
->>> found
-True
-"""
-__author__ = "Christian Heimes"
-__version__ = "$Id$"
-__revision__ = "$Revision$"
-
-import os
-import sys
-from moul.log import getLogger
-from moul.osdependent.processinfo import getPids
-from moul.osdependent.processinfo import getPidNames
-
-LOG = getLogger('moul.osdependent')
-
-# a program under py2exe is sys.frozen
-__FROZEN__ = bool(getattr(sys, 'frozen', False))
-# OS stuff
-_plat = sys.platform.startswith
-__WIN32__ = _plat('win32') # win64, cygwin?
-__CYGWIN__ = _plat('cygwin')
-__LINUX__ = _plat('linux2')
-__MACOSX__ = _plat('darwin')
-__BSD__ = _plat('freebsd') or _plat('netbsd') or _plat('openbsd')
-__POSIX__ = os.name.lower() == 'posix'
-__NT__ = os.name.lower() == 'nt'
-__INFO__ = (__WIN32__, __CYGWIN__, __LINUX__, __MACOSX__, __BSD__,
- __POSIX__, __NT__)
-
-# names to import: from moul.osdependent.ID import NAME (as NAME)
-NAMES = ('getMoulUserDataDir',
- ('getPyMoulDataDir', '_getPyMoulDataDir'), # as
- 'startMoul', 'isMoulRunning',
- )
-
-_marker = object()
-
-def _importHelper(modname, names=None, target=None):
- """Import a list of variables from a module
-
- >>> mod = _importHelper('moul.osdependent')
- >>> mod == _thismodule or mod
- True
- >>> vars = _importHelper('moul.osdependent', ('_marker', ))
- >>> vars[0] is _marker
- True
- >>> class Target(object):
- ... pass
- >>> target = Target()
- >>> vars = _importHelper('moul.osdependent', ('_marker', ), target=target)
- >>> target._marker is _marker
- True
- >>> vars[0] is _marker
- True
-
- >>> vars = _importHelper('moul.osdependent', (('_marker', 'another'), ),
- ... target=target)
- >>> target.another is _marker
- True
- >>> vars[0] is _marker
- True
- """
- mod = __import__(modname, globals(), locals(), [''])
- if names is None:
- return mod
- else:
- vars = []
- for name in names:
- if isinstance(name, (tuple, list)):
- name, nameas = name
- else:
- nameas = name
- var = getattr(mod, name)
- vars.append(var)
- if target is not None:
- setattr(target, nameas, var)
- return vars
-
-# XXX: what about cygwin, bsd and others?
-_thismodule = sys.modules[__name__]
-if __WIN32__:
- _importHelper('moul.osdependent.win32', NAMES, target=_thismodule)
-elif __LINUX__:
- _importHelper('moul.osdependent.linux', NAMES, target=_thismodule)
-elif __MACOSX__:
- _importHelper('moul.osdependent.darwin', NAMES, target=_thismodule)
-else:
- raise RuntimeError('platform %s not supported' % sys.platform)
-
-def getPyMoulDataDir(check=False):
- """Get pyMoul data directory
-
- The directory contains log files, ini files and other local stuff
- """
- datadir = _getPyMoulDataDir()
- if check:
- if os.path.abspath(datadir) != datadir:
- raise ValueError("Datadir is not absolute %s" % datadir)
- if not os.path.isdir(datadir):
- parent = os.path.abspath(os.path.join(datadir, os.pardir))
- if not os.path.isdir(parent):
- raise ValueError("Datadir's parent dir does not exist: %s"
- % par)
- else:
- LOG.debug("Creating pyMoul data dir %s" % datadir)
- os.mkdir(datadir, 0750)
- LOG.debug("Using pyMoul data dir %s" % datadir)
- return datadir
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# 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., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""OS dependent code for linux, mac and win32
+
+>>> pids = getPids()
+>>> len(pids) > 1
+True
+
+>>> pids = getPidNames()
+>>> found = False
+>>> for pid, name in pids.items():
+... if name.lower().startswith('python'):
+... found = True
+>>> found
+True
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
+
+import os
+import sys
+from moul.log import getLogger
+from moul.osdependent.processinfo import getPids
+from moul.osdependent.processinfo import getPidNames
+
+LOG = getLogger('moul.osdependent')
+
+# a program under py2exe is sys.frozen
+__FROZEN__ = bool(getattr(sys, 'frozen', False))
+# OS stuff
+_plat = sys.platform.startswith
+__WIN32__ = _plat('win32') # win64, cygwin?
+__CYGWIN__ = _plat('cygwin')
+__LINUX__ = _plat('linux2')
+__MACOSX__ = _plat('darwin')
+__BSD__ = _plat('freebsd') or _plat('netbsd') or _plat('openbsd')
+__POSIX__ = os.name.lower() == 'posix'
+__NT__ = os.name.lower() == 'nt'
+__INFO__ = (__WIN32__, __CYGWIN__, __LINUX__, __MACOSX__, __BSD__,
+ __POSIX__, __NT__)
+
+# names to import: from moul.osdependent.ID import NAME (as NAME)
+NAMES = ('getMoulUserDataDir',
+ ('getPyMoulDataDir', '_getPyMoulDataDir'), # as
+ 'startMoul', 'isMoulRunning',
+ )
+
+_marker = object()
+
+def _importHelper(modname, names=None, target=None):
+ """Import a list of variables from a module
+
+ >>> mod = _importHelper('moul.osdependent')
+ >>> mod == _thismodule or mod
+ True
+ >>> vars = _importHelper('moul.osdependent', ('_marker', ))
+ >>> vars[0] is _marker
+ True
+ >>> class Target(object):
+ ... pass
+ >>> target = Target()
+ >>> vars = _importHelper('moul.osdependent', ('_marker', ), target=target)
+ >>> target._marker is _marker
+ True
+ >>> vars[0] is _marker
+ True
+
+ >>> vars = _importHelper('moul.osdependent', (('_marker', 'another'), ),
+ ... target=target)
+ >>> target.another is _marker
+ True
+ >>> vars[0] is _marker
+ True
+ """
+ mod = __import__(modname, globals(), locals(), [''])
+ if names is None:
+ return mod
+ else:
+ vars = []
+ for name in names:
+ if isinstance(name, (tuple, list)):
+ name, nameas = name
+ else:
+ nameas = name
+ var = getattr(mod, name)
+ vars.append(var)
+ if target is not None:
+ setattr(target, nameas, var)
+ return vars
+
+# XXX: what about cygwin, bsd and others?
+_thismodule = sys.modules[__name__]
+if __WIN32__:
+ _importHelper('moul.osdependent.win32', NAMES, target=_thismodule)
+elif __LINUX__:
+ _importHelper('moul.osdependent.linux', NAMES, target=_thismodule)
+elif __MACOSX__:
+ _importHelper('moul.osdependent.darwin', NAMES, target=_thismodule)
+else:
+ raise RuntimeError('platform %s not supported' % sys.platform)
+
+def getPyMoulDataDir(check=False):
+ """Get pyMoul data directory
+
+ The directory contains log files, ini files and other local stuff
+ """
+ datadir = _getPyMoulDataDir()
+ if check:
+ if os.path.abspath(datadir) != datadir:
+ raise ValueError("Datadir is not absolute %s" % datadir)
+ if not os.path.isdir(datadir):
+ parent = os.path.abspath(os.path.join(datadir, os.pardir))
+ if not os.path.isdir(parent):
+ raise ValueError("Datadir's parent dir does not exist: %s"
+ % par)
+ else:
+ LOG.debug("Creating pyMoul data dir %s" % datadir)
+ os.mkdir(datadir, 0750)
+ LOG.debug("Using pyMoul data dir %s" % datadir)
+ return datadir
Property changes on: pymoul/trunk/src/moul/osdependent/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: pymoul/trunk/src/moul/osdependent/darwin/__init__.py
===================================================================
--- pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -1,57 +1,57 @@
-# pyMoul - Python interface to Myst Online URU Live
-# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
-
-# 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., 59
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-"""moul.osdependent.darwin
-"""
-__author__ = "Christian Heimes"
-__version__ = "$Id$"
-__revision__ = "$Revision$"
-
-import os
-from subprocess import Popen
-from moul.log import getLogger
-
-LOG = getLogger('moul.darwin')
-LOG.critical('Darwin/Mac support is not tested')
-
-MOUL_DIR = "Uru Live"
-EXEC_NAME = "UruLauncher"
-HOME = os.environ['HOME']
-
-def getMoulUserDataDir():
- """Get path of MOUL data directory
-
- The MOUL data directory contains log files, chatlogs, KI images and many
- more things.
- """
- moul_data = os.path.join(HOME, MOUL_DIR)
-
-def getPyMoulDataDir():
- """Get path to the pyMoul ini directory
- """
- inidir= os.path.join(HOME, '.pymoul')
- return inidir
-
-def startMoul(installdir, *args, **kwargs):
- """Start MOUL - returns a Popen instance
-
- args are applied to the program while kwargs are applied to
- subprocess.Popen()
- """
- path = os.path.join(installdir, EXEC_NAME)
- args = ' '.join(args)
- return Popen("%s %s" % (path, args), cwd=installdir, **kwargs)
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# 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., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""moul.osdependent.darwin
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
+
+import os
+from subprocess import Popen
+from moul.log import getLogger
+
+LOG = getLogger('moul.darwin')
+LOG.critical('Darwin/Mac support is not tested')
+
+MOUL_DIR = "Uru Live"
+EXEC_NAME = "UruLauncher"
+HOME = os.environ['HOME']
+
+def getMoulUserDataDir():
+ """Get path of MOUL data directory
+
+ The MOUL data directory contains log files, chatlogs, KI images and many
+ more things.
+ """
+ moul_data = os.path.join(HOME, MOUL_DIR)
+
+def getPyMoulDataDir():
+ """Get path to the pyMoul ini directory
+ """
+ inidir= os.path.join(HOME, '.pymoul')
+ return inidir
+
+def startMoul(installdir, *args, **kwargs):
+ """Start MOUL - returns a Popen instance
+
+ args are applied to the program while kwargs are applied to
+ subprocess.Popen()
+ """
+ path = os.path.join(installdir, EXEC_NAME)
+ args = ' '.join(args)
+ return Popen("%s %s" % (path, args), cwd=installdir, **kwargs)
Property changes on: pymoul/trunk/src/moul/osdependent/darwin/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: pymoul/trunk/src/moul/osdependent/linux/__init__.py
===================================================================
--- pymoul/trunk/src/moul/osdependent/linux/__init__.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/src/moul/osdependent/linux/__init__.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -1,115 +1,115 @@
-# pyMoul - Python interface to Myst Online URU Live
-# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
-
-# 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., 59
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-"""moul.osdependent.linux
-"""
-__author__ = "Christian Heimes"
-__version__ = "$Id$"
-__revision__ = "$Revision$"
-
-import os
-from subprocess import Popen
-from moul.log import getLogger
-
-LOG = getLogger('moul.linux')
-LOG.critical('Darwin/Mac support is not tested')
-
-MOUL_DIR = "Uru Live"
-INI_FILE = ('pyMoul', 'pymoul.ini')
-EXEC_NAME = "UruLauncher"
-HOME = os.environ['HOME']
-PROCESSES = ('urulauncher', 'uruexplorer')
-
-def getMoulUserDataDir():
- """Get path of MOUL data directory
-
- The MOUL data directory contains log files, chatlogs, KI images and many
- more things.
- """
- return os.path.join(HOME, MOUL_DIR)
-
-def getPyMoulDataDir():
- """Get path to the pyMoul ini directory
- """
- inidir= os.path.join(HOME, '.pymoul')
- return inidir
-
-def startMoul(installdir, *args, **kwargs):
- """Start MOUL - returns a Popen instance
-
- args are applied to the program while kwargs are applied to
- subprocess.Popen()
- """
- path = os.path.join(installdir, EXEC_NAME)
- args = ' '.join(args)
- return Popen("%s %s" % (path, args), cwd=installdir, **kwargs)
-
-def isMoulRunning():
- """Test if MOUL or the launcher is running
- """
- for pid, name in getCurrentPidNames().items():
- if name.lower() in PROCESSES:
- return name.lower()
- return False
-
-# process info
-# based on http://gelb.bcom.at/trac/misc/browser/processinfo
-def getCurrentPids():
- """Returns current process ids
- """
- pids = []
- for fname in os.listdir("/proc"):
- if os.path.isdir(os.path.join("/proc", fname)):
- try:
- pids.append(int(fname))
- except ValueError:
- continue
- return pids
-
-def getCurrentPidDetails():
- """Returns mapping pid -> detailed informations
- """
- mapping = {}
- for pid in getCurrentPids():
- try:
- try:
- # read entiry file to avoid race condition bugs
- fd = open('/proc/%i/status' % pid, 'rb')
- status = fd.read().split('\n')
- finally:
- if fd:
- fd.close()
- except IoError:
- continue
- details = {}
- for line in status:
- try:
- key, value = line.split(':\t')
- except ValueError:
- continue
- details[key.lower()] = value.strip()
- mapping[pid] = details
-
- return mapping
-
-def getCurrentPidNames():
- """Returns mapping pid -> name
- """
- mapping = {}
- for pid, details in getCurrentPidDetails().items():
- mapping[pid] = details.get('name', None)
- return mapping
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# 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., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""moul.osdependent.linux
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
+
+import os
+from subprocess import Popen
+from moul.log import getLogger
+
+LOG = getLogger('moul.linux')
+LOG.critical('Linux support is not tested')
+
+MOUL_DIR = "Uru Live"
+INI_FILE = ('pyMoul', 'pymoul.ini')
+EXEC_NAME = "UruLauncher"
+HOME = os.environ['HOME']
+PROCESSES = ('urulauncher', 'uruexplorer')
+
+def getMoulUserDataDir():
+ """Get path of MOUL data directory
+
+ The MOUL data directory contains log files, chatlogs, KI images and many
+ more things.
+ """
+ return os.path.join(HOME, MOUL_DIR)
+
+def getPyMoulDataDir():
+ """Get path to the pyMoul ini directory
+ """
+ inidir= os.path.join(HOME, '.pymoul')
+ return inidir
+
+def startMoul(installdir, *args, **kwargs):
+ """Start MOUL - returns a Popen instance
+
+ args are applied to the program while kwargs are applied to
+ subprocess.Popen()
+ """
+ path = os.path.join(installdir, EXEC_NAME)
+ args = ' '.join(args)
+ return Popen("%s %s" % (path, args), cwd=installdir, **kwargs)
+
+def isMoulRunning():
+ """Test if MOUL or the launcher is running
+ """
+ for pid, name in getCurrentPidNames().items():
+ if name.lower() in PROCESSES:
+ return name.lower()
+ return False
+
+# process info
+# based on http://gelb.bcom.at/trac/misc/browser/processinfo
+def getCurrentPids():
+ """Returns current process ids
+ """
+ pids = []
+ for fname in os.listdir("/proc"):
+ if os.path.isdir(os.path.join("/proc", fname)):
+ try:
+ pids.append(int(fname))
+ except ValueError:
+ continue
+ return pids
+
+def getCurrentPidDetails():
+ """Returns mapping pid -> detailed informations
+ """
+ mapping = {}
+ for pid in getCurrentPids():
+ try:
+ try:
+ # read entiry file to avoid race condition bugs
+ fd = open('/proc/%i/status' % pid, 'rb')
+ status = fd.read().split('\n')
+ finally:
+ if fd:
+ fd.close()
+ except IoError:
+ continue
+ details = {}
+ for line in status:
+ try:
+ key, value = line.split(':\t')
+ except ValueError:
+ continue
+ details[key.lower()] = value.strip()
+ mapping[pid] = details
+
+ return mapping
+
+def getCurrentPidNames():
+ """Returns mapping pid -> name
+ """
+ mapping = {}
+ for pid, details in getCurrentPidDetails().items():
+ mapping[pid] = details.get('name', None)
+ return mapping
Property changes on: pymoul/trunk/src/moul/osdependent/linux/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: pymoul/trunk/src/moul/osdependent/processinfo.py
===================================================================
--- pymoul/trunk/src/moul/osdependent/processinfo.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/src/moul/osdependent/processinfo.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -29,13 +29,15 @@
>>> pids > 1
True
>>> isinstance(pids[0], (int, long))
+True
>>> cur in pids
True
>>> mapping = getPidNames()
>>> cur in mapping
->>> mapping[cur].lower() in cur
True
+>>> mapping[cur].lower() in sys.executable
+True
>>> getPidDetails('self')['name'] == getPidDetails(cur)['name']
True
Property changes on: pymoul/trunk/src/moul/osdependent/processinfo.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: pymoul/trunk/src/moul/osdependent/singleapp.py
===================================================================
--- pymoul/trunk/src/moul/osdependent/singleapp.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/src/moul/osdependent/singleapp.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -19,55 +19,11 @@
Includes portalocker code with minor tweaks for Python 2.4+
Author: Jonathan Feinberg <jd...@po...>
- Version: $Id: portalocker.py,v 1.3 2001/05/29 18:47:55 Administrator Exp $
+ Version: $Id$
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
-Boiler plate
->>> import sys
->>> from shutil import rmtree
->>> from subprocess import Popen
->>> from StringIO import StringIO
->>> tmpdir = tempfile.mkdtemp()
->>> testfile = os.path.join(tmpdir, 'test.lck')
->>> if os.name == 'nt':
-... rm = "cmd /c del"
-... else:
-... rm = "rm"
+Unit tests for lock/unlock are in tests/test_singleapp
-Create a file and lock it for this process
->>> flags = LOCK_SH | LOCK_NB
->>> fd1 = open(testfile, 'w')
->>> fn1 = fd1.fileno()
->>> lock(fd1, flags)
->>> fd1.write('testdata')
->>> os.path.isfile(testfile)
-True
-
-Try to delete the file from another process
->>> stdout = tempfile.TemporaryFile(mode="w+")
->>> stderr = tempfile.TemporaryFile(mode="w+")
->>> popen = Popen("%s %s" % (rm, testfile), stdout=stdout, stderr=stderr)
->>> popen.wait()
-0
-
->>> stdout.seek(0)
->>> out = stdout.read()
->>> if os.name == 'nt':
-... out.endswith('test.lck\\n') or out
-True
-
->>> stderr.seek(0)
->>> stderr.read() != ''
-True
-
->>> os.path.isfile(testfile)
-True
-
-Clean up
->>> unlock(fd1)
->>> fd1.close()
->>> rmtree(tmpdir)
-
>>> singleapp = SimpleSingleApp('testapp')
>>> lckfile = singleapp.lckfile
>>> if os.path.isfile(lckfile):
@@ -109,13 +65,15 @@
# LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY
# lowbits, highbits = 0, -65536
LOCK_SH, LOCK_NB = 0, 1
+ LOCK = "dummy"
elif os.name == 'posix':
import fcntl
- #LOCK_EX = fcntl.LOCK_EX
+ LOCK_EX = fcntl.LOCK_EX
LOCK_SH = fcntl.LOCK_SH
LOCK_NB = fcntl.LOCK_NB
+ LOCK = LOCK_EX | LOCK_NB
else:
- raise RuntimeError("PortaLocker only defined for nt and posix platforms")
+ raise OSError("PortaLocker only defined for nt and posix platforms")
if os.name == 'nt':
def lock(file, flags):
@@ -128,9 +86,9 @@
pass
elif os.name =='posix':
def lock(file, flags):
- return fcntl.flock(file.fileno(), flags)
+ return fcntl.lockf(file, flags)
def unlock(file):
- return fcntl.flock(file.fileno(), fcntl.LOCK_UN)
+ return fcntl.lockf(file, fcntl.LOCK_UN)
class SingleAppError(OSError):
pass
@@ -138,7 +96,6 @@
class SimpleSingleApp(object):
"""A simple single instance application implemementation
"""
- flags = LOCK_SH | LOCK_NB
def __init__(self, appname, path=TEMPDIR, user=USER, pid=PID, ext='.lck',
*args):
@@ -152,28 +109,24 @@
self.lckfile = self._genFilename()
# register atexit function
atexit.register(self.release)
-
+
def acquire(self):
"""Acquire lock
-
+
May raise an OSError
"""
- if os.path.isfile(self.lckfile):
- try:
- os.unlink(self.lckfile)
- except OSError, IOError:
- self._fd = None
- raise SingleAppError("Another instance is already running")
try:
- self._fd = open(self.lckfile, 'w')
- self._fd.write(str(self.pid))
- self._fd.flush()
- lock(self._fd, self.flags)
+ self._fd = open(self.lckfile, 'w+')
+ lock(self._fd, LOCK)
except (OSError, IOError):
- self._fd.close()
+ LOG.exception("Failed to acquire lock")
+ if self._fd is not None:
+ self._fd.close()
self._fd = None
raise SingleAppError("Another instance is already running")
else:
+ self._fd.write(str(self.pid))
+ self._fd.flush()
LOG.info("Create lock file %s for PID %i" % (self.lckfile, self.pid))
return self.lckfile, self.pid
@@ -181,11 +134,12 @@
"""Release lock
"""
try:
- unlock(self._fd)
+ if self._fd is not None:
+ unlock(self._fd)
except (SystemError, SyntaxError):
raise
except:
- pass
+ LOG.exception("Error while releasin the lock")
if self._fd:
self._fd.close()
if os.path.isfile(self.lckfile):
Property changes on: pymoul/trunk/src/moul/osdependent/singleapp.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/osdependent/tests/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/osdependent/tests/test_osdependent.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Added: pymoul/trunk/src/moul/osdependent/tests/test_processinfo.py
===================================================================
--- pymoul/trunk/src/moul/osdependent/tests/test_processinfo.py (rev 0)
+++ pymoul/trunk/src/moul/osdependent/tests/test_processinfo.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -0,0 +1,36 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# 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., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""moul.osdependent.processinfo
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
+
+import unittest
+from doctest import DocTestSuite
+
+import moul.osdependent.processinfo
+
+def test_suite():
+ return unittest.TestSuite((
+ DocTestSuite('moul.osdependent.processinfo'),
+ ))
+
+if __name__ == '__main__':
+ unittest.main(defaultTest="test_suite")
+
Property changes on: pymoul/trunk/src/moul/osdependent/tests/test_processinfo.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: pymoul/trunk/src/moul/osdependent/tests/test_singleapp.py
===================================================================
--- pymoul/trunk/src/moul/osdependent/tests/test_singleapp.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/src/moul/osdependent/tests/test_singleapp.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -29,11 +29,83 @@
from moul.osdependent.singleapp import unlock
from moul.osdependent.singleapp import LOCK_SH, LOCK_NB
+import sys
+import os
+import tempfile
+from shutil import rmtree
+from subprocess import Popen
+from StringIO import StringIO
+tmpdir = tempfile.mkdtemp()
+testfile = os.path.join(tmpdir, 'test.lck')
+
+if os.name == 'nt':
+ rmcmd = "cmd /c del %(testfile)s"
+else:
+ rmcmd = ("LC_ALL=C %(exe)s -c 'from fcntl import *; "
+ "fd = open(%(testfile)s, %(mode)s); "
+ "lockf(fd, LOCK_EX | LOCK_NB)'" % {'exe' : sys.executable,
+ 'mode' : '"a+"', 'testfile' : '"%(testfile)s"'})
+
+
+ #singleapp = SimpleSingleApp('testapp')
+ #lckfile = singleapp.lckfile
+ #if os.path.isfile(lckfile):
+#... os.unlink(fpath)
+ #path, pid = singleapp.acquire()
+ #path == lckfile
+#True
+ #os.path.isfile(lckfile)
+#True
+ #singleapp.checkLocked() is None
+#True
+ #singleapp.release()
+ #os.path.isfile(lckfile)
+#False
+
+class SingleAppTest(unittest.TestCase):
+
+ def test_locking(self):
+ FLAGS = LOCK_SH | LOCK_NB
+ fd = open(testfile, 'w+')
+ fd.write('testdata')
+ fd.flush()
+ self.failUnless(os.path.isfile(testfile))
+ lock(fd, FLAGS)
+ # Try to delete the file from another process
+ stdout = tempfile.TemporaryFile(mode="w+")
+ stderr = tempfile.TemporaryFile(mode="w+")
+ popen = Popen(rmcmd % {'testfile' : testfile}, stdout=stdout,
+ stderr=stderr, shell=True)
+
+ popen.wait()
+ stdout.seek(0)
+ out = stdout.read()
+ if os.name == 'nt':
+ self.failUnlessEqual(out, '')
+ elif os.name =='posix':
+ self.failUnlessEqual(out, '')
+ else:
+ raise OSError("unsupported os")
+
+ stderr.seek(0)
+ err = stderr.read()
+ if os.name == 'nt':
+ self.failUnless('IOError: [Errno 11] Resource temporarily unavailable' in err)
+ elif os.name =='posix':
+ self.failUnless('IOError: [Errno 11] Resource temporarily unavailable' in err)
+ else:
+ raise OSError("unsupported os")
+
+ self.failUnless(os.path.isfile(testfile))
+ unlock(fd)
+ fd.close()
+ rmtree(tmpdir)
+
def test_suite():
return unittest.TestSuite((
+ unittest.makeSuite(SingleAppTest),
DocTestSuite('moul.osdependent.singleapp'),
))
if __name__ == '__main__':
unittest.main(defaultTest="test_suite")
-
Property changes on: pymoul/trunk/src/moul/osdependent/tests/test_singleapp.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Modified: pymoul/trunk/src/moul/osdependent/win32/__init__.py
===================================================================
--- pymoul/trunk/src/moul/osdependent/win32/__init__.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/src/moul/osdependent/win32/__init__.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -1,74 +1,74 @@
-# pyMoul - Python interface to Myst Online URU Live
-# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
-
-# 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., 59
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-"""moul.osdependent.win32
-"""
-__author__ = "Christian Heimes"
-__version__ = "$Id$"
-__revision__ = "$Revision$"
-
-import os
-from subprocess import Popen
-
-from moul.osdependent.win32.winpath import get_homedir as getMyDocuments
-from moul.osdependent.win32.winpath import get_appdata as getAppdata
-from moul.log import getLogger
-from moul.osdependent.processinfo import getPidNames
-
-LOG = getLogger('moul.win')
-
-MOUL_DIR = "Uru Live"
-EXEC_NAME = "UruLauncher.exe"
-# lower case
-PROCESSES = ("urulauncher.exe", "uruexplorer.exe")
-
-MYDOCS = getMyDocuments()
-MYAPPDATA = getAppdata()
-
-def getMoulUserDataDir():
- """Get path of MOUL data directory
-
- The MOUL data directory contains log files, chatlogs, KI images and many
- more things.
- """
- moul_data = os.path.join(MYDOCS, MOUL_DIR)
- return moul_data
-
-def getPyMoulDataDir():
- """Get path to the pyMoul ini file
- """
- inidir = os.path.join(MYAPPDATA , 'pyMoul')
- return inidir
-
-def startMoul(installdir, *args, **kwargs):
- """Start MOUL - returns a Popen instance
-
- args are applied to the program while kwargs are applied to
- subprocess.Popen()
- """
- path = os.path.join(installdir, EXEC_NAME)
- args = ' '.join(args)
- return Popen("%s %s" % (path, args), cwd=installdir, **kwargs)
-
-def isMoulRunning():
- """Test if MOUL or the launcher is running
- """
- for pid, name in getPidNames().items():
- if name.lower() in PROCESSES:
- return pid, name.lower()
- return False
-
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# 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., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""moul.osdependent.win32
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
+
+import os
+from subprocess import Popen
+
+from moul.osdependent.win32.winpath import get_homedir as getMyDocuments
+from moul.osdependent.win32.winpath import get_appdata as getAppdata
+from moul.log import getLogger
+from moul.osdependent.processinfo import getPidNames
+
+LOG = getLogger('moul.win')
+
+MOUL_DIR = "Uru Live"
+EXEC_NAME = "UruLauncher.exe"
+# lower case
+PROCESSES = ("urulauncher.exe", "uruexplorer.exe")
+
+MYDOCS = getMyDocuments()
+MYAPPDATA = getAppdata()
+
+def getMoulUserDataDir():
+ """Get path of MOUL data directory
+
+ The MOUL data directory contains log files, chatlogs, KI images and many
+ more things.
+ """
+ moul_data = os.path.join(MYDOCS, MOUL_DIR)
+ return moul_data
+
+def getPyMoulDataDir():
+ """Get path to the pyMoul ini file
+ """
+ inidir = os.path.join(MYAPPDATA , 'pyMoul')
+ return inidir
+
+def startMoul(installdir, *args, **kwargs):
+ """Start MOUL - returns a Popen instance
+
+ args are applied to the program while kwargs are applied to
+ subprocess.Popen()
+ """
+ path = os.path.join(installdir, EXEC_NAME)
+ args = ' '.join(args)
+ return Popen("%s %s" % (path, args), cwd=installdir, **kwargs)
+
+def isMoulRunning():
+ """Test if MOUL or the launcher is running
+ """
+ for pid, name in getPidNames().items():
+ if name.lower() in PROCESSES:
+ return pid, name.lower()
+ return False
+
Property changes on: pymoul/trunk/src/moul/osdependent/win32/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Property changes on: pymoul/trunk/src/moul/osdependent/win32/registry.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/osdependent/win32/winpath.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/qt/localization.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Modified: pymoul/trunk/src/moul/qt/moulqt.py
===================================================================
--- pymoul/trunk/src/moul/qt/moulqt.py 2007-01-27 21:30:28 UTC (rev 88)
+++ pymoul/trunk/src/moul/qt/moulqt.py 2007-01-27 22:29:40 UTC (rev 89)
@@ -50,7 +50,7 @@
"""
LOG.info("Starting PyMoul QT UI with argv %s" % repr(args))
app = QtGui.QApplication(*args)
- singleapp = SimpleSingleApp('pymoulqt', path=getPyMoulDataDir())
+ singleapp = SimpleSingleApp('pymoulqt', path=getPyMoulDataDir(check=True))
try:
singleapp.acquire()
except OSError:
Property changes on: pymoul/trunk/src/moul/qt/ui/README.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/server/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/server/ping.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/server/serverlist.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/server/tests/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/server/tests/test_ping.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/server/tests/test_serverlist.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/src/moul/time/README.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Property changes on: pymoul/trunk/src/moul/time/tests/test_dni.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Property changes on: pymoul/trunk/test.py
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Id Revisioni
Property changes on: pymoul/trunk/version.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revisioni
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|