Esempio n. 1
0
def test_extension():
    tmpdir = tempfile.mkdtemp()
    old_dir = os.getcwd()
    os.chdir(tmpdir)
    print(tmpdir)
    try:
        with open('test.pyx', 'w') as f:
            f.write(extension)

        exts = cythonize(
            cyflann.FLANNExtension('test', ['test.pyx'],
                                   include_dirs=[np.get_include()]))

        if sys.platform == 'darwin':
            import sysconfig
            s = 'MACOSX_DEPLOYMENT_TARGET'
            os.environ[s] = sysconfig.get_config_var(s)

        _setup(script_name='a_test',
               script_args=['build_ext', '--inplace'],
               ext_modules=exts)

        sys.path.insert(0, tmpdir)
        import test
        test.do_test()
    finally:
        os.chdir(old_dir)
        shutil.rmtree(tmpdir)
        if sys.path[0] == tmpdir:
            del sys.path[0]
Esempio n. 2
0
def setup(**kws):
    """Wrapper around setuptools.setup() which injects extra Commands
       needed to build DSOs.
    """
    cmdclass = kws.setdefault('cmdclass', {})

    # cmdclass_setdefault sets default to cmdclass[name]=klass and verifies
    # that cmdclass[name] is a subclass of klass. This way we check, for
    # example, that build_ext overridden by user is not some arbitrary class,
    # but inherits from setuptools_dso.build_ext, which is required for
    # setuptools_dso to work correctly.
    def cmdclass_setdefault(name, klass):
        cmdclass.setdefault(name, klass)
        if not issubclass(cmdclass[name], klass):
            raise AssertionError("cmdclass[%s] must be subclass of %s" %
                                 (cmdclass[name], klass))

    cmdclass_setdefault('bdist_egg', bdist_egg)
    cmdclass_setdefault('build_dso', build_dso)
    cmdclass_setdefault('build_ext', build_ext)
    kws.setdefault(
        'zip_safe',
        len(kws.get('ext_modules', [])) == 0
        and len(kws.get('x_dsos', [])) == 0)
    _setup(**kws)
Esempio n. 3
0
def setup(*args, **kwargs):
    asapso = Extension(name="%s._%s" % (kwargs['name'],kwargs['name']),
                       sources=[])
    d = {'ext_modules': [ asapso ],
         'cmdclass': {'build_ext': scons_ext}
         }
    kwargs.update(d)
    _setup(*args, **kwargs)
Esempio n. 4
0
def setup(*args, **kwargs):
    ''' Wrapping setuptools' setup to add custom controls '''

    krb5_h_filename = locate_krb5_h()
    if krb5_h_filename is None:
        raise IOError('Cannot find krb5.h, enusre you have installed '
                      'krb5 development library.')
    generate_krb5defines_h_from(krb5_h_filename)

    _setup(**kwargs)
 def fixed_version_setup(*args, **kwargs):
     old_version = kwargs.pop('version')
     base_version = ".".join(map(str, version.version))
     python_version = base_version
     if version.build_number is not None:
         python_version = "%src%s" % (base_version, version.build_number)
     logging.info(
         "Version in file is %s, using %s" % (
             old_version, python_version))
     _setup(
         version=python_version,
         distclass=WheelRunningDistribution, *args, **kwargs)
Esempio n. 6
0
def setup(**attrs):
    version = attrs['version']
    if isinstance(version, tuple):
        if len(version) > 3:
            if version[3] not in ['F', 'f', 'final', 'Final']:
                __alart_setup()
                inp = input()
                if inp in ['Y', 'y', 'yes', 'Yes', 'YES']:
                    return _setup(**attrs)
            else:
                sys.exit()
    return _setup(**attrs)
Esempio n. 7
0
def setup(**kwargs):
    # TODO: Find a better way to pass this to a command.
    os.environ['setup_long_name'] = kwargs.pop('long_name', kwargs.get('name'))

    if 'version' not in kwargs:
        kwargs['version'] = get_version()
    packages = kwargs.setdefault(
        'packages',
        find_packages(exclude=['test', 'test.*', base_module + '.*']))
    packages.append(__name__)
    install_requires = kwargs.setdefault('install_requires', [])
    yc_blacklist = kwargs.pop('yc_requires_exclude', [])
    yc_requires = kwargs.pop('yc_requires', [])
    yc_requires_stack = yc_requires[:]
    while yc_requires_stack:
        yc_module = yc_requires_stack.pop()
        for yc_dep in get_yc_dependencies(yc_module):
            if yc_dep not in yc_requires:
                yc_requires.append(yc_dep)
                yc_requires_stack.append(yc_dep)
    for yc_module in yc_requires:
        packages.append(get_package(yc_module))
        for dep in get_dependencies(yc_module):
            if dep not in install_requires and dep not in yc_blacklist:
                install_requires.append(dep)
    cmdclass = kwargs.setdefault('cmdclass', {})
    cmdclass.setdefault('release', release)
    cmdclass.setdefault('build_man', build_man)
    cmdclass.setdefault('sdist', custom_sdist)
    return _setup(**kwargs)
Esempio n. 8
0
def setup(**kwargs):
    # TODO: Find a better way to pass this to a command.
    os.environ['setup_long_name'] = kwargs.pop('long_name', kwargs.get('name'))

    if 'version' not in kwargs:
        kwargs['version'] = get_version()
    packages = kwargs.setdefault(
        'packages',
        find_packages(exclude=['test', 'test.*', base_module + '.*']))
    packages.append(__name__)
    install_requires = kwargs.setdefault('install_requires', [])
    yc_blacklist = kwargs.pop('yc_requires_exclude', [])
    yc_requires = kwargs.pop('yc_requires', [])
    yc_requires_stack = yc_requires[:]
    while yc_requires_stack:
        yc_module = yc_requires_stack.pop()
        for yc_dep in get_yc_dependencies(yc_module):
            if yc_dep not in yc_requires:
                yc_requires.append(yc_dep)
                yc_requires_stack.append(yc_dep)
    for yc_module in yc_requires:
        packages.append(get_package(yc_module))
        for dep in get_dependencies(yc_module):
            if dep not in install_requires and dep not in yc_blacklist:
                install_requires.append(dep)
    cmdclass = kwargs.setdefault('cmdclass', {})
    cmdclass.setdefault('release', release)
    cmdclass.setdefault('build_man', build_man)
    cmdclass.setdefault('sdist', custom_sdist)
    return _setup(**kwargs)
Esempio n. 9
0
def setup():
    _setup(name=app.__name__,
           version='0.0.1',
           description="""Calculate Distance to streets""",
           url='https://github.com/emptymalei/geoeconomics-with-data',
           author='Lei Ma',
           author_email='*****@*****.**',
           license='MIT',
           packages=find_packages(),
           entry_points={
               'console_scripts': [
                   'distance_calculator = {}:main'.format(
                       distance_calculator.__name__),
               ],
           },
           include_package_data=True,
           zip_safe=False)
Esempio n. 10
0
def setup(**kw):
    """
    An alternative to distutils' setup() which is specially designed
    for Twisted subprojects.

    @param conditionalExtensions: Extensions to optionally build.
    @type conditionalExtensions: C{list} of L{ConditionalExtension}
    """
    return _setup(**get_setup_args(**kw))
Esempio n. 11
0
def setup(**kwargs):
    if 'version' not in kwargs:
        kwargs['version'] = get_version()
    kwargs.setdefault('packages', find_packages(exclude=['test', 'test.*']))
    cmdclass = kwargs.setdefault('cmdclass', {})
    cmdclass.setdefault('release', release)
    cmdclass.setdefault('build_man', build_man)
    cmdclass.setdefault('sdist', custom_sdist)
    return _setup(**kwargs)
Esempio n. 12
0
def setup(**kw):
    """
    An alternative to distutils' setup() which is specially designed
    for Twisted subprojects.

    @param conditionalExtensions: Extensions to optionally build.
    @type conditionalExtensions: C{list} of L{ConditionalExtension}
    """
    return _setup(**get_setup_args(**kw))
Esempio n. 13
0
def setup():
    scripts = [os.path.join('scripts', f) for f in os.listdir('scripts')]
    scripts = [
        s for s in scripts if (os.name == 'nt' and s.endswith('.bat')) or (
            os.name != 'nt' and not s.endswith('.bat'))
    ]
    packages = [
        'pyne', 'pyne.dbgen', 'pyne.apigen', 'pyne.xs', 'pyne.transmute',
        'pyne.gui', 'pyne.cli'
    ]
    pack_dir = {
        'pyne': 'pyne',
        'pyne.xs': 'pyne/xs',
        'pyne.gui': 'pyne/gui',
        'pyne.cli': 'pyne/cli',
        'pyne.dbgen': 'pyne/dbgen',
        'pyne.apigen': 'pyne/apigen',
        'pyne.transmute': 'pyne/transmute',
    }
    extpttn = ['*.dll', '*.so', '*.dylib', '*.pyd', '*.pyo']
    pack_data = {
        'lib':
        extpttn,
        'pyne': [
            '*.pxd', 'include/*.h', 'include/*.pxi', 'include/*/*.h', '*.inp',
            'include/*/*/*.h', 'include/*/*/*/*.h', '*.json',
            '_includes/*.txt', '_includes/*.pxd', '_includes/*/*',
            '_includes/*/*/*'
        ] + extpttn,
        'pyne.xs': ['*.pxd'] + extpttn,
        'pyne.gui': ['*.pyw'],
        'pyne.dbgen': ['*.html', '*.csv', 'abundances.txt', 'mass.mas12'],
    }
    libpynes = set()
    for ext in extpttn:
        libpynes |= set(glob('src/' + ext))
    data_files = [
        ('lib', libpynes),
        ('include/pyne', glob('../src/*.h')),
    ]
    setup_kwargs = {
        "name": "pyne",
        "version": VERSION,
        "description": 'The Nuclear Engineering Toolkit',
        "author": 'PyNE Development Team',
        "author_email": '*****@*****.**',
        "url": 'http://pyne.github.com/',
        "packages": packages,
        "package_dir": pack_dir,
        "package_data": pack_data,
        "data_files": data_files,
        "scripts": scripts,
        #"zip_safe": False,
    }
    rtn = _setup(**setup_kwargs)
Esempio n. 14
0
def setup(*args, **kwargs):
    kwargs.setdefault('cmdclass', {})
    kwargs['cmdclass'].setdefault('test', test)
    kwargs['cmdclass'].setdefault('install_data', install_data)
    kwargs['cmdclass'].setdefault('install_lib', install_lib)
    kwargs['cmdclass'].setdefault('build_man', build_man)
    kwargs['cmdclass'].setdefault('install_man', install_man)
    kwargs['cmdclass'].setdefault('clean', clean)
    if py2exe is not None:
        kwargs['cmdclass'].setdefault('py2exe', py2exe)
    return _setup(*args, **kwargs)
Esempio n. 15
0
def setup():
    _setup(
        name=PACKAGE_NAME,
        version=PACKAGE_VERSION,
        description=PACKAGE_DESCRIPTION,
        long_description=PACKAGE_LONG_DESCRIPTION,
        long_description_content_type="text/markdown",
        url=PACKAGE_URL,
        author="Lei Ma",
        author_email="*****@*****.**",
        license="MIT",
        packages=_find_packages(exclude=("tests", )),
        install_requires=_requirements(),
        include_package_data=True,
        extras_require={"docs": ["sphinx>=2.4.1", "sphinx-rtd-theme>=0.4.3"]},
        entry_points={
            "console_scripts": ["dataherb=dataherb.command:dataherb"]
        },
        test_suite="nose.collector",
        tests_require=["nose"],
        zip_safe=False,
    )
Esempio n. 16
0
def setup(**kws):
    """setup(..., x_dsos=[DSO(...)])
    Wrapper around setuptools.setup() which injects extra Commands needed to build DSOs.
    Unknown keywords are passed through.

    :param x_dsos: None, a list of :py:class:`DSO` instances, or a callable with one argument returning such a list.
    """
    cmdclass = kws.setdefault('cmdclass', {})

    # cmdclass_setdefault sets default to cmdclass[name]=klass and verifies
    # that cmdclass[name] is a subclass of klass. This way we check, for
    # example, that build_ext overridden by user is not some arbitrary class,
    # but inherits from setuptools_dso.build_ext, which is required for
    # setuptools_dso to work correctly.
    def cmdclass_setdefault(name, klass, error=True):
        cmdclass.setdefault(name, klass)
        if not issubclass(cmdclass[name], klass):
            if error:
                raise AssertionError("cmdclass[%s] must be subclass of %s" %
                                     (cmdclass[name], klass))
            else:
                log.warn(
                    "cmdclass[%s] must be subclass of %s, setuptools-dso functionality may be lost",
                    cmdclass[name], klass)

    cmdclass_setdefault('bdist_egg', bdist_egg)
    cmdclass_setdefault('build_dso', build_dso)
    cmdclass_setdefault('build_ext', build_ext)
    try:
        from .dsocmd import bdist_wheel
    except ImportError:
        pass  # wheel not installed
    else:
        cmdclass_setdefault('bdist_wheel', bdist_wheel, error=False)
    x_dsos = kws.get('x_dsos')
    has_dsos = callable(x_dsos) or len(x_dsos or []) > 0
    kws.setdefault('zip_safe',
                   len(kws.get('ext_modules', [])) == 0 and not has_dsos)
    _setup(**kws)
Esempio n. 17
0
def setup(**kwargs):
    if 'version' not in kwargs:
        kwargs['version'] = get_version()
    packages = kwargs.setdefault('packages',
                                 find_packages(exclude=[__name__ + '.*']))
    install_requires = kwargs.setdefault('install_requires', [])
    for yc_module in kwargs.pop('yc_requires', []):
        packages.append(get_package(yc_module))
        for dep in get_dependencies(yc_module):
            if dep not in install_requires:
                install_requires.append(dep)
    cmdclass = kwargs.setdefault('cmdclass', {})
    cmdclass.setdefault('release', release)
    return _setup(**kwargs)
Esempio n. 18
0
def setup(**kwargs):
    if 'version' not in kwargs:
        kwargs['version'] = get_version()
    packages = kwargs.setdefault('packages',
                                 find_packages(exclude=[__name__ + '.*']))
    install_requires = kwargs.setdefault('install_requires', [])
    for yc_module in kwargs.pop('yc_requires', []):
        packages.append(get_package(yc_module))
        for dep in get_dependencies(yc_module):
            if dep not in install_requires:
                install_requires.append(dep)
    cmdclass = kwargs.setdefault('cmdclass', {})
    cmdclass.setdefault('release', release)
    return _setup(**kwargs)
Esempio n. 19
0
def setup():
    scripts = [os.path.join('scripts', f) for f in os.listdir('scripts')]
    scripts = [s for s in scripts if (os.name == 'nt' and s.endswith('.bat'))
                                     or (os.name != 'nt' and
                                         not s.endswith('.bat'))]
    packages = ['pyne', 'pyne.dbgen', 'pyne.apigen', 'pyne.xs',
                'pyne.transmute', 'pyne.gui', 'pyne.cli']
    pack_dir = {
        'pyne': 'pyne',
        'pyne.xs': 'pyne/xs',
        'pyne.gui': 'pyne/gui',
        'pyne.cli': 'pyne/cli',
        'pyne.dbgen': 'pyne/dbgen',
        'pyne.apigen': 'pyne/apigen',
        'pyne.transmute': 'pyne/transmute',
        }
    extpttn = ['*.dll', '*.so', '*.dylib', '*.pyd', '*.pyo']
    pack_data = {
        'lib': extpttn,
        'pyne': ['*.pxd', 'include/*.h', 'include/*.pxi', 'include/*/*.h',
                 '*.inp', 'include/*/*/*.h', 'include/*/*/*/*.h', '*.json',
                 '_includes/*.txt', '_includes/*.pxd', '_includes/*/*',
                 '_includes/*/*/*'] + extpttn,
        'pyne.xs': ['*.pxd'] + extpttn,
        'pyne.gui': ['*.pyw'],
        'pyne.dbgen': ['*.html', '*.csv', 'abundances.txt', 'mass.mas12'],
        }
    libpynes = set()
    for ext in extpttn:
        libpynes |= set(glob('src/' + ext))
    data_files = [
        ('lib', libpynes),
        ('include/pyne', glob('../src/*.h')),
        ]
    setup_kwargs = {
        "name": "pyne",
        "version": VERSION,
        "description": 'The Nuclear Engineering Toolkit',
        "author": 'PyNE Development Team',
        "author_email": '*****@*****.**',
        "url": 'http://pyne.github.com/',
        "packages": packages,
        "package_dir": pack_dir,
        "package_data": pack_data,
        "data_files": data_files,
        "scripts": scripts,
        #"zip_safe": False,
        }
    rtn = _setup(**setup_kwargs)
Esempio n. 20
0
def setup(**kwargs):
    if 'requires_java' in kwargs:
        requires_java(kwargs.pop('requires_java'))

    if 'pom' in kwargs:
        dist_pom = kwargs.pop('pom')

    if 'cmdclass' not in kwargs:
        kwargs['cmdclass'] = {}

    if 'install' not in kwargs['cmdclass']:
        ## add install command if user doesn't define custom one
        kwargs['cmdclass']['install'] = install
    if 'resolve' not in kwargs['cmdclass']:
        ## add resolve command
        kwargs['cmdclass']['resolve'] = resolve

    return _setup(**kwargs)
Esempio n. 21
0
File: dist.py Progetto: adorsk/jip
def setup(**kwargs):
    if 'requires_java' in kwargs:
        requires_java(kwargs.pop('requires_java'))

    if 'pom' in kwargs:
        dist_pom = kwargs.pop('pom')

    if 'cmdclass' not in kwargs:
        kwargs['cmdclass'] = {}

    if 'install' not in kwargs['cmdclass']:
        ## add install command if user doesn't define custom one
        kwargs['cmdclass']['install'] = install
    if 'resolve' not in kwargs['cmdclass']:
        ## add resolve command        
        kwargs['cmdclass']['resolve'] = resolve

    return _setup(**kwargs)
Esempio n. 22
0
def setup(*args, **kwargs):
    """
    Drop-in replacement for setuptools.setup(). See documentation for setuptools.setup() for full
    documentation of the accepted arguments.
    """

    # See https://pythonhosted.org/setuptools/setuptools.html#new-and-changed-setup-keywords for a
    # list of keywords accepted by setuptools.setup(). See
    # https://docs.python.org/3.4/distutils/apiref.html for additional keywords accepted by
    # distutils.core.setup() and for the most part also accepted by setuptools.setup().

    # This is just to eliminate warnings generated from using ** magic with infotags.get_info(...)
    if 'doc' in kwargs:
        del kwargs['doc']

    package_name = kwargs['name']
    verify_type(package_name, str, non_empty=True)

    # Get the cmdclass (command class) argument from the keyword args.
    if 'cmdclass' in kwargs:
        cmdclass = kwargs['cmdclass']
        verify_type(cmdclass, dict)
    else:
        cmdclass = {}
        kwargs['cmdclass'] = cmdclass

    # If a install command class has not been set, set it to ours. If it has already been set,
    # assume the user knows what they're doing.
    if 'install' not in cmdclass:
        cmdclass['install'] = install

    # If the py_modules and packages arguments do not appear in the keyword args, use
    # find_packages() to locate them.
    if not ('py_modules' in kwargs or 'packages' in kwargs):
        kwargs['packages'] = find_packages()

    return _setup(*args, **kwargs)
Esempio n. 23
0
def setup(add_etc=True, **kwargs):
    """
    Setup dedicated to canolibs projects.

    :param add_etc: add automatically etc files (default True)
    :type add_etc: bool

    :param kwargs: enrich setuptools.setup method
    """

    # get setup path which corresponds to first python argument
    filename = argv[0]

    _path = dirname(abspath(expanduser(filename)))
    name = basename(_path)

    # add path to python path
    path.append(_path)

    # extend canopsis path with new sub modules and packages
    # canopsis.__path__ = extend_path(canopsis.__path__, canopsis.__name__)

    # get package
    package = lookup("canopsis.{0}".format(name))

    # set default parameters if not setted
    kwargs.setdefault('name', package.__name__)
    kwargs.setdefault('author', AUTHOR)
    kwargs.setdefault('author_email', AUTHOR_EMAIL)
    kwargs.setdefault('license', LICENSE)
    kwargs.setdefault('zip_safe', ZIP_SAFE)
    kwargs.setdefault('url', URL)
    kwargs.setdefault('package_dir', {'': _path})

    kwargs.setdefault('keywords', kwargs.get('keywords', '') + KEYWORDS)

    # set version
    version = getattr(package, '__version__', DEFAULT_VERSION)
    if version is not None:
        kwargs.setdefault('version', version)

    if '--no-conf' not in argv:
        # add etc content if exist and if --no-conf
        if add_etc:
            etc_path = join(_path, 'etc')

            if exists(etc_path):
                data_files = kwargs.get('data_files', [])
                target = getenv('CPS_PREFIX', join(sys_prefix, 'etc'))

                for root, dirs, files in walk(etc_path):
                    files_to_copy = [join(root, _file) for _file in files]
                    final_target = join(target, root[len(etc_path) + 1:])
                    data_files.append((final_target, files_to_copy))
                kwargs['data_files'] = data_files

    else:
        argv.remove('--no-conf')

    # add scripts if exist
    if 'scripts' not in kwargs:
        scripts_path = join(_path, 'scripts')
        if exists(scripts_path):
            scripts = []
            for root, dirs, files in walk(scripts_path):
                for _file in files:
                    scripts.append(join(root, _file))
            kwargs['scripts'] = scripts

    # add packages
    if 'packages' not in kwargs:
        packages = find_packages(where=_path, exclude=TEST_FOLDERS)
        kwargs['packages'] = packages

    # add description
    if 'long_description' not in kwargs:
        readme_path = join(_path, 'README')
        if exists(readme_path):
            with open(join(_path, 'README')) as f:
                kwargs['long_description'] = f.read()

    # add test
    if 'test_suite' not in kwargs:
        test_folders = \
            [folder for folder in TEST_FOLDERS if exists(join(_path, folder))]
        if test_folders:
            for test_folder in test_folders:
                kwargs['test_suite'] = test_folder
                break

    _setup(**kwargs)
Esempio n. 24
0
def setup(min_os_level=None, max_os_level=None, cmdclass=None, **kwds):

    k = kwds.copy()
    k.update(extra_args)

    os_level = get_os_level()
    os_compatible = True
    if sys.platform != 'darwin':
        os_compatible = False

    else:
        if min_os_level is not None:
            if os_level < min_os_level:
                os_compatible = False
        if max_os_level is not None:
            if os_level > max_os_level:
                os_compatible = False

    if cmdclass is None:
        cmdclass = {}
    else:
        cmdclass = cmdclass.copy()

    if not os_compatible:

        def create_command_subclass(base_class):
            if min_os_level != None:
                if max_os_level != None:
                    msg = "This distribution is only supported on MacOSX versions %s upto and including %s" % (
                        min_os_level, max_os_level)
                else:
                    msg = "This distribution is only support on MacOSX >= %s" % (
                        min_os_level, )
            elif max_os_level != None:
                msg = "This distribution is only support on MacOSX <= %s" % (
                    max_os_level, )
            else:
                msg = "This distribution is only support on MacOSX"

            class subcommand(base_class):
                def run(self):
                    raise DistutilsPlatformError(msg)

            return subcommand

        cmdclass['build'] = create_command_subclass(build.build)
        cmdclass['test'] = create_command_subclass(oc_test)
        cmdclass['install'] = create_command_subclass(pyobjc_install_lib)
        cmdclass['develop'] = create_command_subclass(develop.develop)
        cmdclass['build_py'] = create_command_subclass(oc_build_py)
    else:
        cmdclass['build_ext'] = pyobjc_build_ext
        cmdclass['install_lib'] = pyobjc_install_lib
        cmdclass['test'] = oc_test
        cmdclass['build_py'] = oc_build_py

    _setup(cmdclass=cmdclass,
           long_description=__main__.__doc__,
           author='Ronald Oussoren',
           author_email='*****@*****.**',
           url='http://pyobjc.sourceforge.net',
           platforms=["MacOS X"],
           package_dir={
               '': 'Lib',
               'PyObjCTest': 'PyObjCTest'
           },
           dependency_links=[],
           package_data={'': ['*.bridgesupport']},
           test_suite='PyObjCTest',
           zip_safe=False,
           **k)
Esempio n. 25
0
def setup(
        min_os_level=None,
        max_os_level=None,
        cmdclass=None,
        **kwds):


    k = kwds.copy()

    os_level = get_sdk_level()
    if os_level is None:
        os_level = get_os_level()
    os_compatible = True
    if sys.platform != 'darwin':
        os_compatible = False

    else:
        if min_os_level is not None:
            if _sort_key(os_level) < _sort_key(min_os_level):
                os_compatible = False
        if max_os_level is not None:
            if _sort_key(os_level) > _sort_key(max_os_level):
                os_compatible = False

    if cmdclass is None:
        cmdclass = {}
    else:
        cmdclass = cmdclass.copy()

    if os_compatible or ('bdist_wheel' in sys.argv and 'ext_modules' not in k):
        cmdclass['build_ext'] = pyobjc_build_ext
        cmdclass['egg_info'] = oc_egg_info
        cmdclass['install_lib'] = pyobjc_install_lib
        cmdclass['test'] = oc_test
        cmdclass['build_py'] = oc_build_py

    else:
        if min_os_level != None:
            if max_os_level != None:
                msg = "This distribution is only supported on MacOSX versions %s upto and including %s"%(
                        min_os_level, max_os_level)
            else:
                msg = "This distribution is only supported on MacOSX >= %s"%(min_os_level,)
        elif max_os_level != None:
            msg = "This distribution is only supported on MacOSX <= %s"%(max_os_level,)
        else:
            msg = "This distribution is only supported on MacOSX"

        def create_command_subclass(base_class):

            class subcommand (base_class):
                def run(self, msg=msg):
                    raise DistutilsPlatformError(msg)

            return subcommand

        class no_test (oc_test):
            def run(self, msg=msg):
                print("WARNING: %s\n"%(msg,))
                print("SUMMARY: {'testSeconds': 0.0, 'count': 0, 'fails': 0, 'errors': 0, 'xfails': 0, 'skip': 65, 'xpass': 0, 'message': %r }"%(msg,))

        cmdclass['build'] = create_command_subclass(build.build)
        cmdclass['test'] = no_test
        cmdclass['install'] = create_command_subclass(install.install)
        cmdclass['install_lib'] = create_command_subclass(pyobjc_install_lib)
        cmdclass['develop'] = create_command_subclass(develop.develop)
        cmdclass['build_py'] = create_command_subclass(oc_build_py)

    if 'ext_modules' not in k:
        # No extension modules, can build universal wheel
        k['options'] = {
            'bdist_wheel': {
                'universal': 1,
            }
        }

    plat_name = "MacOS X"
    plat_versions = []
    if min_os_level is not None and min_os_level == max_os_level:
        plat_versions.append("==%s"%(min_os_level,))
    else:
        if min_os_level is not None:
            plat_versions.append(">=%s"%(min_os_level,))
        if max_os_level is not None:
            plat_versions.append("<=%s"%(max_os_level,))
    if plat_versions:
        plat_name += " (%s)"%(", ".join(plat_versions),)

    if os.path.isfile('Modules/pyobjc-api.h') or 'ext_modules' not in k:
        if 'setup_requires' in k:
            if len(k['setup_requires']) == 1 and k['setup_requires'][0].startswith('pyobjc-core'):
                del k['setup_requires']

    if 'long_description' in k:
        k['long_description'] += "\n\nProject links\n"
        k['long_description'] += "-------------\n"
        k['long_description'] += "\n"
        k['long_description'] += "* `Documentation <https://%s.readthedocs.io/en/latest/>`_\n\n" % (REPO_NAME,)
        k['long_description'] += "* `Issue Tracker <https://bitbucket.org/ronaldoussoren/%s/issues?status=new&status=open>`_\n\n" % (REPO_NAME,)
        k['long_description'] += "* `Repository <https://bitbucket.org/ronaldoussoren/%s/>`_\n\n" % (REPO_NAME,)
        k['long_description_content_type'] = 'text/x-rst; charset=UTF-8'

    _setup(
        cmdclass=cmdclass,
        author='Ronald Oussoren',
        author_email='*****@*****.**',
        url='https://bitbucket.org/ronaldoussoren/pyobjc',
        platforms = [ plat_name ],
        package_dir = { '': 'Lib', 'PyObjCTest': 'PyObjCTest' },
        dependency_links = [],
        package_data = { '': ['*.bridgesupport'] },
        test_suite='PyObjCTest',
        zip_safe = False,
        license = 'MIT License',
        classifiers = CLASSIFIERS,
        keywords = ["PyObjC"] + [ p for p in k['packages'] if p not in ('PyObjCTools',)],
        **k
    )
Esempio n. 26
0
}

ENTRY_POINTS = {
    'console_scripts':
    ['{} = {}'.format(name, funcpath) for name, funcpath in COMMANDS.items()],
    'rdf.plugins.store': ('rdb2rdf_dm = rdb2rdf.stores:DirectMapping', ),
}

if __name__ == '__main__':
    _setup(name=NAME,
           version=VERSION,
           url=SITE_URI,
           download_url=DOWNLOAD_URI,
           description=DESCRIPTION,
           long_description=LONG_DESCRIPTION,
           author=', '.join(__credits__),
           maintainer=__maintainer__,
           maintainer_email=__email__,
           license=LICENSE,
           classifiers=TROVE_CLASSIFIERS,
           setup_requires=SETUP_DEPS,
           install_requires=INSTALL_DEPS,
           extras_require=EXTRAS_DEPS,
           tests_require=TESTS_DEPS,
           dependency_links=DEPS_SEARCH_URIS,
           namespace_packages=NAMESPACE_PKGS_NAMES,
           packages=_find_packages(),
           test_suite=TESTS_PKG_NAME,
           include_package_data=True,
           entry_points=ENTRY_POINTS)
Esempio n. 27
0
def setup(
        min_os_level=None,
        max_os_level=None,
        cmdclass=None,
        **kwds):


    k = kwds.copy()

    os_level = get_os_level()
    os_compatible = True
    if sys.platform != 'darwin':
        os_compatible = False

    else:
        if min_os_level is not None:
            if _sort_key(os_level) < _sort_key(min_os_level):
                os_compatible = False
        if max_os_level is not None:
            if _sort_key(os_level) > _sort_key(max_os_level):
                os_compatible = False

    if cmdclass is None:
        cmdclass = {}
    else:
        cmdclass = cmdclass.copy()

    if not os_compatible:
        if min_os_level != None:
            if max_os_level != None:
                msg = "This distribution is only supported on MacOSX versions %s upto and including %s"%(
                        min_os_level, max_os_level)
            else:
                msg = "This distribution is only supported on MacOSX >= %s"%(min_os_level,)
        elif max_os_level != None:
            msg = "This distribution is only supported on MacOSX <= %s"%(max_os_level,)
        else:
            msg = "This distribution is only supported on MacOSX"

        def create_command_subclass(base_class):

            class subcommand (base_class):
                def run(self, msg=msg):
                    raise DistutilsPlatformError(msg)

            return subcommand

        class no_test (oc_test):
            def run(self, msg=msg):
                print("WARNING: %s\n"%(msg,))
                print("SUMMARY: {'count': 0, 'fails': 0, 'errors': 0, 'xfails': 0, 'skip': 65, 'xpass': 0, 'message': %r }"%(msg,))

        cmdclass['build'] = create_command_subclass(build.build)
        cmdclass['test'] = no_test
        cmdclass['install'] = create_command_subclass(install.install)
        cmdclass['install_lib'] = create_command_subclass(pyobjc_install_lib)
        cmdclass['develop'] = create_command_subclass(develop.develop)
        cmdclass['build_py'] = create_command_subclass(oc_build_py)
    else:
        cmdclass['build_ext'] = pyobjc_build_ext
        cmdclass['install_lib'] = pyobjc_install_lib
        cmdclass['test'] = oc_test
        cmdclass['build_py'] = oc_build_py

    plat_name = "MacOS X"
    plat_versions = []
    if min_os_level is not None and min_os_level == max_os_level:
        plat_versions.append("==%s"%(min_os_level,))
    else:
        if min_os_level is not None:
            plat_versions.append(">=%s"%(min_os_level,))
        if max_os_level is not None:
            plat_versions.append("<=%s"%(max_os_level,))
    if plat_versions:
        plat_name += " (%s)"%(", ".join(plat_versions),)

    _setup(
        cmdclass=cmdclass,
        author='Ronald Oussoren',
        author_email='*****@*****.**',
        url='http://pyobjc.sourceforge.net',
        platforms = [ plat_name ],
        package_dir = { '': 'Lib', 'PyObjCTest': 'PyObjCTest' },
        dependency_links = [],
        package_data = { '': ['*.bridgesupport'] },
        test_suite='PyObjCTest',
        zip_safe = False,
        license = 'MIT License',
        classifiers = CLASSIFIERS,
        keywords = ["PyObjC"] + [ p for p in k['packages'] if p not in ('PyObjCTools',)],
        **k
    )
Esempio n. 28
0
#!/usr/bin/env python
try:
    from setuptools import setup as _setup
except ImportError:
    from ez_setup import use_setuptools
    use_setuptools()
    from setuptools import setup as _setup

# setup.cfg basically installs itself!  See setup.cfg for the project metadata.
import setup.cfg


_setup(**setup.cfg.to_setup())
Esempio n. 29
0
def setup():
    from setuptools import setup as _setup
    from setuptools import find_packages
    SETUP_INFO['packages'] = find_packages('src')
    _setup(**SETUP_INFO)
Esempio n. 30
0
 def run(self):
     # assemble all the pieces and make it work
     _setup(**self.setup_kwargs)
Esempio n. 31
0
 def setup(*args, **kwargs):
     for a in py3_args:
         if a in kwargs:
             del kwargs[a]
     return _setup(*args, **kwargs)
Esempio n. 32
0
 def setup(*args, **kwargs):
     kwargs.setdefault('distclass', Distribution)
     cmdclass = kwargs.setdefault('cmdclass', {})
     cmdclass.setdefault('build_tests', BuildTestsCommand)
     cmdclass.setdefault('test', TestCommand)
     return _setup(*args, **kwargs)
Esempio n. 33
0
def setup(**kwargs):
    """Run setuptools.setup() after setting up its commands for CMake build

    It accepts most of setuptools.setup() arguments with additional arguments
    to configure CMake build. Also, it may overwrite user-provided setuptools
    arguments in order to integrate CMake.

    CMake Keyward Arguments
    -----------------------
    cmake_path : str
        path to cmake command (default auto-detected)
    src_dir : str
        Source directory (default "src")
    ext_module_dirs : str[]
        List of source directories defining external modules
    ext_module_hint : str 
        Regex pattern to auto-detect external module directories
    test_dir : str
        Unit test directory (default "tests")
    test_submodules : str[]
        List of git submodules only used for testing
    has_package_data : bool
        Set False if project has no package_data (default True)
    skip_configure : bool
        Set True to configure cmake externally (default False)
    config : str
        Default CMake build type (default "Release")
    generator : str
        Default CMake --G argument
    platform : str
        Default CMake --platform argument
    toolset : str
        Default CMake --toolset argument
    parallel : int > 0
        Default CMake --parallel argument
    configure_opts : str[]
        List of other default option arguments for CMake configure 
    build_opts : str[]
        List of other default option arguments for CMake build
    install_opts : str[]
        List of other default option arguments for CMake install

    Overriden setuptools arguments
    ------------------------------
    cmdclass (partial override, affecting egg_info, build_py, 
              build_ext, sdist, and install_data commands)
    data_files
    ext_modules
    package_dir
    package_data
    packages

    """

    # supported keyword arguments to CMakeBuilder constructor
    cmake_keys = (
        "src_dir",
        "test_dir",
        "test_submodules",
        "ext_module_dirs",
        "ext_module_hint",
        "has_package_data",
        "skip_configure",
        "config",
        "generator",
        "toolset",
        "platform",
        "configure_opts",
        "build_opts",
        "install_opts",
    )

    # split kwargs into CMakeBuilder arguments and setup arguments
    given_keys = kwargs.keys()
    cmake_args = {key: kwargs[key] for key in given_keys & cmake_keys}
    setup_args = {key: kwargs[key] for key in given_keys - cmake_keys}

    # instantiate CMakeBuilder using its option arguments
    cmake = CMakeBuilder(**cmake_args)

    # create
    setup_args["packages"] = cmake.find_packages()
    setup_args["ext_modules"] = cmake.find_ext_modules()
    setup_args["data_files"] = cmake.get_setup_data_files()
    setup_args["cmdclass"] = {
        **(setup_args["cmdclass"] if "cmdclass" in setup_args else {}),
        **generate_cmdclass(cmake),
    }
    _setup(**setup_args)
Esempio n. 34
0
def setup(*args, **kwargs):
    asapso = Extension(name="%s._%s" % (kwargs['name'], kwargs['name']),
                       sources=[])
    d = {'ext_modules': [asapso], 'cmdclass': {'build_ext': scons_ext}}
    kwargs.update(d)
    _setup(*args, **kwargs)
Esempio n. 35
0
def setup(
        min_os_level=None,
        max_os_level=None,
        cmdclass=None,
        **kwds):


    k = kwds.copy()
    k.update(extra_args)

    os_level = get_os_level()
    os_compatible = True
    if sys.platform != 'darwin':
        os_compatible = False

    else:
        if min_os_level is not None:
            if os_level < min_os_level:
                os_compatible = False
        if max_os_level is not None:
            if os_level > max_os_level:
                os_compatible = False

    if cmdclass is None:
        cmdclass = {}
    else:
        cmdclass = cmdclass.copy()

    if not os_compatible:
        def create_command_subclass(base_class):
            if min_os_level != None:
                if max_os_level != None:
                    msg = "This distribution is only supported on MacOSX versions %s upto and including %s"%(
                            min_os_level, max_os_level)
                else:
                    msg = "This distribution is only support on MacOSX >= %s"%(min_os_level,)
            elif max_os_level != None:
                    msg = "This distribution is only support on MacOSX <= %s"%(max_os_level,)
            else:
                    msg = "This distribution is only support on MacOSX"

            class subcommand (base_class):
                def run(self):
                    raise DistutilsPlatformError(msg)

            return subcommand

        cmdclass['build'] = create_command_subclass(build.build)
        cmdclass['test'] = create_command_subclass(oc_test)
        cmdclass['install'] = create_command_subclass(pyobjc_install_lib)
        cmdclass['develop'] = create_command_subclass(develop.develop)
        cmdclass['build_py'] = create_command_subclass(oc_build_py)
    else:
        cmdclass['build_ext'] = pyobjc_build_ext
        cmdclass['install_lib'] = pyobjc_install_lib
        cmdclass['test'] = oc_test
        cmdclass['build_py'] = oc_build_py



    _setup(
        cmdclass=cmdclass, 
        long_description=__main__.__doc__,
        author='Ronald Oussoren',
        author_email='*****@*****.**',
        url='http://pyobjc.sourceforge.net',
        platforms = [ "MacOS X" ],
        package_dir = { '': 'Lib', 'PyObjCTest': 'PyObjCTest' },
        dependency_links = [],
        package_data = { '': ['*.bridgesupport'] },
        test_suite='PyObjCTest',
        zip_safe = False,
        **k
    ) 
Esempio n. 36
0
def setup(**kwargs):
    """
    Call the regular `setuptools.setup` function with data read from
    our setup.cfg file.

    Parameters
    ----------
    kwargs : arguments dictionary
        Override any of the default `setuptools.setup` keyword arguments.

    """
    # Setup all our packaging config
    config.setup_org_config(kwargs.get('org_config'))

    set_working_dir()
    # Base set of defaults
    call_args = dict(
        name='',
        version='',
        description='',
        long_description='',
        keywords='',
        author='',
        author_email='',
        url='',
        setup_requires=[],
        install_requires=[],
        tests_require=[],
        license='Proprietary',
        classifiers=[],
        entry_points={},
        scripts=[],
        ext_modules=[],
        packages=find_packages(exclude=['test*']),
        include_package_data=True,
        zip_safe=False,
        namespace_packages=[],
        cmdclass={
          'develop': develop.develop,
          'egg_info': egg_info.egg_info,
          'jenkins': jenkins.jenkins,
          'update': update.update,
          'depgraph': depgraph.depgraph,
          'pyinstall': pyinstall.pyinstall,
          'build_sphinx': build_sphinx.build_sphinx,
          'build_ext': build_ext.build_ext,
          'build_ext_static_interpreter': build_ext_static_interpreter.build_ext_static_interpreter,
          'ext_gcov_test': ext_gcov_test.ext_gcov_test,
          'test_egg': test_egg.test_egg,
          'upload': upload.upload,
          'register': register.register,
          'upload_docs': upload_docs.upload_docs,
          'deploy': deploy.deploy,
          'cleanup': cleanup.cleanup,
          'tidy': tidy.tidy,
          'release_externals': release_externals.release_externals,
          # Uninstall synonyms
          'uninstall': pyuninstall.pyuninstall,
          'remove': pyuninstall.pyuninstall,
          # Test synonyms
          'test': test.test,
          'nosetests': test.test,
          'pytest': test.test,
    })

    # Get the package metadata from the setup.cfg file
    metadata = config.parse_pkg_metadata(config.get_pkg_cfg_parser())

    # Determine namespace packages based off of the name
    call_args['namespace_packages'] = get_namespace_packages(metadata['name'])

    # Update the long description based off of README,CHANGES etc.
    metadata['long_description'] = get_pkg_description(metadata)

    # Overrides from setup.cfg file. console_scripts is a bit special in this regards as
    # it lives under entry_points
    call_args.update(metadata)
    if 'console_scripts' in call_args:
        call_args['entry_points']['console_scripts'] = call_args['console_scripts']
        del(call_args['console_scripts'])

    # Overrides/Updates from call arguments. Override for scalar, update for dict.
    for k, v in kwargs.items():
        if type(v) is dict and k in call_args:
            call_args[k].update(v)
        else:
            call_args[k] = v

    if 'install_requires' in call_args:
        call_args['install_requires'] = clean_requires(call_args['install_requires'])

    # Call base setup method, retrieve distribution
    dist = _setup(**call_args)

    # Check if we've set a failed flag this may be due to a failed upload.
    if hasattr(dist, '_failed') and dist._failed:
        raise SystemExit(1)
Esempio n. 37
0
 def setup(*args, **kwargs):
     for a in py3_args:
         if a in kwargs:
             del kwargs[a]
     return _setup(*args, **kwargs)
Esempio n. 38
0
def setup(min_os_level=None, max_os_level=None, cmdclass=None, **kwds):

    k = kwds.copy()

    os_level = get_os_level()
    os_compatible = True
    if sys.platform != "darwin":
        os_compatible = False

    else:
        if min_os_level is not None:
            if os_level < min_os_level:
                os_compatible = False
        if max_os_level is not None:
            if os_level > max_os_level:
                os_compatible = False

    if cmdclass is None:
        cmdclass = {}
    else:
        cmdclass = cmdclass.copy()

    if not os_compatible:
        if min_os_level != None:
            if max_os_level != None:
                msg = "This distribution is only supported on MacOSX versions %s upto and including %s" % (
                    min_os_level,
                    max_os_level,
                )
            else:
                msg = "This distribution is only supported on MacOSX >= %s" % (min_os_level,)
        elif max_os_level != None:
            msg = "This distribution is only supported on MacOSX <= %s" % (max_os_level,)
        else:
            msg = "This distribution is only supported on MacOSX"

        def create_command_subclass(base_class):
            class subcommand(base_class):
                def run(self):
                    raise DistutilsPlatformError(msg)

            return subcommand

        class no_test(oc_test):
            def run(self):
                print("WARNING: %s\n" % (msg,))
                print(
                    "SUMMARY: {'count': 0, 'fails': 0, 'errors': 0, 'xfails': 0, 'skip': 65, 'xpass': 0, 'message': msg }\n"
                )

        cmdclass["build"] = create_command_subclass(build.build)
        cmdclass["test"] = no_test
        cmdclass["install"] = create_command_subclass(install.install)
        cmdclass["install_lib"] = create_command_subclass(pyobjc_install_lib)
        cmdclass["develop"] = create_command_subclass(develop.develop)
        cmdclass["build_py"] = create_command_subclass(oc_build_py)
    else:
        cmdclass["build_ext"] = pyobjc_build_ext
        cmdclass["install_lib"] = pyobjc_install_lib
        cmdclass["test"] = oc_test
        cmdclass["build_py"] = oc_build_py

    plat_name = "MacOS X"
    plat_versions = []
    if min_os_level is not None and min_os_level == max_os_level:
        plat_versions.append("==%s" % (min_os_level,))
    else:
        if min_os_level is not None:
            plat_versions.append(">=%s" % (min_os_level,))
        if max_os_level is not None:
            plat_versions.append("<=%s" % (max_os_level,))
    if plat_versions:
        plat_name += " (%s)" % (", ".join(plat_versions),)

    _setup(
        cmdclass=cmdclass,
        long_description=__main__.__doc__,
        author="Ronald Oussoren",
        author_email="*****@*****.**",
        url="http://pyobjc.sourceforge.net",
        platforms=[plat_name],
        package_dir={"": "Lib", "PyObjCTest": "PyObjCTest"},
        package_data={"": ["*.bridgesupport"]},
        test_suite="PyObjCTest",
        zip_safe=False,
        license="MIT License",
        classifiers=CLASSIFIERS,
        **k
    )
Esempio n. 39
0
                                   'main' if isinstance(script, basestring)
                                          else script[1])
            for cmd, script in STD_SCRIPTS_PKG_COMMANDS.items()}

ENTRY_POINTS = {'console_scripts': ['{} = {}'.format(name, funcpath)
                                    for name, funcpath in COMMANDS.items()]}


if __name__ == '__main__':
    _setup(name=NAME,
           version=VERSION,
           url=SITE_URI,
           download_url=DOWNLOAD_URI,
           description=DESCRIPTION,
           long_description=LONG_DESCRIPTION,
           author=', '.join(__credits__),
           maintainer=__maintainer__,
           maintainer_email=__email__,
           license=LICENSE,
           classifiers=TROVE_CLASSIFIERS,
           setup_requires=SETUP_DEPS,
           install_requires=INSTALL_DEPS,
           extras_require=EXTRAS_DEPS,
           tests_require=TESTS_DEPS,
           dependency_links=DEPS_SEARCH_URIS,
           namespace_packages=NAMESPACE_PKGS,
           packages=_find_packages(),
           test_suite=TESTS_PKG,
           include_package_data=True,
           entry_points=ENTRY_POINTS)
Esempio n. 40
0
 def setup(*args, **kwargs):
     kwargs.setdefault('distclass', Distribution)
     cmdclass = kwargs.setdefault('cmdclass', {})
     cmdclass.setdefault('build_tests', BuildTestsCommand)
     cmdclass.setdefault('test', TestCommand)
     return _setup(*args, **kwargs)
Esempio n. 41
0
def setup(min_os_level=None, max_os_level=None, cmdclass=None, **kwds):

    k = kwds.copy()

    os_level = get_os_level()
    os_compatible = True
    if sys.platform != 'darwin':
        os_compatible = False

    else:
        if min_os_level is not None:
            if os_level < tuple(map(int, min_os_level.split('.'))):
                os_compatible = False
        if max_os_level is not None:
            if os_level > tuple(map(int, max_os_level.split('.'))):
                os_compatible = False

    if cmdclass is None:
        cmdclass = {}
    else:
        cmdclass = cmdclass.copy()

    if not os_compatible:
        if min_os_level != None:
            if max_os_level != None:
                msg = "This distribution is only supported on MacOSX versions %s upto and including %s" % (
                    min_os_level, max_os_level)
            else:
                msg = "This distribution is only supported on MacOSX >= %s" % (
                    min_os_level, )
        elif max_os_level != None:
            msg = "This distribution is only supported on MacOSX <= %s" % (
                max_os_level, )
        else:
            msg = "This distribution is only supported on MacOSX"

        def create_command_subclass(base_class):
            class subcommand(base_class):
                def run(self):
                    raise DistutilsPlatformError(msg)

            return subcommand

        class no_test(oc_test):
            def run(self):
                print("WARNING: %s\n" % (msg, ))
                print(
                    "SUMMARY: {'count': 0, 'fails': 0, 'errors': 0, 'xfails': 0, 'skip': 65, 'xpass': 0, 'message': msg }\n"
                )

        cmdclass['build'] = create_command_subclass(build.build)
        cmdclass['test'] = no_test
        cmdclass['install'] = create_command_subclass(install.install)
        cmdclass['install_lib'] = create_command_subclass(pyobjc_install_lib)
        cmdclass['develop'] = create_command_subclass(develop.develop)
        cmdclass['build_py'] = create_command_subclass(oc_build_py)
    else:
        cmdclass['build_ext'] = pyobjc_build_ext
        cmdclass['install_lib'] = pyobjc_install_lib
        cmdclass['test'] = oc_test
        cmdclass['build_py'] = oc_build_py

    plat_name = "MacOS X"
    plat_versions = []
    if min_os_level is not None and min_os_level == max_os_level:
        plat_versions.append("==%s" % (min_os_level, ))
    else:
        if min_os_level is not None:
            plat_versions.append(">=%s" % (min_os_level, ))
        if max_os_level is not None:
            plat_versions.append("<=%s" % (max_os_level, ))
    if plat_versions:
        plat_name += " (%s)" % (", ".join(plat_versions), )

    _setup(cmdclass=cmdclass,
           long_description=__main__.__doc__,
           author='Ronald Oussoren',
           author_email='*****@*****.**',
           url='http://pyobjc.sourceforge.net',
           platforms=[plat_name],
           package_dir={
               '': 'Lib',
               'PyObjCTest': 'PyObjCTest'
           },
           dependency_links=[],
           package_data={'': ['*.bridgesupport']},
           test_suite='PyObjCTest',
           zip_safe=False,
           license='MIT License',
           classifiers=CLASSIFIERS,
           **k)
Esempio n. 42
0
def setup(min_os_level=None, max_os_level=None, cmdclass=None, **kwds):

    k = kwds.copy()

    os_level = get_sdk_level()
    if os_level is None:
        os_level = get_os_level()
    os_compatible = True
    if sys.platform != "darwin":
        os_compatible = False

    else:
        if min_os_level is not None:
            if _sort_key(os_level) < _sort_key(min_os_level):
                os_compatible = False
        if max_os_level is not None:
            if _sort_key(os_level) > _sort_key(max_os_level):
                os_compatible = False

    if cmdclass is None:
        cmdclass = {}
    else:
        cmdclass = cmdclass.copy()

    if os_compatible or ("bdist_wheel" in sys.argv and "ext_modules" not in k):
        cmdclass["build_ext"] = pyobjc_build_ext
        cmdclass["egg_info"] = oc_egg_info
        cmdclass["install_lib"] = pyobjc_install_lib
        cmdclass["test"] = oc_test
        cmdclass["build_py"] = oc_build_py

    else:
        if min_os_level is not None:
            if max_os_level is not None:
                msg = ("This distribution is only supported on MacOSX "
                       "versions %s upto and including %s" %
                       (min_os_level, max_os_level))
            else:
                msg = "This distribution is only supported on MacOSX >= %s" % (
                    min_os_level, )
        elif max_os_level is not None:
            msg = "This distribution is only supported on MacOSX <= %s" % (
                max_os_level, )
        else:
            msg = "This distribution is only supported on MacOSX"

        def create_command_subclass(base_class):
            class subcommand(base_class):
                def run(self, msg=msg):
                    raise DistutilsPlatformError(msg)

            return subcommand

        class no_test(oc_test):
            def run(self, msg=msg):
                print("WARNING: %s\n" % (msg, ))
                print("SUMMARY: {'testSeconds': 0.0, 'count': 0, 'fails': 0, "
                      "'errors': 0, 'xfails': 0, 'skip': 65, 'xpass': 0, "
                      "'message': %r }" % (msg, ))

        cmdclass["build"] = create_command_subclass(build.build)
        cmdclass["test"] = no_test
        cmdclass["install"] = create_command_subclass(install.install)
        cmdclass["install_lib"] = create_command_subclass(pyobjc_install_lib)
        cmdclass["develop"] = create_command_subclass(develop.develop)
        cmdclass["build_py"] = create_command_subclass(oc_build_py)

    if "ext_modules" not in k:
        # No extension modules, can build universal wheel
        k["options"] = {"bdist_wheel": {"universal": 1}}

    plat_name = "MacOS X"
    plat_versions = []
    if min_os_level is not None and min_os_level == max_os_level:
        plat_versions.append("==%s" % (min_os_level, ))
    else:
        if min_os_level is not None:
            plat_versions.append(">=%s" % (min_os_level, ))
        if max_os_level is not None:
            plat_versions.append("<=%s" % (max_os_level, ))
    if plat_versions:
        plat_name += " (%s)" % (", ".join(plat_versions), )

    if os.path.isfile("Modules/pyobjc-api.h") or "ext_modules" not in k:
        if "setup_requires" in k:
            if len(k["setup_requires"]
                   ) == 1 and k["setup_requires"][0].startswith("pyobjc-core"):
                del k["setup_requires"]

    if "long_description" in k:
        k["long_description"] += "\n\nProject links\n"
        k["long_description"] += "-------------\n"
        k["long_description"] += "\n"
        k["long_description"] += "* `Documentation <https://%s.readthedocs.io/en/latest/>`_\n\n" % (
            REPO_NAME, )
        k["long_description"] += "* `Issue Tracker <https://github.com/ronaldoussoren/%s/issues>`_\n\n" % (
            REPO_NAME, )
        k["long_description"] += "* `Repository <https://github.com/ronaldoussoren/%s/>`_\n\n" % (
            REPO_NAME, )
        k["long_description_content_type"] = "text/x-rst; charset=UTF-8"

    _setup(
        cmdclass=cmdclass,
        author="Ronald Oussoren",
        author_email="*****@*****.**",
        url="https://github.com/ronaldoussoren/pyobjc",
        platforms=[plat_name],
        package_dir={
            "": "Lib",
            "PyObjCTest": "PyObjCTest"
        },
        dependency_links=[],
        package_data={"": ["*.bridgesupport"]},
        test_suite="PyObjCTest",
        zip_safe=False,
        license="MIT License",
        classifiers=CLASSIFIERS,
        python_requires=">=3.6",
        keywords=["PyObjC"] +
        [p for p in k["packages"] if p not in ("PyObjCTools", )],
        **k,
    )