def command(self): """Main command to create a modwsgi configuration files""" #Output directory is current folder unless specified vi output command. output_dir = os.path.join(self.options.output_dir, 'apache') #Input where the templates are at. input_dir= source_filename = os.path.join(os.path.dirname(__file__), 'templates/apache') #Finding directory that has egg info egg_info_dir = pluginlib.find_egg_info_dir(os.getcwd()) #Name of the module plugins= os.path.splitext(os.path.basename(egg_info_dir))[0] #print os.path.splitext(os.path.basename(egg_info_dir))[0] dist_name= pluginlib.get_distro(plugins) vars={} #If PKG-INFO exists read it and add it to vars if dist_name.has_metadata('PKG-INFO'): data=dist_name.get_metadata('PKG-INFO') for add_info in pluginlib.parse_lines(data): (key,value) = add_info.split(':',1) vars[key]=value #Add package names vars['project']=plugins vars['package']=plugins vars['egg']=pluginlib.egg_name(str(dist_name)) #Copy my template direcotry to destination. copy_dir(input_dir, output_dir, vars, verbosity=1, simulate=False, use_cheetah=True) print 'Thank you for using modwsgideploy!' print 'Please read README.txt in apache folder.' print 'http://lucasmanual.com/mywiki/modwsgideploy' print 'Made in Chicago,IL USA'
def write_files(self, command, output_dir, vars): structure_dirs = self.structure_dir() if len(structure_dirs) > 0: if not os.path.exists(output_dir): print "Creating directory %s" % output_dir if not command.simulate: os.makedirs(output_dir) for structure_dir in structure_dirs: copydir.copy_dir(structure_dir, output_dir, vars, verbosity=0, simulate=command.options.simulate, interactive=command.interactive, overwrite=command.options.overwrite, indent=1, use_cheetah=self.use_cheetah, template_renderer=self.template_renderer)