* Improve file headers in threadpool.py and cruft.py.
* Fix typo in PoolFile.is_valid().
* Add location_id to return value of str(somelocation).
Signed-off-by: Torsten Werner <twerner@debian.org>
+"""
+helper functions for cruft-report
+
+@contact: Debian FTPMaster <ftpmaster@debian.org>
+@copyright 2011 Torsten Werner <twerner@debian.org>
+"""
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+################################################################################
+
from daklib.dbconn import *
from sqlalchemy import func
def fullpath(self):
return os.path.join(self.location.path, self.filename)
- def is_valid(self, filesize = -1, md5sum = None):\
+ def is_valid(self, filesize = -1, md5sum = None):
return self.filesize == long(filesize) and self.md5sum == md5sum
def properties(self):
self.archive_type = 'pool'
def properties(self):
- return ['path', 'archive_type', 'component', 'files_count']
+ return ['path', 'location_id', 'archive_type', 'component', \
+ 'files_count']
def not_null_constraints(self):
return ['path', 'archive_type']
-import threading
-from time import sleep
+"""
+thread pool implementation for Python
-from daklib.config import Config
+@contact: Debian FTPMaster <ftpmaster@debian.org>
+@copyright: 2003 Tim Lesher
+@copyright: 2004 Carl Kleffner
+@copyright: 2010, 2011 Torsten Werner <twerner@debian.org>
+"""
# This code is a modified copy of
# http://code.activestate.com/recipes/203871-a-generic-programming-thread-pool/
# and is licensed under the Python License. The full text of the license
# is available in the file COPYING-PSF.
-# Ensure booleans exist (not needed for Python 2.2.1 or higher)
-try:
- True
-except NameError:
- False = 0
- True = not False
+import threading
+from time import sleep
+
+from daklib.config import Config
if Config().has_key('Common::ThreadCount'):
defaultThreadCount = int(Config()['Common::ThreadCount'])