1.1 --- a/PKG-INFO Wed Oct 15 23:18:02 2008 +0200
1.2 +++ b/PKG-INFO Wed Jul 19 21:36:11 2006 +0000
1.3 @@ -1,12 +1,12 @@
1.4 Metadata-Version: 1.1
1.5 Name: desktop
1.6 -Version: 0.2.2
1.7 +Version: 0.2.3
1.8 Author: Paul Boddie
1.9 Author-email: paul at boddie org uk
1.10 Maintainer: Paul Boddie
1.11 Maintainer-email: paul at boddie org uk
1.12 Home-page: http://www.python.org/sf?id=1301512
1.13 -Download-url: http://www.boddie.org.uk/python/downloads/desktop-0.2.2.tar.gz
1.14 +Download-url: http://www.boddie.org.uk/python/downloads/desktop-0.2.3.tar.gz
1.15 Summary: Simple desktop integration for Python
1.16 License: LGPL
1.17 Description: This module provides desktop environment detection and resource
2.1 --- a/README.txt Wed Oct 15 23:18:02 2008 +0200
2.2 +++ b/README.txt Wed Jul 19 21:36:11 2006 +0000
2.3 @@ -36,6 +36,11 @@
2.4 ROX-Filer Supports file opening using "rox <filename>" but not URL
2.5 opening.
2.6
2.7 +New in desktop 0.2.3 (Changes since desktop 0.2.2)
2.8 +--------------------------------------------------
2.9 +
2.10 + * Added Python 2.3 support (using popen2 instead of subprocess).
2.11 +
2.12 New in desktop 0.2.2 (Changes since desktop 0.2.1)
2.13 --------------------------------------------------
2.14
3.1 --- a/desktop.py Wed Oct 15 23:18:02 2008 +0200
3.2 +++ b/desktop.py Wed Jul 19 21:36:11 2006 +0000
3.3 @@ -5,7 +5,7 @@
3.4 detection and resource opening support for a selection of common and
3.5 standardised desktop environments.
3.6
3.7 -Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk>
3.8 +Copyright (C) 2005, 2006 Paul Boddie <paul@boddie.org.uk>
3.9
3.10 This library is free software; you can redistribute it and/or
3.11 modify it under the terms of the GNU Lesser General Public
3.12 @@ -68,11 +68,25 @@
3.13 http://lists.freedesktop.org/archives/xdg/2004-August/004489.html
3.14 """
3.15
3.16 -__version__ = "0.2.2"
3.17 +__version__ = "0.2.3"
3.18
3.19 import os
3.20 import sys
3.21 -import subprocess
3.22 +
3.23 +try:
3.24 + import subprocess
3.25 + def _run(cmd, shell, wait):
3.26 + opener = subprocess.Popen(cmd, shell=shell)
3.27 + if wait: opener.wait()
3.28 + return opener.pid
3.29 +
3.30 +except ImportError:
3.31 + import popen2
3.32 + def _run(cmd, shell, wait):
3.33 + opener = popen2.Popen3(cmd)
3.34 + if wait: opener.wait()
3.35 + return opener.pid
3.36 +
3.37 import commands
3.38
3.39 def get_desktop():
3.40 @@ -104,17 +118,6 @@
3.41
3.42 return os.environ.has_key("DESKTOP_LAUNCH")
3.43
3.44 -def _wait(pid, block):
3.45 -
3.46 - """
3.47 - Perform a blocking Wait for the given process identifier, 'pid', if the
3.48 - 'block' flag is set to a true value. Return the process identifier.
3.49 - """
3.50 -
3.51 - if block:
3.52 - os.waitpid(pid, os.P_WAIT)
3.53 - return pid
3.54 -
3.55 def open(url, desktop=None, wait=0):
3.56
3.57 """
3.58 @@ -146,7 +149,7 @@
3.59
3.60 if (desktop is None or desktop == "standard") and is_standard():
3.61 arg = "".join([os.environ["DESKTOP_LAUNCH"], commands.mkarg(url)])
3.62 - return _wait(subprocess.Popen(arg, shell=1).pid, wait)
3.63 + return _run(arg, 1, wait)
3.64
3.65 elif (desktop is None or desktop == "Windows") and detected == "Windows":
3.66 # NOTE: This returns None in current implementations.
3.67 @@ -168,6 +171,6 @@
3.68 else:
3.69 raise OSError, "Desktop not supported (neither DESKTOP_LAUNCH nor os.startfile could be used)"
3.70
3.71 - return _wait(subprocess.Popen(cmd).pid, wait)
3.72 + return _run(cmd, 0, wait)
3.73
3.74 # vim: tabstop=4 expandtab shiftwidth=4