-#!/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
from twisted.internet import reactor
from twisted.python import usage, log
-from apt_p2p.apt_p2p_conf import config, version, DEFAULT_CONFIG_FILES
+from apt_p2p.apt_p2p_conf import config, version, versionID, DEFAULT_CONFIG_FILES
from apt_p2p.interfaces import IDHT, IDHTStatsFactory
config_file = ''
log.msg("Loading config files: '%s'" % "', '".join(DEFAULT_CONFIG_FILES + [config_file]))
config_read = config.read(DEFAULT_CONFIG_FILES + [config_file])
+config.set(config.get('DEFAULT', 'DHT'), 'VERSION', versionID)
log.msg("Successfully loaded config files: '%s'" % "', '".join(config_read))
try:
uid,gid = pwd.getpwnam(config.get('DEFAULT', 'USERNAME'))[2:4]