-#!/usr/bin/env python
+#!/usr/bin/python
-# Load apt-p2p application
-#
-# There are two ways apt-p2p can be started:
-# 1. twistd -y apt-p2p
-# - twistd will load this file and execute the app
-# in 'application' variable
-# 2. from command line
-# - __name__ will be '__main__'
+"""Load the apt-p2p application.
+
+There are two ways apt-p2p can be started:
+ 1. twistd -y apt-p2p
+ - twistd will load this file and execute the app
+ in 'application' variable
+ 2. from command line
+ - __name__ will be '__main__'
+"""
import pwd,sys
class PiecesUploader(static.Data):
"""Modified to identify it for peer requests.
- Uses the modified L{Streams.PieceUploadStream} to stream the pieces for throttling.
+ Uses the modified L{Streams.PiecesUploadStream} to stream the pieces for throttling.
"""
def render(self, req):
@param url: the URI of the actual mirror request
@type orig_resp: L{twisted.web2.http.Response}
@param orig_resp: the response from the cache to be sent to apt
- @rtype: L{twisted.internet.defer.Deferred}
- @return: a deferred that will be called back with the correct response
"""
log.msg('Checking if %s is still fresh' % url)
modtime = orig_resp.headers.getHeader('Last-Modified')
def __init__(self, db):
"""Initialize the statistics.
- @type store: L{db.DB}
- @param store: the database for the Apt-P2P downloader
+ @type db: L{db.DB}
+ @param db: the database for the Apt-P2P downloader
"""
# Database
self.db = db
# The list of objects to document. Objects can be named using
# dotted names, module filenames, or package directory names.
# Alases for this option include "objects" and "values".
-modules: apt_p2p apt_p2p_Khashmir test.py
+modules: apt_p2p apt_p2p_Khashmir apt-p2p.py test.py
# The type of output that should be generated. Should be one
# of: html, text, latex, dvi, ps, pdf.
-#!/usr/bin/env python
+#!/usr/bin/python
"""Automated tests of the apt-p2p functionality.
@var CWD: the working directory the script was run from
@type apt_conf_template: C{string}
@var apt_conf_template: the template to use for the apt.conf file
-
+@type apt_p2p_conf_template: C{string}
+@var apt_p2p_conf_template: the template to use for the apt-p2p.conf file
"""
from time import sleep, time