Exemplo n.º 1
0
def d2to1(dist, attr, value):
    """Implements the actual d2to1 setup() keyword.  When used, this should be
    the only keyword in your setup() aside from `setup_requires`.

    If given as a string, the value of d2to1 is assumed to be the relative path
    to the setup.cfg file to use.  Otherwise, if it evaluates to true, it
    simply assumes that d2to1 should be used, and the default 'setup.cfg' is
    used.

    This works by reading the setup.cfg file, parsing out the supported
    metadata and command options, and using them to rebuild the
    `DistributionMetadata` object and set the newly added command options.

    The reason for doing things this way is that a custom `Distribution` class
    will not play nicely with setup_requires; however, this implementation may
    not work well with distributions that do use a `Distribution` subclass.
    """

    if not value:
        return
    if isinstance(value, basestring):
        path = os.path.abspath(value)
    else:
        path = os.path.abspath('setup.cfg')
    if not os.path.exists(path):
        raise DistutilsFileError(
            'The setup.cfg file %s does not exist.' % path)

    # Converts the setup.cfg file to setup() arguments
    try:
        attrs = cfg_to_args(path)
    except Exception, e:
        raise DistutilsSetupError(
                'Error parsing %s: %s: %s' % (path, e.__class__.__name__,
                                              unicode(e)))
Exemplo n.º 2
0
#!/usr/bin/env python
try:
    from setuptools import setup
except ImportError:
    import sys

    if sys.version_info[:2] < (2, 6):
        from ez_setup25 import use_setuptools
    else:
        from ez_setup import use_setuptools
    use_setuptools()
    from setuptools import setup

# d2to1 basically installs itself!  See setup.cfg for the project metadata.
from d2to1.util import cfg_to_args


setup(**cfg_to_args())
Exemplo n.º 3
0
#!/usr/bin/env python
try:
    from setuptools import setup
except ImportError:
    from distribute_setup import use_setuptools
    use_setuptools()
    from setuptools import setup

# d2to1 basically installs itself!  See setup.cfg for the project metadata.
from d2to1.util import cfg_to_args

setup(**cfg_to_args())