예제 #1
0
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
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
    def test_setup_base_template(self):

        expected_setup = ('# -*- coding: utf-8 -*-\n'
                          'from setuptools import setup, find_packages\n'
                          '\n'
                          'try:\n'
                          '    long_description = open("README.rst").read()\n'
                          'except IOError:\n'
                          '    long_description = ""\n'
                          '\n'
                          'setup(\n'
                          '    name="dump-package",\n'
                          '    packages=find_packages(),\n'
                          '    install_requires=[],\n'
                          '    long_description=long_description,\n'
                          '    classifiers=[\n'
                          '        "Programming Language :: Python",\n'
                          '        "Programming Language :: Python :: 2.7"\n'
                          '    ]\n'
                          ')\n')

        setup_lines = '    name="dump-package",\n'
        classifiers = ('    classifiers=[\n'
                       '        "Programming Language :: Python",\n'
                       '        "Programming Language :: Python :: 2.7"\n'
                       '    ]')

        self.assertMultiLineEqual(
            expected_setup,
            setup_base_template.substitute(setup_lines=setup_lines,
                                           classifiers=classifiers))
예제 #4
0
    def test_setup_base_template(self):

        expected_setup = ('from setuptools import setup, find_packages\n'
                          '\n'
                          'try:\n'
                          '    long_description = open("README.rst").read()\n'
                          'except IOError:\n'
                          '    long_description = ""\n'
                          '\n'
                          'setup(\n'
                          '    name="dump-package",\n'
                          '    packages=find_packages(),\n'
                          '    install_requires=[],\n'
                          '    long_description=long_description\n'
                          ')\n')

        setup_lines = '    name="dump-package",\n'

        self.assertEqual(
            expected_setup,
            setup_base_template.substitute(setup_lines=setup_lines))
예제 #5
0
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)
예제 #6
0
    def test_setup_base_template(self):

        expected_setup = (
            '# -*- coding: utf-8 -*-\n'
            'from setuptools import setup, find_packages\n'
            '\n'
            'try:\n'
            '    long_description = open("README.rst").read()\n'
            'except IOError:\n'
            '    long_description = ""\n'
            '\n'
            'setup(\n'
            '    name="dump-package",\n'
            '    packages=find_packages(),\n'
            '    install_requires=[],\n'
            '    long_description=long_description,\n'
            '    classifiers=[\n'
            '        "Programming Language :: Python",\n'
            '        "Programming Language :: Python :: 2.7"\n'
            '    ]\n'
            ')\n'
        )

        setup_lines = '    name="dump-package",\n'
        classifiers = (
            '    classifiers=[\n'
            '        "Programming Language :: Python",\n'
            '        "Programming Language :: Python :: 2.7"\n'
            '    ]'
        )

        self.assertMultiLineEqual(
            expected_setup,
            setup_base_template.substitute(
                setup_lines=setup_lines,
                classifiers=classifiers
            )
        )
예제 #7
0
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)