def main(): fields = ['name', 'version', 'description', 'license', 'author'] setup_lines = '' for field_name in fields: default_value = default_values(field_name) input_msg = input_message(field_name, default_value) if version_info >= (3, 0): input_value = input(input_msg) else: input_value = raw_input(input_msg.encode('utf8')) if input_value == '': input_value = default_value setup_lines += setup_line.substitute( name=field_name, value=input_value ) setup_content = setup_base_template.substitute( setup_lines=setup_lines, classifiers=gen_classifiers() ) with open('setup.py', 'w') as setup_file: if version_info >= (3, 0): setup_file.write(setup_content) else: setup_file.write(setup_content.encode('utf8'))
def main(): fields = ['name', 'version', 'description', 'license', 'author'] setup_lines = '' for field_name in fields: default_value = default_values(field_name) input_msg = input_message(field_name, default_value) if version_info >= (3, 0): input_value = input(input_msg) else: input_value = raw_input(input_msg.encode('utf8')) if input_value == '': input_value = default_value setup_lines += setup_line.substitute(name=field_name, value=input_value) setup_content = setup_base_template.substitute( setup_lines=setup_lines, classifiers=gen_classifiers()) with open('setup.py', 'w') as setup_file: if version_info >= (3, 0): setup_file.write(setup_content) else: setup_file.write(setup_content.encode('utf8'))
def main(): fields = ["name", "version", "description", "license", "author"] setup_lines = "" for field_name in fields: default_value = default_values(field_name) input_msg = input_message(field_name, default_value) if version_info >= (3, 0): input_value = input(input_msg) else: input_value = raw_input(input_msg) if input_value == "": input_value = default_value setup_lines += setup_line.substitute(name=field_name, value=input_value) setup_content = setup_base_template.substitute(setup_lines=setup_lines, classifiers=gen_classifiers()) with open("setup.py", "w") as setup_file: setup_file.write(setup_content)
def main(): fields = ['name', 'version', 'description', 'license', 'author'] setup_lines = '' for field_name in fields: default_value = default_values(field_name) input_msg = input_message(field_name, default_value) input_value = get_input(input_msg, default=default_value) setup_lines += setup_line.substitute(name=field_name, value=input_value) setup_content = setup_base_template.substitute( setup_lines=setup_lines, classifiers=gen_classifiers()) with open('setup.py', 'w') as setup_file: write_content(setup_file, setup_content) with_gitignore = get_input('Generate .gitignore file [Y/n]?: ', default='y') if with_gitignore.lower() == 'y': with open('.gitignore', 'w') as gitignore_file: write_content(gitignore_file, gitignore_content)
def test_setup_line(self): self.assertEqual( setup_line.substitute(name='author', value='me'), ' author="me",\n', )