# Path: RapacheCore/Configuration.py
# SYSCONFDIR = '/etc/apache2'
# SITES_ENABLED_DIR = SYSCONFDIR + '/sites-enabled'
# SITES_AVAILABLE_DIR = SYSCONFDIR + '/sites-available'
# MODS_ENABLED_DIR = SYSCONFDIR + '/mods-enabled'
# MODS_AVAILABLE_DIR = SYSCONFDIR + '/mods-available'
# APPPATH = '/usr/bin' #please fill at run-time
# GLADEPATH = '/usr/share/rapache/Glade' #please fill at run-time
# NUMBER_OF_BACKUPS = 10
# TEST_CONNECTION_INTERVAL = 30
# 
# Path: RapacheCore/Shell.py
# class CommandLogEntry:
# class CommandHandler:
#     def __init__(self, command):
#     def __init__(self, ssh_server="localhost", ssh_port=None, ssh_username=None, ssh_password=None):
#     def __get_backup_path(self, path):
#     def get_backup_files(self, path):
#     def read_file_version(self, path, date_stamp):
#     def create_backup(self, path, new_content):
#     def read_file(self, path):
#     def write_file(self, path, content, backup=True):
#     def listdir(self, path):
#     def create_complete_path ( self, complete_path ):
#     def exists(self, path):
#     def readlink(self, path):
#     def move(self, source, destination):
#     def __get_password(self, description, prompt="Password: "):
#     def __sudo_popen (self, command, password ): 
#     def is_auth_needed (self):        
#     def execute(self, command, description = None ):
#     def __output (self, command, returncode, output, error ):
#     def sudo_reset (self):
#     def ask_password(self, description = "Super user priviledges are required to perform this operation"):
#     def sudo_execute(self, command, description = "Super user priviledges are required to perform this operation"):
#     def sudo_read_file(self, path):
#     def sudo_exists(self, path):
#     def sudo_listdir(self, path):


import sys
import os
import tempfile
import re
from RapacheCore import Configuration
from RapacheCore import Shell
from xml.dom.minidom import *
            options = {}
            content = self.get_source()                
            self.__get_dependecies(content)
            self.parsable = True
        except:
            #print "Unparsable by me - unsupported"
            raise "ModuleUnparsable"
            return False
        self.data['configurable'] = \
                os.path.exists( os.path.join ( Configuration.MODS_AVAILABLE_DIR, self.data['name']+".conf" ))
            
        
        self.data.update( options )
        #print self.data
        return True
    def __get_dependecies(self, content):   
        content = content.split("\n")
        dependancies = []
        for line in content:
            match = re.match ( r'# Depends:(.*)', line )
            if match != None:                                 
                dependancy = match.groups()[0].strip()
                if dependancy != "" : dependancies.append( dependancy )
        self.data[ 'dependancies' ] = dependancies
    def is_enabled ( self ):
        orig = self.data[ 'name' ] + ".load"              
        dirList = Shell.command.listdir( Configuration.MODS_ENABLED_DIR )        
        for fname in dirList:
            try:                                
                flink = Shell.command.readlink( os.path.join(Configuration.MODS_ENABLED_DIR, fname) )               

# Path: RapacheCore/Configuration.py
# SYSCONFDIR = '/etc/apache2'
# SITES_ENABLED_DIR = SYSCONFDIR + '/sites-enabled'
# SITES_AVAILABLE_DIR = SYSCONFDIR + '/sites-available'
# MODS_ENABLED_DIR = SYSCONFDIR + '/mods-enabled'
# MODS_AVAILABLE_DIR = SYSCONFDIR + '/mods-available'
# APPPATH = '/usr/bin' #please fill at run-time
# GLADEPATH = '/usr/share/rapache/Glade' #please fill at run-time
# NUMBER_OF_BACKUPS = 10
# TEST_CONNECTION_INTERVAL = 30
# 
# Path: RapacheCore/Shell.py
# class CommandLogEntry:
# class CommandHandler:
#     def __init__(self, command):
#     def __init__(self, ssh_server="localhost", ssh_port=None, ssh_username=None, ssh_password=None):
#     def __get_backup_path(self, path):
#     def get_backup_files(self, path):
#     def read_file_version(self, path, date_stamp):
#     def create_backup(self, path, new_content):
#     def read_file(self, path):
#     def write_file(self, path, content, backup=True):
#     def listdir(self, path):
#     def create_complete_path ( self, complete_path ):
#     def exists(self, path):
#     def readlink(self, path):
#     def move(self, source, destination):
#     def __get_password(self, description, prompt="Password: "):
#     def __sudo_popen (self, command, password ): 
#     def is_auth_needed (self):        
#     def execute(self, command, description = None ):
#     def __output (self, command, returncode, output, error ):
#     def sudo_reset (self):
#     def ask_password(self, description = "Super user priviledges are required to perform this operation"):
#     def sudo_execute(self, command, description = "Super user priviledges are required to perform this operation"):
#     def sudo_read_file(self, path):
#     def sudo_exists(self, path):
#     def sudo_listdir(self, path):


# Path: RapacheCore/Module.py
import sys
import os
import tempfile
import re
from RapacheCore import Configuration
from RapacheCore import Shell
from xml.dom.minidom import *

            options = {}
            content = self.get_source()                
            self.__get_dependecies(content)
            self.parsable = True
        except:
            #print "Unparsable by me - unsupported"
            raise "ModuleUnparsable"
            return False
        self.data['configurable'] = \
                os.path.exists( os.path.join ( Configuration.MODS_AVAILABLE_DIR, self.data['name']+".conf" ))
            
        
        self.data.update( options )
        #print self.data
        return True
    def __get_dependecies(self, content):   
        content = content.split("\n")
        dependancies = []
        for line in content:
            match = re.match ( r'# Depends:(.*)', line )
            if match != None:                                 
                dependancy = match.groups()[0].strip()
                if dependancy != "" : dependancies.append( dependancy )
        self.data[ 'dependancies' ] = dependancies
    def is_enabled ( self ):
        orig = self.data[ 'name' ] + ".load"              
        dirList = Shell.command.listdir( Configuration.MODS_ENABLED_DIR )        
        for fname in dirList:
            try:                                
                flink = Shell.command.readlink( os.path.join(Configuration.MODS_ENABLED_DIR, fname) )               

                flink = os.path.join(os.path.dirname( Configuration.MODS_ENABLED_DIR +"/" ), flink)