[Erp5-report] r12802 - in /spec/debian/unstable/python-memcached: ./ python-memcached-1.34/...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Feb 15 18:39:21 CET 2007
Author: yusei
Date: Thu Feb 15 18:39:16 2007
New Revision: 12802
URL: http://svn.erp5.org?rev=12802&view=rev
Log:
added debian package and workspace.
Added:
spec/debian/unstable/python-memcached/
spec/debian/unstable/python-memcached/python-memcached-1.34/
spec/debian/unstable/python-memcached/python-memcached-1.34/README
spec/debian/unstable/python-memcached/python-memcached-1.34/build/
spec/debian/unstable/python-memcached/python-memcached-1.34/build/lib/
spec/debian/unstable/python-memcached/python-memcached-1.34/build/lib/memcache.py
spec/debian/unstable/python-memcached/python-memcached-1.34/configure-stamp
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/changelog
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/control
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/copyright
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/control
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/md5sums
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/memcache.py
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/memcache.pyc (with props)
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/README
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/changelog.Debian
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/copyright
spec/debian/unstable/python-memcached/python-memcached-1.34/debian/rules (with props)
spec/debian/unstable/python-memcached/python-memcached-1.34/memcache.py
spec/debian/unstable/python-memcached/python-memcached-1.34/memcache.pyc (with props)
spec/debian/unstable/python-memcached/python-memcached-1.34/setup.cfg
spec/debian/unstable/python-memcached/python-memcached-1.34/setup.py
spec/debian/unstable/python-memcached/python-memcached_1.34-1.diff.gz (with props)
spec/debian/unstable/python-memcached/python-memcached_1.34-1.dsc
spec/debian/unstable/python-memcached/python-memcached_1.34-1_all.deb (with props)
spec/debian/unstable/python-memcached/python-memcached_1.34-1_i386.build
spec/debian/unstable/python-memcached/python-memcached_1.34-1_i386.changes
spec/debian/unstable/python-memcached/python-memcached_1.34.orig.tar.gz (with props)
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/README
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/README?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/README (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/README Thu Feb 15 18:39:16 2007
@@ -1,0 +1,7 @@
+This package was originally written by Evan Martin of Danga.
+Sean Reifschneider of tummy.com, ltd. has taken over maintenance of it.
+
+This software is a 100% Python interface to the memcached memory cache
+daemon. It is the client side software which allows storing values in one
+or more, possibly remote, memcached servers. Search google for memcached
+for more information.
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/build/lib/memcache.py
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/build/lib/memcache.py?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/build/lib/memcache.py (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/build/lib/memcache.py Thu Feb 15 18:39:16 2007
@@ -1,0 +1,656 @@
+#!/usr/bin/env python
+
+"""
+client module for memcached (memory cache daemon)
+
+Overview
+========
+
+See U{the MemCached homepage<http://www.danga.com/memcached>} for more about memcached.
+
+Usage summary
+=============
+
+This should give you a feel for how this module operates::
+
+ import memcache
+ mc = memcache.Client(['127.0.0.1:11211'], debug=0)
+
+ mc.set("some_key", "Some value")
+ value = mc.get("some_key")
+
+ mc.set("another_key", 3)
+ mc.delete("another_key")
+
+ mc.set("key", "1") # note that the key used for incr/decr must be a string.
+ mc.incr("key")
+ mc.decr("key")
+
+The standard way to use memcache with a database is like this::
+
+ key = derive_key(obj)
+ obj = mc.get(key)
+ if not obj:
+ obj = backend_api.get(...)
+ mc.set(obj)
+
+ # we now have obj, and future passes through this code
+ # will use the object from the cache.
+
+Detailed Documentation
+======================
+
+More detailed documentation is available in the L{Client} class.
+"""
+
+import sys
+import socket
+import time
+import types
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+
+__author__ = "Evan Martin <martine at danga.com>"
+__version__ = "1.34"
+__copyright__ = "Copyright (C) 2003 Danga Interactive"
+__license__ = "Python"
+
+SERVER_MAX_KEY_LENGTH = 250
+
+class _Error(Exception):
+ pass
+
+class Client:
+ """
+ Object representing a pool of memcache servers.
+
+ See L{memcache} for an overview.
+
+ In all cases where a key is used, the key can be either:
+ 1. A simple hashable type (string, integer, etc.).
+ 2. A tuple of C{(hashvalue, key)}. This is useful if you want to avoid
+ making this module calculate a hash value. You may prefer, for
+ example, to keep all of a given user's objects on the same memcache
+ server, so you could use the user's unique id as the hash value.
+
+ @group Setup: __init__, set_servers, forget_dead_hosts, disconnect_all, debuglog
+ @group Insertion: set, add, replace
+ @group Retrieval: get, get_multi
+ @group Integers: incr, decr
+ @group Removal: delete
+ @sort: __init__, set_servers, forget_dead_hosts, disconnect_all, debuglog,\
+ set, add, replace, get, get_multi, incr, decr, delete
+ """
+ _FLAG_PICKLE = 1<<0
+ _FLAG_INTEGER = 1<<1
+ _FLAG_LONG = 1<<2
+
+ _SERVER_RETRIES = 10 # how many times to try finding a free server.
+
+ # exceptions for Client
+ class MemcachedKeyError(Exception):
+ pass
+ class MemcachedKeyLengthError(MemcachedKeyError):
+ pass
+ class MemcachedKeyCharacterError(MemcachedKeyError):
+ pass
+
+ def __init__(self, servers, debug=0):
+ """
+ Create a new Client object with the given list of servers.
+
+ @param servers: C{servers} is passed to L{set_servers}.
+ @param debug: whether to display error messages when a server can't be
+ contacted.
+ """
+ self.set_servers(servers)
+ self.debug = debug
+ self.stats = {}
+
+ def set_servers(self, servers):
+ """
+ Set the pool of servers used by this client.
+
+ @param servers: an array of servers.
+ Servers can be passed in two forms:
+ 1. Strings of the form C{"host:port"}, which implies a default weight of 1.
+ 2. Tuples of the form C{("host:port", weight)}, where C{weight} is
+ an integer weight value.
+ """
+ self.servers = [_Host(s, self.debuglog) for s in servers]
+ self._init_buckets()
+
+ def get_stats(self):
+ '''Get statistics from each of the servers.
+
+ @return: A list of tuples ( server_identifier, stats_dictionary ).
+ The dictionary contains a number of name/value pairs specifying
+ the name of the status field and the string value associated with
+ it. The values are not converted from strings.
+ '''
+ data = []
+ for s in self.servers:
+ if not s.connect(): continue
+ name = '%s:%s (%s)' % ( s.ip, s.port, s.weight )
+ s.send_cmd('stats')
+ serverData = {}
+ data.append(( name, serverData ))
+ readline = s.readline
+ while 1:
+ line = readline()
+ if not line or line.strip() == 'END': break
+ stats = line.split(' ', 2)
+ serverData[stats[1]] = stats[2]
+
+ return(data)
+
+ def flush_all(self):
+ 'Expire all data currently in the memcache servers.'
+ for s in self.servers:
+ if not s.connect(): continue
+ s.send_cmd('flush_all')
+ s.expect("OK")
+
+ def debuglog(self, str):
+ if self.debug:
+ sys.stderr.write("MemCached: %s\n" % str)
+
+ def _statlog(self, func):
+ if not self.stats.has_key(func):
+ self.stats[func] = 1
+ else:
+ self.stats[func] += 1
+
+ def forget_dead_hosts(self):
+ """
+ Reset every host in the pool to an "alive" state.
+ """
+ for s in self.servers:
+ s.dead_until = 0
+
+ def _init_buckets(self):
+ self.buckets = []
+ for server in self.servers:
+ for i in range(server.weight):
+ self.buckets.append(server)
+
+ def _get_server(self, key):
+ if type(key) == types.TupleType:
+ serverhash, key = key
+ else:
+ serverhash = hash(key)
+
+ for i in range(Client._SERVER_RETRIES):
+ server = self.buckets[serverhash % len(self.buckets)]
+ if server.connect():
+ #print "(using server %s)" % server,
+ return server, key
+ serverhash = hash(str(serverhash) + str(i))
+ return None, None
+
+ def disconnect_all(self):
+ for s in self.servers:
+ s.close_socket()
+
+ def delete(self, key, time=0):
+ '''Deletes a key from the memcache.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return 0
+ self._statlog('delete')
+ if time != None:
+ cmd = "delete %s %d" % (key, time)
+ else:
+ cmd = "delete %s" % key
+
+ try:
+ server.send_cmd(cmd)
+ server.expect("DELETED")
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ return 0
+ return 1
+
+ def incr(self, key, delta=1):
+ """
+ Sends a command to the server to atomically increment the value for C{key} by
+ C{delta}, or by 1 if C{delta} is unspecified. Returns None if C{key} doesn't
+ exist on server, otherwise it returns the new value after incrementing.
+
+ Note that the value for C{key} must already exist in the memcache, and it
+ must be the string representation of an integer.
+
+ >>> mc.set("counter", "20") # returns 1, indicating success
+ 1
+ >>> mc.incr("counter")
+ 21
+ >>> mc.incr("counter")
+ 22
+
+ Overflow on server is not checked. Be aware of values approaching
+ 2**32. See L{decr}.
+
+ @param delta: Integer amount to increment by (should be zero or greater).
+ @return: New value after incrementing.
+ @rtype: int
+ """
+ return self._incrdecr("incr", key, delta)
+
+ def decr(self, key, delta=1):
+ """
+ Like L{incr}, but decrements. Unlike L{incr}, underflow is checked and
+ new values are capped at 0. If server value is 1, a decrement of 2
+ returns 0, not -1.
+
+ @param delta: Integer amount to decrement by (should be zero or greater).
+ @return: New value after decrementing.
+ @rtype: int
+ """
+ return self._incrdecr("decr", key, delta)
+
+ def _incrdecr(self, cmd, key, delta):
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return 0
+ self._statlog(cmd)
+ cmd = "%s %s %d" % (cmd, key, delta)
+ try:
+ server.send_cmd(cmd)
+ line = server.readline()
+ return int(line)
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ return None
+
+ def add(self, key, val, time=0):
+ '''
+ Add new key with value.
+
+ Like L{set}, but only stores in memcache if the key doesn't already exist.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ return self._set("add", key, val, time)
+ def replace(self, key, val, time=0):
+ '''Replace existing key with value.
+
+ Like L{set}, but only stores in memcache if the key already exists.
+ The opposite of L{add}.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ return self._set("replace", key, val, time)
+ def set(self, key, val, time=0):
+ '''Unconditionally sets a key to a given value in the memcache.
+
+ The C{key} can optionally be an tuple, with the first element being the
+ hash value, if you want to avoid making this module calculate a hash value.
+ You may prefer, for example, to keep all of a given user's objects on the
+ same memcache server, so you could use the user's unique id as the hash
+ value.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ return self._set("set", key, val, time)
+
+ def _set(self, cmd, key, val, time):
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return 0
+
+ self._statlog(cmd)
+
+ flags = 0
+ if isinstance(val, types.StringTypes):
+ pass
+ elif isinstance(val, int):
+ flags |= Client._FLAG_INTEGER
+ val = "%d" % val
+ elif isinstance(val, long):
+ flags |= Client._FLAG_LONG
+ val = "%d" % val
+ else:
+ flags |= Client._FLAG_PICKLE
+ val = pickle.dumps(val, 2)
+
+ fullcmd = "%s %s %d %d %d\r\n%s" % (cmd, key, flags, time, len(val), val)
+ try:
+ server.send_cmd(fullcmd)
+ server.expect("STORED")
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ return 0
+ return 1
+
+ def get(self, key):
+ '''Retrieves a key from the memcache.
+
+ @return: The value or None.
+ '''
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return None
+
+ self._statlog('get')
+
+ try:
+ server.send_cmd("get %s" % key)
+ rkey, flags, rlen, = self._expectvalue(server)
+ if not rkey:
+ return None
+ value = self._recv_value(server, flags, rlen)
+ server.expect("END")
+ except (_Error, socket.error), msg:
+ if type(msg) is types.TupleType:
+ msg = msg[1]
+ server.mark_dead(msg)
+ return None
+ return value
+
+ def get_multi(self, keys):
+ '''
+ Retrieves multiple keys from the memcache doing just one query.
+
+ >>> success = mc.set("foo", "bar")
+ >>> success = mc.set("baz", 42)
+ >>> mc.get_multi(["foo", "baz", "foobar"]) == {"foo": "bar", "baz": 42}
+ 1
+
+ This method is recommended over regular L{get} as it lowers the number of
+ total packets flying around your network, reducing total latency, since
+ your app doesn't have to wait for each round-trip of L{get} before sending
+ the next one.
+
+ @param keys: An array of keys.
+ @return: A dictionary of key/value pairs that were available.
+
+ '''
+
+ self._statlog('get_multi')
+
+ server_keys = {}
+
+ # build up a list for each server of all the keys we want.
+ for key in keys:
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ continue
+ if not server_keys.has_key(server):
+ server_keys[server] = []
+ server_keys[server].append(key)
+
+ # send out all requests on each server before reading anything
+ dead_servers = []
+ for server in server_keys.keys():
+ try:
+ server.send_cmd("get %s" % " ".join(server_keys[server]))
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ dead_servers.append(server)
+
+ # if any servers died on the way, don't expect them to respond.
+ for server in dead_servers:
+ del server_keys[server]
+
+ retvals = {}
+ for server in server_keys.keys():
+ try:
+ line = server.readline()
+ while line and line != 'END':
+ rkey, flags, rlen = self._expectvalue(server, line)
+ # Bo Yang reports that this can sometimes be None
+ if rkey is not None:
+ val = self._recv_value(server, flags, rlen)
+ retvals[rkey] = val
+ line = server.readline()
+ except (_Error, socket.error), msg:
+ server.mark_dead(msg)
+ return retvals
+
+ def _expectvalue(self, server, line=None):
+ if not line:
+ line = server.readline()
+
+ if line[:5] == 'VALUE':
+ resp, rkey, flags, len = line.split()
+ flags = int(flags)
+ rlen = int(len)
+ return (rkey, flags, rlen)
+ else:
+ return (None, None, None)
+
+ def _recv_value(self, server, flags, rlen):
+ rlen += 2 # include \r\n
+ buf = server.recv(rlen)
+ if len(buf) != rlen:
+ raise _Error("received %d bytes when expecting %d" % (len(buf), rlen))
+
+ if len(buf) == rlen:
+ buf = buf[:-2] # strip \r\n
+
+ if flags == 0:
+ val = buf
+ elif flags & Client._FLAG_INTEGER:
+ val = int(buf)
+ elif flags & Client._FLAG_LONG:
+ val = long(buf)
+ elif flags & Client._FLAG_PICKLE:
+ try:
+ val = pickle.loads(buf)
+ except:
+ self.debuglog('Pickle error...\n')
+ val = None
+ else:
+ self.debuglog("unknown flags on get: %x\n" % flags)
+
+ return val
+
+
+class _Host:
+ _DEAD_RETRY = 30 # number of seconds before retrying a dead server.
+
+ def __init__(self, host, debugfunc=None):
+ if isinstance(host, types.TupleType):
+ host, self.weight = host
+ else:
+ self.weight = 1
+
+ if host.find(":") > 0:
+ self.ip, self.port = host.split(":")
+ self.port = int(self.port)
+ else:
+ self.ip, self.port = host, 11211
+
+ if not debugfunc:
+ debugfunc = lambda x: x
+ self.debuglog = debugfunc
+
+ self.deaduntil = 0
+ self.socket = None
+
+ self.buffer = ''
+
+ def _check_dead(self):
+ if self.deaduntil and self.deaduntil > time.time():
+ return 1
+ self.deaduntil = 0
+ return 0
+
+ def connect(self):
+ if self._get_socket():
+ return 1
+ return 0
+
+ def mark_dead(self, reason):
+ self.debuglog("MemCache: %s: %s. Marking dead." % (self, reason))
+ self.deaduntil = time.time() + _Host._DEAD_RETRY
+ self.close_socket()
+
+ def _get_socket(self):
+ if self._check_dead():
+ return None
+ if self.socket:
+ return self.socket
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ # Python 2.3-ism: s.settimeout(1)
+ try:
+ s.connect((self.ip, self.port))
+ except socket.error, msg:
+ self.mark_dead("connect: %s" % msg[1])
+ return None
+ self.socket = s
+ self.buffer = ''
+ return s
+
+ def close_socket(self):
+ if self.socket:
+ self.socket.close()
+ self.socket = None
+
+ def send_cmd(self, cmd):
+ self.socket.sendall(cmd + '\r\n')
+
+ def readline(self):
+ buf = self.buffer
+ recv = self.socket.recv
+ while True:
+ index = buf.find('\r\n')
+ if index >= 0:
+ break
+ data = recv(4096)
+ if not data:
+ self.mark_dead('Connection closed while reading from %s'
+ % repr(self))
+ break
+ buf += data
+ if index >= 0:
+ self.buffer = buf[index+2:]
+ buf = buf[:index]
+ else:
+ self.buffer = ''
+ return buf
+
+ def expect(self, text):
+ line = self.readline()
+ if line != text:
+ self.debuglog("while expecting '%s', got unexpected response '%s'" % (text, line))
+ return line
+
+ def recv(self, rlen):
+ self_socket_recv = self.socket.recv
+ buf = self.buffer
+ while len(buf) < rlen:
+ foo = self_socket_recv(4096)
+ buf += foo
+ if len(foo) == 0:
+ raise _Error, ( 'Read %d bytes, expecting %d, '
+ 'read returned 0 length bytes' % ( len(buf), foo ))
+ self.buffer = buf[rlen:]
+ return buf[:rlen]
+
+ def __str__(self):
+ d = ''
+ if self.deaduntil:
+ d = " (dead until %d)" % self.deaduntil
+ return "%s:%d%s" % (self.ip, self.port, d)
+
+def check_key(key):
+ """
+ Checks to make sure the key is less than SERVER_MAX_KEY_LENGTH or contains control characters.
+ If test fails throws MemcachedKeyLength error.
+ """
+ if len(key) > SERVER_MAX_KEY_LENGTH:
+ raise Client.MemcachedKeyLengthError, "Key length is > %s" % SERVER_MAX_KEY_LENGTH
+ for char in key:
+ if ord(char) < 33:
+ raise Client.MemcachedKeyCharacterError, "Control characters not allowed"
+
+def _doctest():
+ import doctest, memcache
+ servers = ["127.0.0.1:11211"]
+ mc = Client(servers, debug=1)
+ globs = {"mc": mc}
+ return doctest.testmod(memcache, globs=globs)
+
+if __name__ == "__main__":
+ print "Testing docstrings..."
+ _doctest()
+ print "Running tests:"
+ print
+ #servers = ["127.0.0.1:11211", "127.0.0.1:11212"]
+ servers = ["127.0.0.1:11211"]
+ mc = Client(servers, debug=1)
+
+ def to_s(val):
+ if not isinstance(val, types.StringTypes):
+ return "%s (%s)" % (val, type(val))
+ return "%s" % val
+ def test_setget(key, val):
+ print "Testing set/get {'%s': %s} ..." % (to_s(key), to_s(val)),
+ mc.set(key, val)
+ newval = mc.get(key)
+ if newval == val:
+ print "OK"
+ return 1
+ else:
+ print "FAIL"
+ return 0
+
+ class FooStruct:
+ def __init__(self):
+ self.bar = "baz"
+ def __str__(self):
+ return "A FooStruct"
+ def __eq__(self, other):
+ if isinstance(other, FooStruct):
+ return self.bar == other.bar
+ return 0
+
+ test_setget("a_string", "some random string")
+ test_setget("an_integer", 42)
+ if test_setget("long", long(1<<30)):
+ print "Testing delete ...",
+ if mc.delete("long"):
+ print "OK"
+ else:
+ print "FAIL"
+ print "Testing get_multi ...",
+ print mc.get_multi(["a_string", "an_integer"])
+
+ print "Testing get(unknown value) ...",
+ print to_s(mc.get("unknown_value"))
+
+ f = FooStruct()
+ test_setget("foostruct", f)
+
+ print "Testing incr ...",
+ x = mc.incr("an_integer", 1)
+ if x == 43:
+ print "OK"
+ else:
+ print "FAIL"
+
+ print "Testing decr ...",
+ x = mc.decr("an_integer", 1)
+ if x == 42:
+ print "OK"
+ else:
+ print "FAIL"
+
+
+
+# vim: ts=4 sw=4 et :
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/configure-stamp
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/configure-stamp?rev=12802&view=auto
==============================================================================
(empty)
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/changelog
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/changelog?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/debian/changelog (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/debian/changelog Thu Feb 15 18:39:16 2007
@@ -1,0 +1,6 @@
+python-memcached (1.34-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Yusei TAHARA <yusei at domen.cx> Tue, 13 Feb 2007 18:06:00 +0100
+
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/control
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/control?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/debian/control (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/debian/control Thu Feb 15 18:39:16 2007
@@ -1,0 +1,16 @@
+Source: python-memcached
+Section: interpreters
+Priority: optional
+Maintainer: Yusei TAHARA <yusei at domen.cx>
+Build-Depends: debhelper (>> 3.0.0), python2.4-dev
+Standards-Version: 3.5.2
+
+Package: python-memcached
+Architecture: all
+Depends: python2.4
+Description: A Python API for memcached.
+ A Python API for memcached.
+ .
+ Memcached is a high-performance, distributed memory object caching system,
+ generic in nature, but intended for use in speeding up dynamic web
+ applications by alleviating database load.
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/copyright
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/copyright?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/debian/copyright (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/debian/copyright Thu Feb 15 18:39:16 2007
@@ -1,0 +1,2 @@
+This package was originally written by Evan Martin of Danga.
+Sean Reifschneider of tummy.com, ltd. has taken over maintenance of it.
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/control
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/control?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/control (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/control Thu Feb 15 18:39:16 2007
@@ -1,0 +1,14 @@
+Package: python-memcached
+Version: 1.34-1
+Section: interpreters
+Priority: optional
+Architecture: all
+Depends: python2.4
+Installed-Size: 56
+Maintainer: Yusei TAHARA <yusei at domen.cx>
+Description: A Python API for memcached.
+ A Python API for memcached.
+ .
+ Memcached is a high-performance, distributed memory object caching system,
+ generic in nature, but intended for use in speeding up dynamic web
+ applications by alleviating database load.
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/md5sums
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/md5sums?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/md5sums (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/DEBIAN/md5sums Thu Feb 15 18:39:16 2007
@@ -1,0 +1,5 @@
+5c32fe88b7f421450ab953b8dd50e105 usr/lib/python2.4/site-packages/memcache.py
+22ad9b86bb296cfb7972e3bc68fbe822 usr/lib/python2.4/site-packages/memcache.pyc
+22d1e9b5af3a065597b515d05fdb02bd usr/share/doc/python-memcached/README
+8e52bef222f192963d463890b3964580 usr/share/doc/python-memcached/copyright
+9dc915afb75858f99f7668995a6e286b usr/share/doc/python-memcached/changelog.Debian
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/memcache.py
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/memcache.py?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/memcache.py (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/memcache.py Thu Feb 15 18:39:16 2007
@@ -1,0 +1,656 @@
+#!/usr/bin/env python
+
+"""
+client module for memcached (memory cache daemon)
+
+Overview
+========
+
+See U{the MemCached homepage<http://www.danga.com/memcached>} for more about memcached.
+
+Usage summary
+=============
+
+This should give you a feel for how this module operates::
+
+ import memcache
+ mc = memcache.Client(['127.0.0.1:11211'], debug=0)
+
+ mc.set("some_key", "Some value")
+ value = mc.get("some_key")
+
+ mc.set("another_key", 3)
+ mc.delete("another_key")
+
+ mc.set("key", "1") # note that the key used for incr/decr must be a string.
+ mc.incr("key")
+ mc.decr("key")
+
+The standard way to use memcache with a database is like this::
+
+ key = derive_key(obj)
+ obj = mc.get(key)
+ if not obj:
+ obj = backend_api.get(...)
+ mc.set(obj)
+
+ # we now have obj, and future passes through this code
+ # will use the object from the cache.
+
+Detailed Documentation
+======================
+
+More detailed documentation is available in the L{Client} class.
+"""
+
+import sys
+import socket
+import time
+import types
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+
+__author__ = "Evan Martin <martine at danga.com>"
+__version__ = "1.34"
+__copyright__ = "Copyright (C) 2003 Danga Interactive"
+__license__ = "Python"
+
+SERVER_MAX_KEY_LENGTH = 250
+
+class _Error(Exception):
+ pass
+
+class Client:
+ """
+ Object representing a pool of memcache servers.
+
+ See L{memcache} for an overview.
+
+ In all cases where a key is used, the key can be either:
+ 1. A simple hashable type (string, integer, etc.).
+ 2. A tuple of C{(hashvalue, key)}. This is useful if you want to avoid
+ making this module calculate a hash value. You may prefer, for
+ example, to keep all of a given user's objects on the same memcache
+ server, so you could use the user's unique id as the hash value.
+
+ @group Setup: __init__, set_servers, forget_dead_hosts, disconnect_all, debuglog
+ @group Insertion: set, add, replace
+ @group Retrieval: get, get_multi
+ @group Integers: incr, decr
+ @group Removal: delete
+ @sort: __init__, set_servers, forget_dead_hosts, disconnect_all, debuglog,\
+ set, add, replace, get, get_multi, incr, decr, delete
+ """
+ _FLAG_PICKLE = 1<<0
+ _FLAG_INTEGER = 1<<1
+ _FLAG_LONG = 1<<2
+
+ _SERVER_RETRIES = 10 # how many times to try finding a free server.
+
+ # exceptions for Client
+ class MemcachedKeyError(Exception):
+ pass
+ class MemcachedKeyLengthError(MemcachedKeyError):
+ pass
+ class MemcachedKeyCharacterError(MemcachedKeyError):
+ pass
+
+ def __init__(self, servers, debug=0):
+ """
+ Create a new Client object with the given list of servers.
+
+ @param servers: C{servers} is passed to L{set_servers}.
+ @param debug: whether to display error messages when a server can't be
+ contacted.
+ """
+ self.set_servers(servers)
+ self.debug = debug
+ self.stats = {}
+
+ def set_servers(self, servers):
+ """
+ Set the pool of servers used by this client.
+
+ @param servers: an array of servers.
+ Servers can be passed in two forms:
+ 1. Strings of the form C{"host:port"}, which implies a default weight of 1.
+ 2. Tuples of the form C{("host:port", weight)}, where C{weight} is
+ an integer weight value.
+ """
+ self.servers = [_Host(s, self.debuglog) for s in servers]
+ self._init_buckets()
+
+ def get_stats(self):
+ '''Get statistics from each of the servers.
+
+ @return: A list of tuples ( server_identifier, stats_dictionary ).
+ The dictionary contains a number of name/value pairs specifying
+ the name of the status field and the string value associated with
+ it. The values are not converted from strings.
+ '''
+ data = []
+ for s in self.servers:
+ if not s.connect(): continue
+ name = '%s:%s (%s)' % ( s.ip, s.port, s.weight )
+ s.send_cmd('stats')
+ serverData = {}
+ data.append(( name, serverData ))
+ readline = s.readline
+ while 1:
+ line = readline()
+ if not line or line.strip() == 'END': break
+ stats = line.split(' ', 2)
+ serverData[stats[1]] = stats[2]
+
+ return(data)
+
+ def flush_all(self):
+ 'Expire all data currently in the memcache servers.'
+ for s in self.servers:
+ if not s.connect(): continue
+ s.send_cmd('flush_all')
+ s.expect("OK")
+
+ def debuglog(self, str):
+ if self.debug:
+ sys.stderr.write("MemCached: %s\n" % str)
+
+ def _statlog(self, func):
+ if not self.stats.has_key(func):
+ self.stats[func] = 1
+ else:
+ self.stats[func] += 1
+
+ def forget_dead_hosts(self):
+ """
+ Reset every host in the pool to an "alive" state.
+ """
+ for s in self.servers:
+ s.dead_until = 0
+
+ def _init_buckets(self):
+ self.buckets = []
+ for server in self.servers:
+ for i in range(server.weight):
+ self.buckets.append(server)
+
+ def _get_server(self, key):
+ if type(key) == types.TupleType:
+ serverhash, key = key
+ else:
+ serverhash = hash(key)
+
+ for i in range(Client._SERVER_RETRIES):
+ server = self.buckets[serverhash % len(self.buckets)]
+ if server.connect():
+ #print "(using server %s)" % server,
+ return server, key
+ serverhash = hash(str(serverhash) + str(i))
+ return None, None
+
+ def disconnect_all(self):
+ for s in self.servers:
+ s.close_socket()
+
+ def delete(self, key, time=0):
+ '''Deletes a key from the memcache.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return 0
+ self._statlog('delete')
+ if time != None:
+ cmd = "delete %s %d" % (key, time)
+ else:
+ cmd = "delete %s" % key
+
+ try:
+ server.send_cmd(cmd)
+ server.expect("DELETED")
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ return 0
+ return 1
+
+ def incr(self, key, delta=1):
+ """
+ Sends a command to the server to atomically increment the value for C{key} by
+ C{delta}, or by 1 if C{delta} is unspecified. Returns None if C{key} doesn't
+ exist on server, otherwise it returns the new value after incrementing.
+
+ Note that the value for C{key} must already exist in the memcache, and it
+ must be the string representation of an integer.
+
+ >>> mc.set("counter", "20") # returns 1, indicating success
+ 1
+ >>> mc.incr("counter")
+ 21
+ >>> mc.incr("counter")
+ 22
+
+ Overflow on server is not checked. Be aware of values approaching
+ 2**32. See L{decr}.
+
+ @param delta: Integer amount to increment by (should be zero or greater).
+ @return: New value after incrementing.
+ @rtype: int
+ """
+ return self._incrdecr("incr", key, delta)
+
+ def decr(self, key, delta=1):
+ """
+ Like L{incr}, but decrements. Unlike L{incr}, underflow is checked and
+ new values are capped at 0. If server value is 1, a decrement of 2
+ returns 0, not -1.
+
+ @param delta: Integer amount to decrement by (should be zero or greater).
+ @return: New value after decrementing.
+ @rtype: int
+ """
+ return self._incrdecr("decr", key, delta)
+
+ def _incrdecr(self, cmd, key, delta):
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return 0
+ self._statlog(cmd)
+ cmd = "%s %s %d" % (cmd, key, delta)
+ try:
+ server.send_cmd(cmd)
+ line = server.readline()
+ return int(line)
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ return None
+
+ def add(self, key, val, time=0):
+ '''
+ Add new key with value.
+
+ Like L{set}, but only stores in memcache if the key doesn't already exist.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ return self._set("add", key, val, time)
+ def replace(self, key, val, time=0):
+ '''Replace existing key with value.
+
+ Like L{set}, but only stores in memcache if the key already exists.
+ The opposite of L{add}.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ return self._set("replace", key, val, time)
+ def set(self, key, val, time=0):
+ '''Unconditionally sets a key to a given value in the memcache.
+
+ The C{key} can optionally be an tuple, with the first element being the
+ hash value, if you want to avoid making this module calculate a hash value.
+ You may prefer, for example, to keep all of a given user's objects on the
+ same memcache server, so you could use the user's unique id as the hash
+ value.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ return self._set("set", key, val, time)
+
+ def _set(self, cmd, key, val, time):
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return 0
+
+ self._statlog(cmd)
+
+ flags = 0
+ if isinstance(val, types.StringTypes):
+ pass
+ elif isinstance(val, int):
+ flags |= Client._FLAG_INTEGER
+ val = "%d" % val
+ elif isinstance(val, long):
+ flags |= Client._FLAG_LONG
+ val = "%d" % val
+ else:
+ flags |= Client._FLAG_PICKLE
+ val = pickle.dumps(val, 2)
+
+ fullcmd = "%s %s %d %d %d\r\n%s" % (cmd, key, flags, time, len(val), val)
+ try:
+ server.send_cmd(fullcmd)
+ server.expect("STORED")
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ return 0
+ return 1
+
+ def get(self, key):
+ '''Retrieves a key from the memcache.
+
+ @return: The value or None.
+ '''
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return None
+
+ self._statlog('get')
+
+ try:
+ server.send_cmd("get %s" % key)
+ rkey, flags, rlen, = self._expectvalue(server)
+ if not rkey:
+ return None
+ value = self._recv_value(server, flags, rlen)
+ server.expect("END")
+ except (_Error, socket.error), msg:
+ if type(msg) is types.TupleType:
+ msg = msg[1]
+ server.mark_dead(msg)
+ return None
+ return value
+
+ def get_multi(self, keys):
+ '''
+ Retrieves multiple keys from the memcache doing just one query.
+
+ >>> success = mc.set("foo", "bar")
+ >>> success = mc.set("baz", 42)
+ >>> mc.get_multi(["foo", "baz", "foobar"]) == {"foo": "bar", "baz": 42}
+ 1
+
+ This method is recommended over regular L{get} as it lowers the number of
+ total packets flying around your network, reducing total latency, since
+ your app doesn't have to wait for each round-trip of L{get} before sending
+ the next one.
+
+ @param keys: An array of keys.
+ @return: A dictionary of key/value pairs that were available.
+
+ '''
+
+ self._statlog('get_multi')
+
+ server_keys = {}
+
+ # build up a list for each server of all the keys we want.
+ for key in keys:
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ continue
+ if not server_keys.has_key(server):
+ server_keys[server] = []
+ server_keys[server].append(key)
+
+ # send out all requests on each server before reading anything
+ dead_servers = []
+ for server in server_keys.keys():
+ try:
+ server.send_cmd("get %s" % " ".join(server_keys[server]))
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ dead_servers.append(server)
+
+ # if any servers died on the way, don't expect them to respond.
+ for server in dead_servers:
+ del server_keys[server]
+
+ retvals = {}
+ for server in server_keys.keys():
+ try:
+ line = server.readline()
+ while line and line != 'END':
+ rkey, flags, rlen = self._expectvalue(server, line)
+ # Bo Yang reports that this can sometimes be None
+ if rkey is not None:
+ val = self._recv_value(server, flags, rlen)
+ retvals[rkey] = val
+ line = server.readline()
+ except (_Error, socket.error), msg:
+ server.mark_dead(msg)
+ return retvals
+
+ def _expectvalue(self, server, line=None):
+ if not line:
+ line = server.readline()
+
+ if line[:5] == 'VALUE':
+ resp, rkey, flags, len = line.split()
+ flags = int(flags)
+ rlen = int(len)
+ return (rkey, flags, rlen)
+ else:
+ return (None, None, None)
+
+ def _recv_value(self, server, flags, rlen):
+ rlen += 2 # include \r\n
+ buf = server.recv(rlen)
+ if len(buf) != rlen:
+ raise _Error("received %d bytes when expecting %d" % (len(buf), rlen))
+
+ if len(buf) == rlen:
+ buf = buf[:-2] # strip \r\n
+
+ if flags == 0:
+ val = buf
+ elif flags & Client._FLAG_INTEGER:
+ val = int(buf)
+ elif flags & Client._FLAG_LONG:
+ val = long(buf)
+ elif flags & Client._FLAG_PICKLE:
+ try:
+ val = pickle.loads(buf)
+ except:
+ self.debuglog('Pickle error...\n')
+ val = None
+ else:
+ self.debuglog("unknown flags on get: %x\n" % flags)
+
+ return val
+
+
+class _Host:
+ _DEAD_RETRY = 30 # number of seconds before retrying a dead server.
+
+ def __init__(self, host, debugfunc=None):
+ if isinstance(host, types.TupleType):
+ host, self.weight = host
+ else:
+ self.weight = 1
+
+ if host.find(":") > 0:
+ self.ip, self.port = host.split(":")
+ self.port = int(self.port)
+ else:
+ self.ip, self.port = host, 11211
+
+ if not debugfunc:
+ debugfunc = lambda x: x
+ self.debuglog = debugfunc
+
+ self.deaduntil = 0
+ self.socket = None
+
+ self.buffer = ''
+
+ def _check_dead(self):
+ if self.deaduntil and self.deaduntil > time.time():
+ return 1
+ self.deaduntil = 0
+ return 0
+
+ def connect(self):
+ if self._get_socket():
+ return 1
+ return 0
+
+ def mark_dead(self, reason):
+ self.debuglog("MemCache: %s: %s. Marking dead." % (self, reason))
+ self.deaduntil = time.time() + _Host._DEAD_RETRY
+ self.close_socket()
+
+ def _get_socket(self):
+ if self._check_dead():
+ return None
+ if self.socket:
+ return self.socket
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ # Python 2.3-ism: s.settimeout(1)
+ try:
+ s.connect((self.ip, self.port))
+ except socket.error, msg:
+ self.mark_dead("connect: %s" % msg[1])
+ return None
+ self.socket = s
+ self.buffer = ''
+ return s
+
+ def close_socket(self):
+ if self.socket:
+ self.socket.close()
+ self.socket = None
+
+ def send_cmd(self, cmd):
+ self.socket.sendall(cmd + '\r\n')
+
+ def readline(self):
+ buf = self.buffer
+ recv = self.socket.recv
+ while True:
+ index = buf.find('\r\n')
+ if index >= 0:
+ break
+ data = recv(4096)
+ if not data:
+ self.mark_dead('Connection closed while reading from %s'
+ % repr(self))
+ break
+ buf += data
+ if index >= 0:
+ self.buffer = buf[index+2:]
+ buf = buf[:index]
+ else:
+ self.buffer = ''
+ return buf
+
+ def expect(self, text):
+ line = self.readline()
+ if line != text:
+ self.debuglog("while expecting '%s', got unexpected response '%s'" % (text, line))
+ return line
+
+ def recv(self, rlen):
+ self_socket_recv = self.socket.recv
+ buf = self.buffer
+ while len(buf) < rlen:
+ foo = self_socket_recv(4096)
+ buf += foo
+ if len(foo) == 0:
+ raise _Error, ( 'Read %d bytes, expecting %d, '
+ 'read returned 0 length bytes' % ( len(buf), foo ))
+ self.buffer = buf[rlen:]
+ return buf[:rlen]
+
+ def __str__(self):
+ d = ''
+ if self.deaduntil:
+ d = " (dead until %d)" % self.deaduntil
+ return "%s:%d%s" % (self.ip, self.port, d)
+
+def check_key(key):
+ """
+ Checks to make sure the key is less than SERVER_MAX_KEY_LENGTH or contains control characters.
+ If test fails throws MemcachedKeyLength error.
+ """
+ if len(key) > SERVER_MAX_KEY_LENGTH:
+ raise Client.MemcachedKeyLengthError, "Key length is > %s" % SERVER_MAX_KEY_LENGTH
+ for char in key:
+ if ord(char) < 33:
+ raise Client.MemcachedKeyCharacterError, "Control characters not allowed"
+
+def _doctest():
+ import doctest, memcache
+ servers = ["127.0.0.1:11211"]
+ mc = Client(servers, debug=1)
+ globs = {"mc": mc}
+ return doctest.testmod(memcache, globs=globs)
+
+if __name__ == "__main__":
+ print "Testing docstrings..."
+ _doctest()
+ print "Running tests:"
+ print
+ #servers = ["127.0.0.1:11211", "127.0.0.1:11212"]
+ servers = ["127.0.0.1:11211"]
+ mc = Client(servers, debug=1)
+
+ def to_s(val):
+ if not isinstance(val, types.StringTypes):
+ return "%s (%s)" % (val, type(val))
+ return "%s" % val
+ def test_setget(key, val):
+ print "Testing set/get {'%s': %s} ..." % (to_s(key), to_s(val)),
+ mc.set(key, val)
+ newval = mc.get(key)
+ if newval == val:
+ print "OK"
+ return 1
+ else:
+ print "FAIL"
+ return 0
+
+ class FooStruct:
+ def __init__(self):
+ self.bar = "baz"
+ def __str__(self):
+ return "A FooStruct"
+ def __eq__(self, other):
+ if isinstance(other, FooStruct):
+ return self.bar == other.bar
+ return 0
+
+ test_setget("a_string", "some random string")
+ test_setget("an_integer", 42)
+ if test_setget("long", long(1<<30)):
+ print "Testing delete ...",
+ if mc.delete("long"):
+ print "OK"
+ else:
+ print "FAIL"
+ print "Testing get_multi ...",
+ print mc.get_multi(["a_string", "an_integer"])
+
+ print "Testing get(unknown value) ...",
+ print to_s(mc.get("unknown_value"))
+
+ f = FooStruct()
+ test_setget("foostruct", f)
+
+ print "Testing incr ...",
+ x = mc.incr("an_integer", 1)
+ if x == 43:
+ print "OK"
+ else:
+ print "FAIL"
+
+ print "Testing decr ...",
+ x = mc.decr("an_integer", 1)
+ if x == 42:
+ print "OK"
+ else:
+ print "FAIL"
+
+
+
+# vim: ts=4 sw=4 et :
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/memcache.pyc
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/memcache.pyc?rev=12802&view=auto
==============================================================================
Binary file - no diff available.
Propchange: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/memcache.pyc
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/README
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/README?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/README (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/README Thu Feb 15 18:39:16 2007
@@ -1,0 +1,7 @@
+This package was originally written by Evan Martin of Danga.
+Sean Reifschneider of tummy.com, ltd. has taken over maintenance of it.
+
+This software is a 100% Python interface to the memcached memory cache
+daemon. It is the client side software which allows storing values in one
+or more, possibly remote, memcached servers. Search google for memcached
+for more information.
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/changelog.Debian
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/changelog.Debian?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/changelog.Debian (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/changelog.Debian Thu Feb 15 18:39:16 2007
@@ -1,0 +1,6 @@
+python-memcached (1.34-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Yusei TAHARA <yusei at domen.cx> Tue, 13 Feb 2007 18:06:00 +0100
+
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/copyright
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/copyright?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/copyright (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/debian/python-memcached/usr/share/doc/python-memcached/copyright Thu Feb 15 18:39:16 2007
@@ -1,0 +1,2 @@
+This package was originally written by Evan Martin of Danga.
+Sean Reifschneider of tummy.com, ltd. has taken over maintenance of it.
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/rules
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/debian/rules?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/debian/rules (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/debian/rules Thu Feb 15 18:39:16 2007
@@ -1,0 +1,59 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+# This is the debhelper compatibility version to use.
+export DH_COMPAT=5
+
+PYTHON2.4=/usr/bin/python2.4
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+
+ touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ $(PYTHON2.4) setup.py build
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+ -rm -rf build debian/python-memcached
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ $(PYTHON2.4) setup.py install --prefix=$(CURDIR)/debian/python-memcached/usr
+ dh_installdocs README
+ dh_installchangelogs
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
Propchange: spec/debian/unstable/python-memcached/python-memcached-1.34/debian/rules
------------------------------------------------------------------------------
svn:executable =
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/memcache.py
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/memcache.py?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/memcache.py (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/memcache.py Thu Feb 15 18:39:16 2007
@@ -1,0 +1,656 @@
+#!/usr/bin/env python
+
+"""
+client module for memcached (memory cache daemon)
+
+Overview
+========
+
+See U{the MemCached homepage<http://www.danga.com/memcached>} for more about memcached.
+
+Usage summary
+=============
+
+This should give you a feel for how this module operates::
+
+ import memcache
+ mc = memcache.Client(['127.0.0.1:11211'], debug=0)
+
+ mc.set("some_key", "Some value")
+ value = mc.get("some_key")
+
+ mc.set("another_key", 3)
+ mc.delete("another_key")
+
+ mc.set("key", "1") # note that the key used for incr/decr must be a string.
+ mc.incr("key")
+ mc.decr("key")
+
+The standard way to use memcache with a database is like this::
+
+ key = derive_key(obj)
+ obj = mc.get(key)
+ if not obj:
+ obj = backend_api.get(...)
+ mc.set(obj)
+
+ # we now have obj, and future passes through this code
+ # will use the object from the cache.
+
+Detailed Documentation
+======================
+
+More detailed documentation is available in the L{Client} class.
+"""
+
+import sys
+import socket
+import time
+import types
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+
+__author__ = "Evan Martin <martine at danga.com>"
+__version__ = "1.34"
+__copyright__ = "Copyright (C) 2003 Danga Interactive"
+__license__ = "Python"
+
+SERVER_MAX_KEY_LENGTH = 250
+
+class _Error(Exception):
+ pass
+
+class Client:
+ """
+ Object representing a pool of memcache servers.
+
+ See L{memcache} for an overview.
+
+ In all cases where a key is used, the key can be either:
+ 1. A simple hashable type (string, integer, etc.).
+ 2. A tuple of C{(hashvalue, key)}. This is useful if you want to avoid
+ making this module calculate a hash value. You may prefer, for
+ example, to keep all of a given user's objects on the same memcache
+ server, so you could use the user's unique id as the hash value.
+
+ @group Setup: __init__, set_servers, forget_dead_hosts, disconnect_all, debuglog
+ @group Insertion: set, add, replace
+ @group Retrieval: get, get_multi
+ @group Integers: incr, decr
+ @group Removal: delete
+ @sort: __init__, set_servers, forget_dead_hosts, disconnect_all, debuglog,\
+ set, add, replace, get, get_multi, incr, decr, delete
+ """
+ _FLAG_PICKLE = 1<<0
+ _FLAG_INTEGER = 1<<1
+ _FLAG_LONG = 1<<2
+
+ _SERVER_RETRIES = 10 # how many times to try finding a free server.
+
+ # exceptions for Client
+ class MemcachedKeyError(Exception):
+ pass
+ class MemcachedKeyLengthError(MemcachedKeyError):
+ pass
+ class MemcachedKeyCharacterError(MemcachedKeyError):
+ pass
+
+ def __init__(self, servers, debug=0):
+ """
+ Create a new Client object with the given list of servers.
+
+ @param servers: C{servers} is passed to L{set_servers}.
+ @param debug: whether to display error messages when a server can't be
+ contacted.
+ """
+ self.set_servers(servers)
+ self.debug = debug
+ self.stats = {}
+
+ def set_servers(self, servers):
+ """
+ Set the pool of servers used by this client.
+
+ @param servers: an array of servers.
+ Servers can be passed in two forms:
+ 1. Strings of the form C{"host:port"}, which implies a default weight of 1.
+ 2. Tuples of the form C{("host:port", weight)}, where C{weight} is
+ an integer weight value.
+ """
+ self.servers = [_Host(s, self.debuglog) for s in servers]
+ self._init_buckets()
+
+ def get_stats(self):
+ '''Get statistics from each of the servers.
+
+ @return: A list of tuples ( server_identifier, stats_dictionary ).
+ The dictionary contains a number of name/value pairs specifying
+ the name of the status field and the string value associated with
+ it. The values are not converted from strings.
+ '''
+ data = []
+ for s in self.servers:
+ if not s.connect(): continue
+ name = '%s:%s (%s)' % ( s.ip, s.port, s.weight )
+ s.send_cmd('stats')
+ serverData = {}
+ data.append(( name, serverData ))
+ readline = s.readline
+ while 1:
+ line = readline()
+ if not line or line.strip() == 'END': break
+ stats = line.split(' ', 2)
+ serverData[stats[1]] = stats[2]
+
+ return(data)
+
+ def flush_all(self):
+ 'Expire all data currently in the memcache servers.'
+ for s in self.servers:
+ if not s.connect(): continue
+ s.send_cmd('flush_all')
+ s.expect("OK")
+
+ def debuglog(self, str):
+ if self.debug:
+ sys.stderr.write("MemCached: %s\n" % str)
+
+ def _statlog(self, func):
+ if not self.stats.has_key(func):
+ self.stats[func] = 1
+ else:
+ self.stats[func] += 1
+
+ def forget_dead_hosts(self):
+ """
+ Reset every host in the pool to an "alive" state.
+ """
+ for s in self.servers:
+ s.dead_until = 0
+
+ def _init_buckets(self):
+ self.buckets = []
+ for server in self.servers:
+ for i in range(server.weight):
+ self.buckets.append(server)
+
+ def _get_server(self, key):
+ if type(key) == types.TupleType:
+ serverhash, key = key
+ else:
+ serverhash = hash(key)
+
+ for i in range(Client._SERVER_RETRIES):
+ server = self.buckets[serverhash % len(self.buckets)]
+ if server.connect():
+ #print "(using server %s)" % server,
+ return server, key
+ serverhash = hash(str(serverhash) + str(i))
+ return None, None
+
+ def disconnect_all(self):
+ for s in self.servers:
+ s.close_socket()
+
+ def delete(self, key, time=0):
+ '''Deletes a key from the memcache.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return 0
+ self._statlog('delete')
+ if time != None:
+ cmd = "delete %s %d" % (key, time)
+ else:
+ cmd = "delete %s" % key
+
+ try:
+ server.send_cmd(cmd)
+ server.expect("DELETED")
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ return 0
+ return 1
+
+ def incr(self, key, delta=1):
+ """
+ Sends a command to the server to atomically increment the value for C{key} by
+ C{delta}, or by 1 if C{delta} is unspecified. Returns None if C{key} doesn't
+ exist on server, otherwise it returns the new value after incrementing.
+
+ Note that the value for C{key} must already exist in the memcache, and it
+ must be the string representation of an integer.
+
+ >>> mc.set("counter", "20") # returns 1, indicating success
+ 1
+ >>> mc.incr("counter")
+ 21
+ >>> mc.incr("counter")
+ 22
+
+ Overflow on server is not checked. Be aware of values approaching
+ 2**32. See L{decr}.
+
+ @param delta: Integer amount to increment by (should be zero or greater).
+ @return: New value after incrementing.
+ @rtype: int
+ """
+ return self._incrdecr("incr", key, delta)
+
+ def decr(self, key, delta=1):
+ """
+ Like L{incr}, but decrements. Unlike L{incr}, underflow is checked and
+ new values are capped at 0. If server value is 1, a decrement of 2
+ returns 0, not -1.
+
+ @param delta: Integer amount to decrement by (should be zero or greater).
+ @return: New value after decrementing.
+ @rtype: int
+ """
+ return self._incrdecr("decr", key, delta)
+
+ def _incrdecr(self, cmd, key, delta):
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return 0
+ self._statlog(cmd)
+ cmd = "%s %s %d" % (cmd, key, delta)
+ try:
+ server.send_cmd(cmd)
+ line = server.readline()
+ return int(line)
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ return None
+
+ def add(self, key, val, time=0):
+ '''
+ Add new key with value.
+
+ Like L{set}, but only stores in memcache if the key doesn't already exist.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ return self._set("add", key, val, time)
+ def replace(self, key, val, time=0):
+ '''Replace existing key with value.
+
+ Like L{set}, but only stores in memcache if the key already exists.
+ The opposite of L{add}.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ return self._set("replace", key, val, time)
+ def set(self, key, val, time=0):
+ '''Unconditionally sets a key to a given value in the memcache.
+
+ The C{key} can optionally be an tuple, with the first element being the
+ hash value, if you want to avoid making this module calculate a hash value.
+ You may prefer, for example, to keep all of a given user's objects on the
+ same memcache server, so you could use the user's unique id as the hash
+ value.
+
+ @return: Nonzero on success.
+ @rtype: int
+ '''
+ return self._set("set", key, val, time)
+
+ def _set(self, cmd, key, val, time):
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return 0
+
+ self._statlog(cmd)
+
+ flags = 0
+ if isinstance(val, types.StringTypes):
+ pass
+ elif isinstance(val, int):
+ flags |= Client._FLAG_INTEGER
+ val = "%d" % val
+ elif isinstance(val, long):
+ flags |= Client._FLAG_LONG
+ val = "%d" % val
+ else:
+ flags |= Client._FLAG_PICKLE
+ val = pickle.dumps(val, 2)
+
+ fullcmd = "%s %s %d %d %d\r\n%s" % (cmd, key, flags, time, len(val), val)
+ try:
+ server.send_cmd(fullcmd)
+ server.expect("STORED")
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ return 0
+ return 1
+
+ def get(self, key):
+ '''Retrieves a key from the memcache.
+
+ @return: The value or None.
+ '''
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ return None
+
+ self._statlog('get')
+
+ try:
+ server.send_cmd("get %s" % key)
+ rkey, flags, rlen, = self._expectvalue(server)
+ if not rkey:
+ return None
+ value = self._recv_value(server, flags, rlen)
+ server.expect("END")
+ except (_Error, socket.error), msg:
+ if type(msg) is types.TupleType:
+ msg = msg[1]
+ server.mark_dead(msg)
+ return None
+ return value
+
+ def get_multi(self, keys):
+ '''
+ Retrieves multiple keys from the memcache doing just one query.
+
+ >>> success = mc.set("foo", "bar")
+ >>> success = mc.set("baz", 42)
+ >>> mc.get_multi(["foo", "baz", "foobar"]) == {"foo": "bar", "baz": 42}
+ 1
+
+ This method is recommended over regular L{get} as it lowers the number of
+ total packets flying around your network, reducing total latency, since
+ your app doesn't have to wait for each round-trip of L{get} before sending
+ the next one.
+
+ @param keys: An array of keys.
+ @return: A dictionary of key/value pairs that were available.
+
+ '''
+
+ self._statlog('get_multi')
+
+ server_keys = {}
+
+ # build up a list for each server of all the keys we want.
+ for key in keys:
+ check_key(key)
+ server, key = self._get_server(key)
+ if not server:
+ continue
+ if not server_keys.has_key(server):
+ server_keys[server] = []
+ server_keys[server].append(key)
+
+ # send out all requests on each server before reading anything
+ dead_servers = []
+ for server in server_keys.keys():
+ try:
+ server.send_cmd("get %s" % " ".join(server_keys[server]))
+ except socket.error, msg:
+ server.mark_dead(msg[1])
+ dead_servers.append(server)
+
+ # if any servers died on the way, don't expect them to respond.
+ for server in dead_servers:
+ del server_keys[server]
+
+ retvals = {}
+ for server in server_keys.keys():
+ try:
+ line = server.readline()
+ while line and line != 'END':
+ rkey, flags, rlen = self._expectvalue(server, line)
+ # Bo Yang reports that this can sometimes be None
+ if rkey is not None:
+ val = self._recv_value(server, flags, rlen)
+ retvals[rkey] = val
+ line = server.readline()
+ except (_Error, socket.error), msg:
+ server.mark_dead(msg)
+ return retvals
+
+ def _expectvalue(self, server, line=None):
+ if not line:
+ line = server.readline()
+
+ if line[:5] == 'VALUE':
+ resp, rkey, flags, len = line.split()
+ flags = int(flags)
+ rlen = int(len)
+ return (rkey, flags, rlen)
+ else:
+ return (None, None, None)
+
+ def _recv_value(self, server, flags, rlen):
+ rlen += 2 # include \r\n
+ buf = server.recv(rlen)
+ if len(buf) != rlen:
+ raise _Error("received %d bytes when expecting %d" % (len(buf), rlen))
+
+ if len(buf) == rlen:
+ buf = buf[:-2] # strip \r\n
+
+ if flags == 0:
+ val = buf
+ elif flags & Client._FLAG_INTEGER:
+ val = int(buf)
+ elif flags & Client._FLAG_LONG:
+ val = long(buf)
+ elif flags & Client._FLAG_PICKLE:
+ try:
+ val = pickle.loads(buf)
+ except:
+ self.debuglog('Pickle error...\n')
+ val = None
+ else:
+ self.debuglog("unknown flags on get: %x\n" % flags)
+
+ return val
+
+
+class _Host:
+ _DEAD_RETRY = 30 # number of seconds before retrying a dead server.
+
+ def __init__(self, host, debugfunc=None):
+ if isinstance(host, types.TupleType):
+ host, self.weight = host
+ else:
+ self.weight = 1
+
+ if host.find(":") > 0:
+ self.ip, self.port = host.split(":")
+ self.port = int(self.port)
+ else:
+ self.ip, self.port = host, 11211
+
+ if not debugfunc:
+ debugfunc = lambda x: x
+ self.debuglog = debugfunc
+
+ self.deaduntil = 0
+ self.socket = None
+
+ self.buffer = ''
+
+ def _check_dead(self):
+ if self.deaduntil and self.deaduntil > time.time():
+ return 1
+ self.deaduntil = 0
+ return 0
+
+ def connect(self):
+ if self._get_socket():
+ return 1
+ return 0
+
+ def mark_dead(self, reason):
+ self.debuglog("MemCache: %s: %s. Marking dead." % (self, reason))
+ self.deaduntil = time.time() + _Host._DEAD_RETRY
+ self.close_socket()
+
+ def _get_socket(self):
+ if self._check_dead():
+ return None
+ if self.socket:
+ return self.socket
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ # Python 2.3-ism: s.settimeout(1)
+ try:
+ s.connect((self.ip, self.port))
+ except socket.error, msg:
+ self.mark_dead("connect: %s" % msg[1])
+ return None
+ self.socket = s
+ self.buffer = ''
+ return s
+
+ def close_socket(self):
+ if self.socket:
+ self.socket.close()
+ self.socket = None
+
+ def send_cmd(self, cmd):
+ self.socket.sendall(cmd + '\r\n')
+
+ def readline(self):
+ buf = self.buffer
+ recv = self.socket.recv
+ while True:
+ index = buf.find('\r\n')
+ if index >= 0:
+ break
+ data = recv(4096)
+ if not data:
+ self.mark_dead('Connection closed while reading from %s'
+ % repr(self))
+ break
+ buf += data
+ if index >= 0:
+ self.buffer = buf[index+2:]
+ buf = buf[:index]
+ else:
+ self.buffer = ''
+ return buf
+
+ def expect(self, text):
+ line = self.readline()
+ if line != text:
+ self.debuglog("while expecting '%s', got unexpected response '%s'" % (text, line))
+ return line
+
+ def recv(self, rlen):
+ self_socket_recv = self.socket.recv
+ buf = self.buffer
+ while len(buf) < rlen:
+ foo = self_socket_recv(4096)
+ buf += foo
+ if len(foo) == 0:
+ raise _Error, ( 'Read %d bytes, expecting %d, '
+ 'read returned 0 length bytes' % ( len(buf), foo ))
+ self.buffer = buf[rlen:]
+ return buf[:rlen]
+
+ def __str__(self):
+ d = ''
+ if self.deaduntil:
+ d = " (dead until %d)" % self.deaduntil
+ return "%s:%d%s" % (self.ip, self.port, d)
+
+def check_key(key):
+ """
+ Checks to make sure the key is less than SERVER_MAX_KEY_LENGTH or contains control characters.
+ If test fails throws MemcachedKeyLength error.
+ """
+ if len(key) > SERVER_MAX_KEY_LENGTH:
+ raise Client.MemcachedKeyLengthError, "Key length is > %s" % SERVER_MAX_KEY_LENGTH
+ for char in key:
+ if ord(char) < 33:
+ raise Client.MemcachedKeyCharacterError, "Control characters not allowed"
+
+def _doctest():
+ import doctest, memcache
+ servers = ["127.0.0.1:11211"]
+ mc = Client(servers, debug=1)
+ globs = {"mc": mc}
+ return doctest.testmod(memcache, globs=globs)
+
+if __name__ == "__main__":
+ print "Testing docstrings..."
+ _doctest()
+ print "Running tests:"
+ print
+ #servers = ["127.0.0.1:11211", "127.0.0.1:11212"]
+ servers = ["127.0.0.1:11211"]
+ mc = Client(servers, debug=1)
+
+ def to_s(val):
+ if not isinstance(val, types.StringTypes):
+ return "%s (%s)" % (val, type(val))
+ return "%s" % val
+ def test_setget(key, val):
+ print "Testing set/get {'%s': %s} ..." % (to_s(key), to_s(val)),
+ mc.set(key, val)
+ newval = mc.get(key)
+ if newval == val:
+ print "OK"
+ return 1
+ else:
+ print "FAIL"
+ return 0
+
+ class FooStruct:
+ def __init__(self):
+ self.bar = "baz"
+ def __str__(self):
+ return "A FooStruct"
+ def __eq__(self, other):
+ if isinstance(other, FooStruct):
+ return self.bar == other.bar
+ return 0
+
+ test_setget("a_string", "some random string")
+ test_setget("an_integer", 42)
+ if test_setget("long", long(1<<30)):
+ print "Testing delete ...",
+ if mc.delete("long"):
+ print "OK"
+ else:
+ print "FAIL"
+ print "Testing get_multi ...",
+ print mc.get_multi(["a_string", "an_integer"])
+
+ print "Testing get(unknown value) ...",
+ print to_s(mc.get("unknown_value"))
+
+ f = FooStruct()
+ test_setget("foostruct", f)
+
+ print "Testing incr ...",
+ x = mc.incr("an_integer", 1)
+ if x == 43:
+ print "OK"
+ else:
+ print "FAIL"
+
+ print "Testing decr ...",
+ x = mc.decr("an_integer", 1)
+ if x == 42:
+ print "OK"
+ else:
+ print "FAIL"
+
+
+
+# vim: ts=4 sw=4 et :
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/memcache.pyc
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/memcache.pyc?rev=12802&view=auto
==============================================================================
Binary file - no diff available.
Propchange: spec/debian/unstable/python-memcached/python-memcached-1.34/memcache.pyc
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/setup.cfg
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/setup.cfg?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/setup.cfg (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/setup.cfg Thu Feb 15 18:39:16 2007
@@ -1,0 +1,4 @@
+[bdist_rpm]
+release = 1
+packager = Sean Reifschneider <jafo-rpms at tummy.com>
+requires = python-memcached
Added: spec/debian/unstable/python-memcached/python-memcached-1.34/setup.py
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached-1.34/setup.py?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached-1.34/setup.py (added)
+++ spec/debian/unstable/python-memcached/python-memcached-1.34/setup.py Thu Feb 15 18:39:16 2007
@@ -1,0 +1,12 @@
+#!/usr/bin/env python
+
+from distutils.core import setup
+import memcache
+
+setup(name="python-memcached",
+ version=memcache.__version__,
+ author="Evan Martin",
+ author_email="martine at danga.com",
+ url="http://www.danga.com/memcached/",
+ py_modules=["memcache"])
+
Added: spec/debian/unstable/python-memcached/python-memcached_1.34-1.diff.gz
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached_1.34-1.diff.gz?rev=12802&view=auto
==============================================================================
Binary file - no diff available.
Propchange: spec/debian/unstable/python-memcached/python-memcached_1.34-1.diff.gz
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: spec/debian/unstable/python-memcached/python-memcached_1.34-1.dsc
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached_1.34-1.dsc?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached_1.34-1.dsc (added)
+++ spec/debian/unstable/python-memcached/python-memcached_1.34-1.dsc Thu Feb 15 18:39:16 2007
@@ -1,0 +1,11 @@
+Format: 1.0
+Source: python-memcached
+Version: 1.34-1
+Binary: python-memcached
+Maintainer: Yusei TAHARA <yusei at domen.cx>
+Architecture: all
+Standards-Version: 3.5.2
+Build-Depends: debhelper (>> 3.0.0), python2.4-dev
+Files:
+ 45a983f65d6a77743af6ef6e4aa3d74a 6497 python-memcached_1.34.orig.tar.gz
+ 4b6738e6687a36db7899fc37977dd19d 1066 python-memcached_1.34-1.diff.gz
Added: spec/debian/unstable/python-memcached/python-memcached_1.34-1_all.deb
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached_1.34-1_all.deb?rev=12802&view=auto
==============================================================================
Binary file - no diff available.
Propchange: spec/debian/unstable/python-memcached/python-memcached_1.34-1_all.deb
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: spec/debian/unstable/python-memcached/python-memcached_1.34-1_i386.build
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached_1.34-1_i386.build?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached_1.34-1_i386.build (added)
+++ spec/debian/unstable/python-memcached/python-memcached_1.34-1_i386.build Thu Feb 15 18:39:16 2007
@@ -1,0 +1,94 @@
+ fakeroot debian/rules clean
+dh_testdir
+dh_testroot
+rm -f build-stamp configure-stamp
+rm -rf build debian/python-memcached
+dh_clean
+ rm -f debian/python-memcached.substvars
+ rm -f debian/python-memcached.*.debhelper
+ rm -rf debian/python-memcached
+ rm -f debian/files
+ find . \( \( -type f -a \
+ \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \
+ -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \
+ -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \
+ -o -name TAGS -o -name core -o \( -path '*/.deps/*' -a -name '*.P' \) \
+ \) -exec rm -f {} \; \) -o \
+ \( -type d -a -name autom4te.cache -prune -exec rm -rf {} \; \) \)
+ dpkg-source -b python-memcached-1.34
+dpkg-source: building python-memcached using existing python-memcached_1.34.orig.tar.gz
+dpkg-source: building python-memcached in python-memcached_1.34-1.diff.gz
+dpkg-source: building python-memcached in python-memcached_1.34-1.dsc
+ debian/rules build
+dh_testdir
+# Add here commands to configure the package.
+touch configure-stamp
+dh_testdir
+/usr/bin/python2.4 setup.py build
+running build
+running build_py
+creating build
+creating build/lib
+copying memcache.py -> build/lib
+touch build-stamp
+ fakeroot debian/rules binary
+dh_testdir
+dh_testroot
+dh_clean -k
+ rm -f debian/python-memcached.substvars
+ rm -f debian/python-memcached.*.debhelper
+ rm -rf debian/python-memcached
+ find . \( \( -type f -a \
+ \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \
+ -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \
+ -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \
+ -o -name TAGS -o -name core -o \( -path '*/.deps/*' -a -name '*.P' \) \
+ \) -exec rm -f {} \; \) -o \
+ \( -type d -a -name autom4te.cache -prune -exec rm -rf {} \; \) \)
+dh_installdirs
+ install -d debian/python-memcached
+/usr/bin/python2.4 setup.py install --prefix=/home/yusei/Project/nexedi/debian/work/packages/python-memcached/python-memcached-1.34/debian/python-memcached/usr
+running install
+running build
+running build_py
+running install_lib
+creating /home/yusei/Project/nexedi/debian/work/packages/python-memcached/python-memcached-1.34/debian/python-memcached/usr
+creating /home/yusei/Project/nexedi/debian/work/packages/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib
+creating /home/yusei/Project/nexedi/debian/work/packages/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4
+creating /home/yusei/Project/nexedi/debian/work/packages/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages
+copying build/lib/memcache.py -> /home/yusei/Project/nexedi/debian/work/packages/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages
+byte-compiling /home/yusei/Project/nexedi/debian/work/packages/python-memcached/python-memcached-1.34/debian/python-memcached/usr/lib/python2.4/site-packages/memcache.py to memcache.pyc
+dh_installdocs README
+ install -g 0 -o 0 -d debian/python-memcached/usr/share/doc/python-memcached
+ cp -a README debian/python-memcached/usr/share/doc/python-memcached
+ chown -R 0:0 debian/python-memcached/usr/share/doc
+ chmod -R go=rX debian/python-memcached/usr/share/doc
+ chmod -R u\+rw debian/python-memcached/usr/share/doc
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/python-memcached/usr/share/doc/python-memcached/copyright
+dh_installchangelogs
+ install -o 0 -g 0 -p -m644 debian/changelog debian/python-memcached/usr/share/doc/python-memcached/changelog.Debian
+dh_fixperms
+ find debian/python-memcached -print0 2>/dev/null | xargs -0r chown --no-dereference 0:0
+ find debian/python-memcached ! -type l -print0 2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s
+ find debian/python-memcached/usr/share/doc -type f ! -regex 'debian/python-memcached/usr/share/doc/[^/]*/examples/.*' -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/python-memcached/usr/share/doc -type d -print0 2>/dev/null | xargs -0r chmod 755
+ find debian/python-memcached/usr/share/man debian/python-memcached/usr/man/ debian/python-memcached/usr/X11*/man/ -type f -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/python-memcached -perm -5 -type f \( -name '*.so*' -or -name '*.la' -or -name '*.a' \) -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/python-memcached/usr/include -type f -name '*.h' -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/python-memcached/usr/lib/perl5 debian/python-memcached/usr/share/perl5 -type f -perm -5 -name '*.pm' -print0 2>/dev/null | xargs -0r chmod a-X
+dh_installdeb
+ install -o 0 -g 0 -d debian/python-memcached/DEBIAN
+dh_gencontrol
+ dpkg-gencontrol -ldebian/changelog -isp -Tdebian/python-memcached.substvars -Pdebian/python-memcached
+ chmod 644 debian/python-memcached/DEBIAN/control
+ chown 0:0 debian/python-memcached/DEBIAN/control
+dh_md5sums
+ (cd debian/python-memcached >/dev/null ; find . -type f ! -regex '.*/DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums) >/dev/null
+ chmod 644 debian/python-memcached/DEBIAN/md5sums
+ chown 0:0 debian/python-memcached/DEBIAN/md5sums
+dh_builddeb
+ dpkg-deb --build debian/python-memcached ..
+dpkg-deb: `../python-memcached_1.34-1_all.deb' ¤Ë¥Ñ¥Ã¥±¡¼¥¸ `python-memcached' ¤ò¹½ÃÛ¤·¤Æ¤¤¤Þ¤¹¡£
+ dpkg-genchanges
+dpkg-genchanges: including full source code in upload
+dpkg-buildpackage (debuild emulation): full upload (original source is included)
Added: spec/debian/unstable/python-memcached/python-memcached_1.34-1_i386.changes
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached_1.34-1_i386.changes?rev=12802&view=auto
==============================================================================
--- spec/debian/unstable/python-memcached/python-memcached_1.34-1_i386.changes (added)
+++ spec/debian/unstable/python-memcached/python-memcached_1.34-1_i386.changes Thu Feb 15 18:39:16 2007
@@ -1,0 +1,21 @@
+Format: 1.7
+Date: Tue, 13 Feb 2007 18:06:00 +0100
+Source: python-memcached
+Binary: python-memcached
+Architecture: source all
+Version: 1.34-1
+Distribution: unstable
+Urgency: low
+Maintainer: Yusei TAHARA <yusei at domen.cx>
+Changed-By: Yusei TAHARA <yusei at domen.cx>
+Description:
+ python-memcached - A Python API for memcached.
+Changes:
+ python-memcached (1.34-1) unstable; urgency=low
+ .
+ * Initial Release.
+Files:
+ c16b430a5328e28c815aed39fd3adbc5 366 interpreters optional python-memcached_1.34-1.dsc
+ 45a983f65d6a77743af6ef6e4aa3d74a 6497 interpreters optional python-memcached_1.34.orig.tar.gz
+ 4b6738e6687a36db7899fc37977dd19d 1066 interpreters optional python-memcached_1.34-1.diff.gz
+ 0f2b779a8157e83e49a700a93e921e83 13558 interpreters optional python-memcached_1.34-1_all.deb
Added: spec/debian/unstable/python-memcached/python-memcached_1.34.orig.tar.gz
URL: http://svn.erp5.org/spec/debian/unstable/python-memcached/python-memcached_1.34.orig.tar.gz?rev=12802&view=auto
==============================================================================
Binary file - no diff available.
Propchange: spec/debian/unstable/python-memcached/python-memcached_1.34.orig.tar.gz
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
More information about the Erp5-report
mailing list