Beispiel #1
0
    def test_convert_setup_py_to_cfg_with_description_in_readme(self):
        self.write_file((self.wdir, 'setup.py'),
                        dedent("""
        # coding: utf-8
        from distutils.core import setup
        with open('README.txt') as fp:
            long_description = fp.read()

        setup(name='pyxfoil',
              version='0.2',
              description='Python bindings for the Xfoil engine',
              long_description=long_description,
              maintainer='André Espaze',
              maintainer_email='*****@*****.**',
              url='http://www.python-science.org/project/pyxfoil',
              license='GPLv2',
              packages=['pyxfoil'],
              package_data={'pyxfoil': ['fengine.so', 'babar.so']},
              data_files=[
                ('share/doc/pyxfoil', ['README.rst']),
                ('share/man', ['pyxfoil.1']),
              ],
        )
        """), encoding='utf-8')
        self.write_file((self.wdir, 'README.txt'),
                        dedent('''
My super Death-scription
barbar is now in the public domain,
ho, baby!
                        '''))
        create.input = Inputs('y')
        main()

        path = os.path.join(self.wdir, 'setup.cfg')
        with open(path, encoding='utf-8') as fp:
            contents = fp.read()

        self.assertEqual(contents, dedent("""\
            [metadata]
            name = pyxfoil
            version = 0.2
            summary = Python bindings for the Xfoil engine
            download_url = UNKNOWN
            home_page = http://www.python-science.org/project/pyxfoil
            maintainer = André Espaze
            maintainer_email = [email protected]
            description-file = README.txt

            [files]
            packages = pyxfoil
            package_data =
                pyxfoil = fengine.so
                          babar.so

            resources =
                README.rst = {doc}
                pyxfoil.1 = {man}

            """))
Beispiel #2
0
    def test_convert_setup_py_to_cfg(self):
        self.write_file((self.wdir, 'setup.py'),
                        dedent("""
        # coding: utf-8
        from distutils.core import setup

        long_description = '''My super Death-scription
        barbar is now on the public domain,
        ho, baby !'''

        setup(name='pyxfoil',
              version='0.2',
              description='Python bindings for the Xfoil engine',
              long_description=long_description,
              maintainer='André Espaze',
              maintainer_email='*****@*****.**',
              url='http://www.python-science.org/project/pyxfoil',
              license='GPLv2',
              packages=['pyxfoil', 'babar', 'me'],
              data_files=[
                  ('share/doc/pyxfoil', ['README.rst']),
                  ('share/man', ['pyxfoil.1']),
                         ],
              py_modules=['my_lib', 'mymodule'],
              package_dir={
                  'babar': '',
                  'me': 'Martinique/Lamentin',
                          },
              package_data={
                  'babar': ['Pom', 'Flora', 'Alexander'],
                  'me': ['dady', 'mumy', 'sys', 'bro'],
                  'pyxfoil': ['fengine.so'],
                           },
              scripts=['my_script', 'bin/run'],
              )
        """), encoding='utf-8')
        create.input = Inputs('y')
        main()

        path = os.path.join(self.wdir, 'setup.cfg')
        with open(path, encoding='utf-8') as fp:
            contents = fp.read()

        self.assertEqual(contents, dedent("""\
            [metadata]
            name = pyxfoil
            version = 0.2
            summary = Python bindings for the Xfoil engine
            download_url = UNKNOWN
            home_page = http://www.python-science.org/project/pyxfoil
            maintainer = André Espaze
            maintainer_email = [email protected]
            description = My super Death-scription
                   |barbar is now on the public domain,
                   |ho, baby !

            [files]
            packages = pyxfoil
                babar
                me
            modules = my_lib
                mymodule
            scripts = my_script
                bin/run
            package_data =
                babar = Pom
                        Flora
                        Alexander
                me = dady
                     mumy
                     sys
                     bro
                pyxfoil = fengine.so

            resources =
                README.rst = {doc}
                pyxfoil.1 = {man}

            """))
Beispiel #3
0
def _create(distpatcher, args, **kw):
    from packaging.create import main
    return main()
Beispiel #4
0
        if self.action is None:
            return

        for action, desc, func in actions:
            if action == self.action:
                return func(self, self.args)
        return -1


def main(args=None):
    old_level = logger.level
    old_handlers = list(logger.handlers)
    try:
        dispatcher = Dispatcher(args)
        if dispatcher.action is None:
            return
        return dispatcher()
    except KeyboardInterrupt:
        logger.info('interrupted')
        return 1
    except (IOError, os.error, PackagingError, CCompilerError) as exc:
        logger.exception(exc)
        return 1
    finally:
        logger.setLevel(old_level)
        logger.handlers[:] = old_handlers


if __name__ == '__main__':
    sys.exit(main())