summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-08-04 05:45:35 +0000
committer <>2014-12-10 05:33:45 +0000
commitafcc4ea312255a2545f9c67d7c34ffefb00c80c0 (patch)
tree5ca5269e5d4fa6263242a7a96b713616e5f389e0 /daemon
parent02378192d5bb4b16498d87ace57da425166426bf (diff)
downloadpython-daemon-master.tar.gz
Imported from /home/lorry/working-area/delta_python-packages_python-daemon/python-daemon-1.6.1.tar.gz.HEADpython-daemon-1.6.1master
Diffstat (limited to 'daemon')
-rw-r--r--daemon/__init__.py25
-rw-r--r--daemon/daemon.py144
-rw-r--r--daemon/pidfile.py49
-rw-r--r--daemon/pidlockfile.py194
-rw-r--r--daemon/runner.py54
-rw-r--r--daemon/version/__init__.py46
-rw-r--r--daemon/version/version_info.py11
7 files changed, 212 insertions, 311 deletions
diff --git a/daemon/__init__.py b/daemon/__init__.py
index d8dc171..2bd0281 100644
--- a/daemon/__init__.py
+++ b/daemon/__init__.py
@@ -1,20 +1,20 @@
# -*- coding: utf-8 -*-
# daemon/__init__.py
-# Part of python-daemon, an implementation of PEP 3143.
+# Part of ‘python-daemon’, an implementation of PEP 3143.
#
-# Copyright © 2009–2010 Ben Finney <ben+python@benfinney.id.au>
+# Copyright © 2009–2014 Ben Finney <ben+python@benfinney.id.au>
# Copyright © 2006 Robert Niederreiter
#
# This is free software: you may copy, modify, and/or distribute this work
-# under the terms of the Python Software Foundation License, version 2 or
-# later as published by the Python Software Foundation.
-# No warranty expressed or implied. See the file LICENSE.PSF-2 for details.
+# under the terms of the Apache License, version 2.0 as published by the
+# Apache Software Foundation.
+# No warranty expressed or implied. See the file LICENSE.ASF-2 for details.
""" Library to implement a well-behaved Unix daemon process.
This library implements the well-behaved daemon specification of
- :pep:`3143`, "Standard daemon process library".
+ :pep:`3143`, “Standard daemon process library”.
A well-behaved Unix daemon process is tricky to get right, but the
required steps are much the same for every daemon program. A
@@ -37,11 +37,20 @@
"""
-import version
-from daemon import DaemonContext
+from __future__ import (absolute_import, unicode_literals)
+
+from . import version
+from .daemon import DaemonContext
_version = version.version
_copyright = version.copyright
_license = version.license
_url = "http://pypi.python.org/pypi/python-daemon/"
+
+
+# Local variables:
+# coding: utf-8
+# mode: python
+# End:
+# vim: fileencoding=utf-8 filetype=python :
diff --git a/daemon/daemon.py b/daemon/daemon.py
index 28db695..b998966 100644
--- a/daemon/daemon.py
+++ b/daemon/daemon.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# daemon/daemon.py
-# Part of python-daemon, an implementation of PEP 3143.
+# Part of ‘python-daemon’, an implementation of PEP 3143.
#
-# Copyright © 2008–2010 Ben Finney <ben+python@benfinney.id.au>
+# Copyright © 2008–2014 Ben Finney <ben+python@benfinney.id.au>
# Copyright © 2007–2008 Robert Niederreiter, Jens Klein
# Copyright © 2004–2005 Chad J. Schroeder
# Copyright © 2003 Clark Evans
@@ -11,13 +11,15 @@
# Copyright © 2001 Jürgen Hermann
#
# This is free software: you may copy, modify, and/or distribute this work
-# under the terms of the Python Software Foundation License, version 2 or
-# later as published by the Python Software Foundation.
-# No warranty expressed or implied. See the file LICENSE.PSF-2 for details.
+# under the terms of the Apache License, version 2.0 as published by the
+# Apache Software Foundation.
+# No warranty expressed or implied. See the file LICENSE.ASF-2 for details.
""" Daemon process behaviour.
"""
+from __future__ import (absolute_import, unicode_literals)
+
import os
import sys
import resource
@@ -26,6 +28,14 @@ import signal
import socket
import atexit
+
+try:
+ # Base type of strings in Python 2.
+ basestring
+except NameError:
+ # Python 3 only has one string type.
+ basestring = str
+
class DaemonError(Exception):
""" Base exception class for errors from this module. """
@@ -204,21 +214,21 @@ class DaemonContext(object):
"""
def __init__(
- self,
- chroot_directory=None,
- working_directory='/',
- umask=0,
- uid=None,
- gid=None,
- prevent_core=True,
- detach_process=None,
- files_preserve=None,
- pidfile=None,
- stdin=None,
- stdout=None,
- stderr=None,
- signal_map=None,
- ):
+ self,
+ chroot_directory=None,
+ working_directory='/',
+ umask=0,
+ uid=None,
+ gid=None,
+ prevent_core=True,
+ detach_process=None,
+ files_preserve=None,
+ pidfile=None,
+ stdin=None,
+ stdout=None,
+ stderr=None,
+ signal_map=None,
+ ):
""" Set up a new instance. """
self.chroot_directory = chroot_directory
self.working_directory = working_directory
@@ -394,8 +404,8 @@ class DaemonContext(object):
"""
exception = SystemExit(
- "Terminating on signal %(signal_number)r"
- % vars())
+ "Terminating on signal %(signal_number)r"
+ % vars())
raise exception
def _get_exclude_file_descriptors(self):
@@ -418,8 +428,8 @@ class DaemonContext(object):
if files_preserve is None:
files_preserve = []
files_preserve.extend(
- item for item in [self.stdin, self.stdout, self.stderr]
- if hasattr(item, 'fileno'))
+ item for item in [self.stdin, self.stdout, self.stderr]
+ if hasattr(item, 'fileno'))
exclude_descriptors = set()
for item in files_preserve:
if item is None:
@@ -458,8 +468,8 @@ class DaemonContext(object):
"""
signal_handler_map = dict(
- (signal_number, self._make_signal_handler(target))
- for (signal_number, target) in self.signal_map.items())
+ (signal_number, self._make_signal_handler(target))
+ for (signal_number, target) in self.signal_map.items())
return signal_handler_map
@@ -468,10 +478,10 @@ def change_working_directory(directory):
"""
try:
os.chdir(directory)
- except Exception, exc:
+ except Exception as exc:
error = DaemonOSEnvironmentError(
- "Unable to change working directory (%(exc)s)"
- % vars())
+ "Unable to change working directory (%(exc)s)"
+ % vars())
raise error
@@ -486,10 +496,10 @@ def change_root_directory(directory):
try:
os.chdir(directory)
os.chroot(directory)
- except Exception, exc:
+ except Exception as exc:
error = DaemonOSEnvironmentError(
- "Unable to change root directory (%(exc)s)"
- % vars())
+ "Unable to change root directory (%(exc)s)"
+ % vars())
raise error
@@ -498,10 +508,10 @@ def change_file_creation_mask(mask):
"""
try:
os.umask(mask)
- except Exception, exc:
+ except Exception as exc:
error = DaemonOSEnvironmentError(
- "Unable to change file creation mask (%(exc)s)"
- % vars())
+ "Unable to change file creation mask (%(exc)s)"
+ % vars())
raise error
@@ -516,10 +526,10 @@ def change_process_owner(uid, gid):
try:
os.setgid(gid)
os.setuid(uid)
- except Exception, exc:
+ except Exception as exc:
error = DaemonOSEnvironmentError(
- "Unable to change file creation mask (%(exc)s)"
- % vars())
+ "Unable to change process owner (%(exc)s)"
+ % vars())
raise error
@@ -535,15 +545,15 @@ def prevent_core_dump():
try:
# Ensure the resource limit exists on this platform, by requesting
- # its current value
+ # its current value.
core_limit_prev = resource.getrlimit(core_resource)
- except ValueError, exc:
+ except ValueError as exc:
error = DaemonOSEnvironmentError(
- "System does not support RLIMIT_CORE resource limit (%(exc)s)"
- % vars())
+ "System does not support RLIMIT_CORE resource limit (%(exc)s)"
+ % vars())
raise error
- # Set hard and soft limits to zero, i.e. no core dump at all
+ # Set hard and soft limits to zero, i.e. no core dump at all.
core_limit = (0, 0)
resource.setrlimit(core_resource, core_limit)
@@ -571,11 +581,12 @@ def detach_process_context():
pid = os.fork()
if pid > 0:
os._exit(0)
- except OSError, exc:
+ except OSError as exc:
exc_errno = exc.errno
exc_strerror = exc.strerror
error = DaemonProcessDetachError(
- "%(error_message)s: [%(exc_errno)d] %(exc_strerror)s" % vars())
+ "%(error_message)s: [%(exc_errno)d] %(exc_strerror)s"
+ % vars())
raise error
fork_then_exit_parent(error_message="Failed first fork")
@@ -612,17 +623,17 @@ def is_socket(fd):
try:
socket_type = file_socket.getsockopt(
- socket.SOL_SOCKET, socket.SO_TYPE)
- except socket.error, exc:
+ socket.SOL_SOCKET, socket.SO_TYPE)
+ except socket.error as exc:
exc_errno = exc.args[0]
if exc_errno == errno.ENOTSOCK:
- # Socket operation on non-socket
+ # Socket operation on non-socket.
pass
else:
- # Some other socket error
+ # Some other socket error.
result = True
else:
- # No error getting socket type
+ # No error getting socket type.
result = True
return result
@@ -673,15 +684,15 @@ def close_file_descriptor_if_open(fd):
"""
try:
os.close(fd)
- except OSError, exc:
+ except OSError as exc:
if exc.errno == errno.EBADF:
- # File descriptor was not open
+ # File descriptor was not open.
pass
else:
error = DaemonOSEnvironmentError(
- "Failed to close file descriptor %(fd)d"
- " (%(exc)s)"
- % vars())
+ "Failed to close file descriptor %(fd)d"
+ " (%(exc)s)"
+ % vars())
raise error
@@ -742,15 +753,15 @@ def make_default_signal_map():
"""
name_map = {
- 'SIGTSTP': None,
- 'SIGTTIN': None,
- 'SIGTTOU': None,
- 'SIGTERM': 'terminate',
- }
+ 'SIGTSTP': None,
+ 'SIGTTIN': None,
+ 'SIGTTOU': None,
+ 'SIGTERM': 'terminate',
+ }
signal_map = dict(
- (getattr(signal, name), target)
- for (name, target) in name_map.items()
- if hasattr(signal, name))
+ (getattr(signal, name), target)
+ for (name, target) in name_map.items()
+ if hasattr(signal, name))
return signal_map
@@ -774,3 +785,10 @@ def register_atexit_function(func):
"""
atexit.register(func)
+
+
+# Local variables:
+# coding: utf-8
+# mode: python
+# End:
+# vim: fileencoding=utf-8 filetype=python :
diff --git a/daemon/pidfile.py b/daemon/pidfile.py
new file mode 100644
index 0000000..3248aca
--- /dev/null
+++ b/daemon/pidfile.py
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+
+# daemon/pidfile.py
+# Part of ‘python-daemon’, an implementation of PEP 3143.
+#
+# Copyright © 2008–2014 Ben Finney <ben+python@benfinney.id.au>
+#
+# This is free software: you may copy, modify, and/or distribute this work
+# under the terms of the Apache License, version 2.0 as published by the
+# Apache Software Foundation.
+# No warranty expressed or implied. See the file LICENSE.ASF-2 for details.
+
+""" Lockfile behaviour implemented via Unix PID files.
+ """
+
+from __future__ import (absolute_import, unicode_literals)
+
+from lockfile.pidlockfile import PIDLockFile
+
+
+class TimeoutPIDLockFile(PIDLockFile, object):
+ """ Lockfile with default timeout, implemented as a Unix PID file.
+
+ This uses the ``PIDLockFile`` implementation, with the
+ following changes:
+
+ * The `acquire_timeout` parameter to the initialiser will be
+ used as the default `timeout` parameter for the `acquire`
+ method.
+
+ """
+
+ def __init__(self, path, acquire_timeout=None, *args, **kwargs):
+ """ Set up the parameters of a TimeoutPIDLockFile. """
+ self.acquire_timeout = acquire_timeout
+ super(TimeoutPIDLockFile, self).__init__(path, *args, **kwargs)
+
+ def acquire(self, timeout=None, *args, **kwargs):
+ """ Acquire the lock. """
+ if timeout is None:
+ timeout = self.acquire_timeout
+ super(TimeoutPIDLockFile, self).acquire(timeout, *args, **kwargs)
+
+
+# Local variables:
+# coding: utf-8
+# mode: python
+# End:
+# vim: fileencoding=utf-8 filetype=python :
diff --git a/daemon/pidlockfile.py b/daemon/pidlockfile.py
deleted file mode 100644
index c38beae..0000000
--- a/daemon/pidlockfile.py
+++ /dev/null
@@ -1,194 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# daemon/pidlockfile.py
-# Part of python-daemon, an implementation of PEP 3143.
-#
-# Copyright © 2008–2010 Ben Finney <ben+python@benfinney.id.au>
-#
-# This is free software: you may copy, modify, and/or distribute this work
-# under the terms of the Python Software Foundation License, version 2 or
-# later as published by the Python Software Foundation.
-# No warranty expressed or implied. See the file LICENSE.PSF-2 for details.
-
-""" Lockfile behaviour implemented via Unix PID files.
- """
-
-import os
-import errno
-
-from lockfile import (
- LinkFileLock,
- AlreadyLocked, LockFailed,
- NotLocked, NotMyLock,
- )
-
-
-class PIDFileError(Exception):
- """ Abstract base class for errors specific to PID files. """
-
-class PIDFileParseError(ValueError, PIDFileError):
- """ Raised when parsing contents of PID file fails. """
-
-
-class PIDLockFile(LinkFileLock, object):
- """ Lockfile implemented as a Unix PID file.
-
- The PID file is named by the attribute `path`. When locked,
- the file will be created with a single line of text,
- containing the process ID (PID) of the process that acquired
- the lock.
-
- The lock is acquired and maintained as per `LinkFileLock`.
-
- """
-
- def read_pid(self):
- """ Get the PID from the lock file.
- """
- result = read_pid_from_pidfile(self.path)
- return result
-
- def acquire(self, *args, **kwargs):
- """ Acquire the lock.
-
- Locks the PID file then creates the PID file for this
- lock. The `timeout` parameter is used as for the
- `LinkFileLock` class.
-
- """
- super(PIDLockFile, self).acquire(*args, **kwargs)
- try:
- write_pid_to_pidfile(self.path)
- except OSError, exc:
- error = LockFailed("%(exc)s" % vars())
- raise error
-
- def release(self):
- """ Release the lock.
-
- Removes the PID file then releases the lock, or raises an
- error if the current process does not hold the lock.
-
- """
- if self.i_am_locking():
- remove_existing_pidfile(self.path)
- super(PIDLockFile, self).release()
-
- def break_lock(self):
- """ Break an existing lock.
-
- If the lock is held, breaks the lock and removes the PID
- file.
-
- """
- super(PIDLockFile, self).break_lock()
- remove_existing_pidfile(self.path)
-
-
-class TimeoutPIDLockFile(PIDLockFile):
- """ Lockfile with default timeout, implemented as a Unix PID file.
-
- This uses the ``PIDLockFile`` implementation, with the
- following changes:
-
- * The `acquire_timeout` parameter to the initialiser will be
- used as the default `timeout` parameter for the `acquire`
- method.
-
- """
-
- def __init__(self, path, acquire_timeout=None, *args, **kwargs):
- """ Set up the parameters of a DaemonRunnerLock. """
- self.acquire_timeout = acquire_timeout
- super(TimeoutPIDLockFile, self).__init__(path, *args, **kwargs)
-
- def acquire(self, timeout=None, *args, **kwargs):
- """ Acquire the lock. """
- if timeout is None:
- timeout = self.acquire_timeout
- super(TimeoutPIDLockFile, self).acquire(timeout, *args, **kwargs)
-
-
-def read_pid_from_pidfile(pidfile_path):
- """ Read the PID recorded in the named PID file.
-
- Read and return the numeric PID recorded as text in the named
- PID file. If the PID file does not exist, return ``None``. If
- the content is not a valid PID, raise ``PIDFileParseError``.
-
- """
- pid = None
- pidfile = None
- try:
- pidfile = open(pidfile_path, 'r')
- except IOError, exc:
- if exc.errno == errno.ENOENT:
- pass
- else:
- raise
-
- if pidfile:
- # According to the FHS 2.3 section on PID files in ‘/var/run’:
- #
- # The file must consist of the process identifier in
- # ASCII-encoded decimal, followed by a newline character. …
- #
- # Programs that read PID files should be somewhat flexible
- # in what they accept; i.e., they should ignore extra
- # whitespace, leading zeroes, absence of the trailing
- # newline, or additional lines in the PID file.
-
- line = pidfile.readline().strip()
- try:
- pid = int(line)
- except ValueError:
- raise PIDFileParseError(
- "PID file %(pidfile_path)r contents invalid" % vars())
- pidfile.close()
-
- return pid
-
-
-def write_pid_to_pidfile(pidfile_path):
- """ Write the PID in the named PID file.
-
- Get the numeric process ID (“PID”) of the current process
- and write it to the named file as a line of text.
-
- """
- open_flags = (os.O_CREAT | os.O_EXCL | os.O_WRONLY)
- open_mode = (
- ((os.R_OK | os.W_OK) << 6) |
- ((os.R_OK) << 3) |
- ((os.R_OK)))
- pidfile_fd = os.open(pidfile_path, open_flags, open_mode)
- pidfile = os.fdopen(pidfile_fd, 'w')
-
- # According to the FHS 2.3 section on PID files in ‘/var/run’:
- #
- # The file must consist of the process identifier in
- # ASCII-encoded decimal, followed by a newline character. For
- # example, if crond was process number 25, /var/run/crond.pid
- # would contain three characters: two, five, and newline.
-
- pid = os.getpid()
- line = "%(pid)d\n" % vars()
- pidfile.write(line)
- pidfile.close()
-
-
-def remove_existing_pidfile(pidfile_path):
- """ Remove the named PID file if it exists.
-
- Remove the named PID file. Ignore the condition if the file
- does not exist, since that only means we are already in the
- desired state.
-
- """
- try:
- os.remove(pidfile_path)
- except OSError, exc:
- if exc.errno == errno.ENOENT:
- pass
- else:
- raise
diff --git a/daemon/runner.py b/daemon/runner.py
index 0642695..748daeb 100644
--- a/daemon/runner.py
+++ b/daemon/runner.py
@@ -1,30 +1,33 @@
# -*- coding: utf-8 -*-
# daemon/runner.py
-# Part of python-daemon, an implementation of PEP 3143.
+# Part of ‘python-daemon’, an implementation of PEP 3143.
#
-# Copyright © 2009–2010 Ben Finney <ben+python@benfinney.id.au>
+# Copyright © 2009–2014 Ben Finney <ben+python@benfinney.id.au>
# Copyright © 2007–2008 Robert Niederreiter, Jens Klein
# Copyright © 2003 Clark Evans
# Copyright © 2002 Noah Spurrier
# Copyright © 2001 Jürgen Hermann
#
# This is free software: you may copy, modify, and/or distribute this work
-# under the terms of the Python Software Foundation License, version 2 or
-# later as published by the Python Software Foundation.
-# No warranty expressed or implied. See the file LICENSE.PSF-2 for details.
+# under the terms of the Apache License, version 2.0 as published by the
+# Apache Software Foundation.
+# No warranty expressed or implied. See the file LICENSE.ASF-2 for details.
""" Daemon runner library.
"""
+from __future__ import (absolute_import, unicode_literals)
+
import sys
import os
import signal
import errno
-import pidlockfile
+import lockfile
-from daemon import DaemonContext
+from . import pidfile
+from .daemon import DaemonContext
class DaemonRunnerError(Exception):
@@ -79,12 +82,12 @@ class DaemonRunner(object):
self.daemon_context.stdin = open(app.stdin_path, 'r')
self.daemon_context.stdout = open(app.stdout_path, 'w+')
self.daemon_context.stderr = open(
- app.stderr_path, 'w+', buffering=0)
+ app.stderr_path, 'w+', buffering=0)
self.pidfile = None
if app.pidfile_path is not None:
self.pidfile = make_pidlockfile(
- app.pidfile_path, app.pidfile_timeout)
+ app.pidfile_path, app.pidfile_timeout)
self.daemon_context.pidfile = self.pidfile
def _usage_exit(self, argv):
@@ -107,7 +110,7 @@ class DaemonRunner(object):
if len(argv) < min_args:
self._usage_exit(argv)
- self.action = argv[1]
+ self.action = unicode(argv[1])
if self.action not in self.action_funcs:
self._usage_exit(argv)
@@ -119,10 +122,10 @@ class DaemonRunner(object):
try:
self.daemon_context.open()
- except pidlockfile.AlreadyLocked:
+ except lockfile.AlreadyLocked:
pidfile_path = self.pidfile.path
raise DaemonRunnerStartFailureError(
- "PID file %(pidfile_path)r already locked" % vars())
+ "PID file %(pidfile_path)r already locked" % vars())
pid = os.getpid()
message = self.start_message % vars()
@@ -136,9 +139,9 @@ class DaemonRunner(object):
pid = self.pidfile.read_pid()
try:
os.kill(pid, signal.SIGTERM)
- except OSError, exc:
+ except OSError as exc:
raise DaemonRunnerStopFailureError(
- "Failed to terminate %(pid)d: %(exc)s" % vars())
+ "Failed to terminate %(pid)d: %(exc)s" % vars())
def _stop(self):
""" Exit the daemon process specified in the current PID file.
@@ -146,7 +149,7 @@ class DaemonRunner(object):
if not self.pidfile.is_locked():
pidfile_path = self.pidfile.path
raise DaemonRunnerStopFailureError(
- "PID file %(pidfile_path)r not locked" % vars())
+ "PID file %(pidfile_path)r not locked" % vars())
if is_pidfile_stale(self.pidfile):
self.pidfile.break_lock()
@@ -160,10 +163,10 @@ class DaemonRunner(object):
self._start()
action_funcs = {
- 'start': _start,
- 'stop': _stop,
- 'restart': _restart,
- }
+ 'start': _start,
+ 'stop': _stop,
+ 'restart': _restart,
+ }
def _get_action_func(self):
""" Return the function for the specified action.
@@ -176,7 +179,7 @@ class DaemonRunner(object):
func = self.action_funcs[self.action]
except KeyError:
raise DaemonRunnerInvalidActionError(
- "Unknown action: %(action)r" % vars(self))
+ "Unknown action: %(action)r" % vars(self))
return func
def do_action(self):
@@ -202,7 +205,7 @@ def make_pidlockfile(path, acquire_timeout):
if not os.path.isabs(path):
error = ValueError("Not an absolute path: %(path)r" % vars())
raise error
- lockfile = pidlockfile.TimeoutPIDLockFile(path, acquire_timeout)
+ lockfile = pidfile.TimeoutPIDLockFile(path, acquire_timeout)
return lockfile
@@ -221,9 +224,16 @@ def is_pidfile_stale(pidfile):
if pidfile_pid is not None:
try:
os.kill(pidfile_pid, signal.SIG_DFL)
- except OSError, exc:
+ except OSError as exc:
if exc.errno == errno.ESRCH:
# The specified PID does not exist
result = True
return result
+
+
+# Local variables:
+# coding: utf-8
+# mode: python
+# End:
+# vim: fileencoding=utf-8 filetype=python :
diff --git a/daemon/version/__init__.py b/daemon/version/__init__.py
index d2eafa6..2efb9d1 100644
--- a/daemon/version/__init__.py
+++ b/daemon/version/__init__.py
@@ -1,36 +1,46 @@
# -*- coding: utf-8 -*-
# daemon/version/__init__.py
-# Part of python-daemon, an implementation of PEP 3143.
+# Part of ‘python-daemon’, an implementation of PEP 3143.
+#
+# Copyright © 2008–2014 Ben Finney <ben+python@benfinney.id.au>
#
-# Copyright © 2008–2010 Ben Finney <ben+python@benfinney.id.au>
# This is free software: you may copy, modify, and/or distribute this work
-# under the terms of the Python Software Foundation License, version 2 or
-# later as published by the Python Software Foundation.
-# No warranty expressed or implied. See the file LICENSE.PSF-2 for details.
+# under the terms of the Apache License, version 2.0 as published by the
+# Apache Software Foundation.
+# No warranty expressed or implied. See the file LICENSE.ASF-2 for details.
+
+""" Version information for the ‘python-daemon’ distribution. """
-""" Version information for the python-daemon distribution. """
+from __future__ import (absolute_import, unicode_literals)
-from version_info import version_info
+from .version_info import version_info
-version_info['version_string'] = u"1.5.5"
+version_info['version_string'] = "1.6.1"
-version_short = u"%(version_string)s" % version_info
-version_full = u"%(version_string)s.r%(revno)s" % version_info
+version_short = "%(version_string)s" % version_info
+version_full = "%(version_string)s.r%(revno)s" % version_info
version = version_short
-author_name = u"Ben Finney"
-author_email = u"ben+python@benfinney.id.au"
-author = u"%(author_name)s <%(author_email)s>" % vars()
+author_name = "Ben Finney"
+author_email = "ben+python@benfinney.id.au"
+author = "%(author_name)s <%(author_email)s>" % vars()
-copyright_year_begin = u"2001"
+copyright_year_begin = "2001"
date = version_info['date'].split(' ', 1)[0]
copyright_year = date.split('-')[0]
copyright_year_range = copyright_year_begin
if copyright_year > copyright_year_begin:
- copyright_year_range += u"–%(copyright_year)s" % vars()
+ copyright_year_range += "–%(copyright_year)s" % vars()
copyright = (
- u"Copyright © %(copyright_year_range)s %(author)s and others"
- ) % vars()
-license = u"PSF-2+"
+ "Copyright © %(copyright_year_range)s %(author)s and others"
+ ) % vars()
+license = "Apache-2"
+
+
+# Local variables:
+# coding: utf-8
+# mode: python
+# End:
+# vim: fileencoding=utf-8 filetype=python :
diff --git a/daemon/version/version_info.py b/daemon/version/version_info.py
index cdbf280..3a768cf 100644
--- a/daemon/version/version_info.py
+++ b/daemon/version/version_info.py
@@ -5,19 +5,18 @@ So don't edit it. :)
"""
version_info = {'branch_nick': u'python-daemon.devel',
- 'build_date': '2009-05-22 19:50:06 +1000',
+ 'build_date': '2014-08-04 15:17:39 +1000',
'clean': None,
- 'date': '2009-05-22 19:47:30 +1000',
- 'revision_id': 'ben+python@benfinney.id.au-20090522094730-p4vsa0reh7ktt4e1',
- 'revno': 145}
+ 'date': '2014-08-04 15:15:33 +1000',
+ 'revision_id': 'ben+python@benfinney.id.au-20140804051533-cg428nfiuigo0kax',
+ 'revno': '241'}
revisions = {}
file_revisions = {}
-
if __name__ == '__main__':
- print 'revision: %(revno)d' % version_info
+ print 'revision: %(revno)s' % version_info
print 'nick: %(branch_nick)s' % version_info
print 'revision id: %(revision_id)s' % version_info