コード例 #1
0
ファイル: __init__.py プロジェクト: e3krisztian/pip-init
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'))
コード例 #2
0
ファイル: __init__.py プロジェクト: e3krisztian/pip-init
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'))
コード例 #3
0
ファイル: __init__.py プロジェクト: janusnic/pip-init
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)
コード例 #4
0
ファイル: __init__.py プロジェクト: marcelbrueckner/pip-init
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)
コード例 #5
0
ファイル: test_pip_init.py プロジェクト: simudream/pip-init
 def test_setup_line(self):
     self.assertEqual(
         setup_line.substitute(name='author', value='me'),
         '    author="me",\n',
     )
コード例 #6
0
 def test_setup_line(self):
     self.assertEqual(
         setup_line.substitute(name='author', value='me'),
         '    author="me",\n',
     )