def label(classifiers): """Takes a list of classifiers gathered by the project.prompt_classifiers() function and adds them to the setup.py file.""" if os.path.isfile('.pythong'): try: config_data = read_config('.pythong') # TODO: fix dict so I can do config_data.project.classifiers, # so that I can add cool stuff to the config later that is # not about the project? dunno if necessary config_data['classifiers'] = classifiers write_config('.pythong', config_data) print "Modified .pythong config file with new classifiers." if ask_yes_no("Do you want to rebuild your setup.py from your new" " config file? All manual changes will be erased.", default=False): try: write_setup_files(config_data['project_dir']) print "Setup files written." except: print "Problem writing setup files." except OSError: print "Can't open .pythong file in current directory." else: print "No .pythong file in current directory."
def write_setup_files(project_dir): config_data = read_config(os.path.join(project_dir, '.pythong')) config_data = _do_line_wrap(config_data) with open(join(config_data['project_dir'], 'distribute_setup.py'), 'w') as f: f.write(distribute_template.render(project=config_data)) with open(config_data['setup_file'], 'w') as f: f.write(setup_template.render(project=config_data))