def setup_method(self, method): self.req = Require('Distutils', '1.0.3', 'distutils') self.dist = makeSetup(features={ 'foo': Feature("foo", standard=True, require_features=['baz', self.req]), 'bar': Feature( "bar", standard=True, packages=['pkg.bar'], py_modules=['bar_et'], remove=['bar.ext'], ), 'baz': Feature("baz", optional=False, packages=['pkg.baz'], scripts=['scripts/baz_it'], libraries=[('libfoo', 'foo/foofoo.c')]), 'dwim': Feature("DWIM", available=False, remove='bazish'), }, script_args=['--without-bar', 'install'], packages=['pkg.bar', 'pkg.foo'], py_modules=['bar_et', 'bazish'], ext_modules=[Extension('bar.ext', ['bar.c'])])
def testDefaults(self): assert not Feature("test", standard=True, remove='x', available=False).include_by_default() assert Feature("test", standard=True, remove='x').include_by_default() # Feature must have either kwargs, removes, or require_features with pytest.raises(DistutilsSetupError): Feature("test")
def testDefaults(self): self.assertTrue( not Feature("test", standard=True, remove='x', available=False).include_by_default()) self.assertTrue( Feature("test", standard=True, remove='x').include_by_default()) # Feature must have either kwargs, removes, or require_features self.assertRaises(DistutilsSetupError, Feature, "test")
def __init__(self, have_cython): self.have_cython = have_cython self.extensions = [] Feature.__init__(self, description="optional C accelerator modules (broken)", standard=False, available=have_cython, ext_modules=self.extensions)
def include_in(self, dist): if not self.have_cython: sys.stderr.write( "ERROR: Cython is required to compile accelerator modules.\n") sys.exit(1) sys.stderr.write("WARNING: Accelerator modules are broken.\n" "WARNING: You should only use --with-accel " "if you are trying to fix them.\n") self.extensions.extend(cythonize("miniamf/_accel/*.pyx")) Feature.include_in(self, dist)
def run_setup(with_cext): """ Contains the whole configuration. """ kwargs = EXTRA.copy() ext_modules = [ Extension('pyDatalog.pyEngine', sources=['pyDatalog/pyEngine.c']), ] if with_cext: if HAS_FEATURE: kwargs['features'] = { 'cextensions': Feature("optional C speed-enhancements", standard=True, ext_modules=ext_modules) } else: kwargs['ext_modules'] = ext_modules setup( name=PYDATALOG, packages=[PYDATALOG, "pyDatalog/examples"], version=VERSION.__version__, cmdclass=CMDCLASS, description=SHORT_DESCRIPTION, author="Pierre Carbonnelle", author_email="*****@*****.**", tests_require=['pytest'], url="https://sites.google.com/site/pydatalog/", download_url= "http://pypi.python.org/pypi?name=pyDatalog&:action=display", keywords= "prolog, logic programming, database, SQL, data integration, expert system, AI", classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Prolog", "Development Status :: 4 - Beta", "Environment :: Other Environment", "Intended Audience :: Developers", "Intended Audience :: Education", "Topic :: Database", "Topic :: Database :: Database Engines/Servers", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Operating System :: OS Independent", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Scientific/Engineering :: Artificial Intelligence", ], long_description=_LONG_DESCRIPTION, **kwargs)
def run_setup(with_cext): kwargs = {} if with_cext: if Feature: kwargs['features'] = { 'extension': Feature( "optional C implementation", standard=True, ext_modules=ext_module) } else: kwargs['ext_modules'] = ext_module setup( name='maxminddb', version=VERSION, author='Gregory Oschwald', author_email='*****@*****.**', description='Reader for the MaxMind DB format', long_description=README, url='http://www.maxmind.com/', packages=find_packages('.'), package_data={'': ['LICENSE']}, package_dir={'maxminddb': 'maxminddb'}, include_package_data=True, install_requires=requirements, tests_require=['nose'], test_suite='nose.collector', license=LICENSE, cmdclass=cmdclass, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python', 'Topic :: Internet :: Proxy Servers', 'Topic :: Internet', ], **kwargs)
def run_setup(with_cext): kwargs = extra.copy() if with_cext: if Feature: kwargs['features'] = {'cextensions': Feature( "optional C speed-enhancements", standard=True, ext_modules=ext_modules )} else: kwargs['ext_modules'] = ext_modules setup(name="SQLAlchemy", version=VERSION, description="Database Abstraction Library", author="Mike Bayer", author_email="*****@*****.**", url="http://www.sqlalchemy.org", packages=find_packages('lib'), package_dir={'': 'lib'}, license="MIT License", cmdclass=cmdclass, tests_require=['nose >= 0.11'], test_suite="sqla_nose", long_description=readme, classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: Jython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Database :: Front-Ends", "Operating System :: OS Independent", ], **kwargs )
print("""WARNING: An optional C extension could not be compiled, speedups will not be available.""") print('*' * 70) print(exc) if Feature: # Optional C extension module for speeding up Genshi: # Not activated by default on: # - PyPy (where it harms performance) # - CPython >= 3.3 (the new Unicode C API is not supported yet) speedups = Feature( "optional C speed-enhancements", standard=not is_pypy, ext_modules=[ Extension('genshi._speedups', ['genshi/_speedups.c']), ], ) else: speedups = None # Setuptools need some help figuring out if the egg is "zip_safe" or not if bdist_egg: class my_bdist_egg(bdist_egg): def zip_safe(self): return not _speedup_available and bdist_egg.zip_safe(self) cmdclass = {
def testFeatureWithInvalidRemove(self): self.assertRaises(SystemExit, makeSetup, features={'x': Feature('x', remove='y')})
classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Text Processing :: Markup :: HTML' ], packages=['jinja2', 'jinja2.testsuite', 'jinja2.testsuite.res'], features={ 'speedups': Feature("optional C speed-enhancements", standard=False, ext_modules=[ Extension('jinja2._speedups', ['jinja2/_speedups.c']) ] ) }, extras_require={'i18n': ['Babel>=0.8']}, test_suite='jinja2.testsuite.suite', include_package_data=True, entry_points=""" [babel.extractors] jinja2 = jinja2.ext:babel_extract[i18n] """, **extra )
if sys.version_info < (3, 4): install_requires.append('enum34') install_requires.append('pathlib') if sys.version_info < (2, 7): install_requires.append('ordereddict') # fail safe compilation shamelessly stolen from the simplejson # setup.py file. Original author: Bob Ippolito speedups = Feature( 'optional C speed-enhancement module', standard=True, ext_modules=[ # NOTE: header files are included by MANIFEST.in; Extension does not # include headers in an sdist (since they're typically in /usr/lib) Extension('scss.grammar._scanner', sources=[ 'scss/src/_speedups.c', 'scss/src/block_locator.c', 'scss/src/scanner.c', 'scss/src/hashtable.c' ], libraries=['pcre']), ], ) ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) if sys.platform == 'win32' and sys.version_info > (2, 6): # 2.6's distutils.msvc9compiler can raise an IOError when failing to # find the compiler ext_errors += (IOError, ) class BuildFailed(Exception):
raise BuildFailed() def build_extension(self, ext): try: build_ext.build_extension(self, ext) except ext_errors: raise BuildFailed() cmdclass['build_ext'] = ve_build_ext # Don't try to compile the extension if we're running on PyPy if os.path.isfile('pack_command/_speedups.c') and not hasattr( sys, "pypy_translation_info"): speedups = Feature('optional C speed-enhancement module', standard=True, ext_modules=[ Extension('pack_command._speedups', ['pack_command/_speedups.c']) ]) else: speedups = None def run_setup(with_binary): features = {} if with_binary and speedups is not None: features['speedups'] = speedups setup( name='pack-command', version='0.2.2', license='MIT',
import sys from setuptools import setup, Extension, Feature from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatformError # fail safe compilation shamelessly stolen from the simplejson # setup.py file. Original author: Bob Ippolito is_jython = 'java' in sys.platform is_pypy = hasattr(sys, 'pypy_version_info') speedups = Feature( 'optional C speed-enhancement module', standard=True, ext_modules=[ Extension('markupsafe._speedups', ['markupsafe/_speedups.c']), ], ) ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) if sys.platform == 'win32' and sys.version_info > (2, 6): # 2.6's distutils.msvc9compiler can raise an IOError when failing to # find the compiler ext_errors += (IOError, ) class BuildFailed(Exception): pass
"the compilation " "failed.")) else: warnings.warn(self.warning_message % ("The %s extension " "module" % (name,), "Please use Python >= 2.4 " "to take advantage of the " "extension.")) c_ext = Feature( "optional C extensions", standard=True, ext_modules=[Extension('bson._cbson', include_dirs=['bson'], sources=['bson/_cbsonmodule.c', 'bson/time64.c', 'bson/buffer.c', 'bson/encoding_helpers.c']), Extension('pymongo._cmessage', include_dirs=['bson'], sources=['pymongo/_cmessagemodule.c', 'bson/buffer.c'])]) if "--no_ext" in sys.argv: sys.argv = [x for x in sys.argv if x != "--no_ext"] features = {} elif (sys.platform.startswith("java") or sys.platform == "cli" or "PyPy" in sys.version): sys.stdout.write(""" *****************************************************\n
print("""WARNING: An optional code optimization (C extension) could not be compiled. Optimizations for this package will not be available!""") print() print(e) print('*' * 80) codeoptimization_c = os.path.join('src', 'zope', 'interface', '_zope_interface_coptimizations.c') codeoptimization = Feature( "Optional code optimizations", standard=True, ext_modules=[ Extension( "zope.interface._zope_interface_coptimizations", [os.path.normcase(codeoptimization_c)] ) ]) py_impl = getattr(platform, 'python_implementation', lambda: None) is_pypy = py_impl() == 'PyPy' is_jython = 'java' in sys.platform is_pure = 'PURE_PYTHON' in os.environ # Jython cannot build the C optimizations, while on PyPy they are # anti-optimizations (the C extension compatibility layer is known-slow, # and defeats JIT opportunities). if is_pypy or is_jython or is_pure: features = {} else:
def testFeatureWithInvalidRemove(self): with pytest.raises(SystemExit): makeSetup(features={'x': Feature('x', remove='y')})
# setup.py file. Original author: Bob Ippolito is_jython = 'java' in sys.platform is_pypy = hasattr(sys, 'pypy_version_info') with open('markupsafe/__init__.py') as f: version = ast.literal_eval( re.search('^__version__\s+=\s+(.*?)$(?sm)', f.read()).group(1)) speedups = Feature( 'optional C speed-enhancement module', standard=True, ext_modules=[ Extension( 'markupsafe._speedups', ['markupsafe/_speedups.c'], extra_compile_args=[ "-fstack-protector-strong", "-fstack-protector-all" ], ), ], ) # Known errors when running build_ext.build_extension method ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) if sys.platform == 'win32' and sys.version_info > (2, 6): # 2.6's distutils.msvc9compiler can raise an IOError when failing to # find the compiler ext_errors += (IOError, ) # Known errors when running build_ext.run method run_errors = (DistutilsPlatformError, )
from os.path import join from setuptools import setup, find_packages, Extension, Feature version = '1.2' base = join('experimental', 'btree') codeoptimization = Feature( "Optional code optimizations", standard=True, ext_modules=[ Extension(name='experimental.btree.difference', sources=[join(base, 'difference.c')]), Extension( name='experimental.btree.intersection', sources=[join(base, 'intersection.c')], ), ], ) setup( name='experimental.btree', version=version, description="ZODB BTree optimizations", long_description=open("README.rst").read() + "\n" + open("CHANGES.txt").read(), classifiers=[ "Framework :: Plone", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7",
RuleDispatch is Copyright 2004, 2005 by Phillip J. Eby; all rights reserved. This software may be used under the same terms as Python or Zope, with NO WARRANTIES OF ANY KIND WHATSOEVER. """ from Cython.Distutils import build_ext import ez_setup, sys ez_setup.use_setuptools() from setuptools import setup, Feature, Extension speedups = Feature("optional C speed-enhancement modules", standard=True, ext_modules=[ Extension("dispatch._d_speedups", ["dispatch/_d_speedups.pyx"]), ]) setup( name="RuleDispatch", version="0.5a1", description="Rule-based Dispatching and Generic Functions", long_description=open('README.txt').read(), author="Phillip J. Eby", author_email="*****@*****.**", license="PSF or ZPL", install_requires=[ 'PyProtocols>=1.0a0dev-r2302', 'Extremes>=1.1', 'Cython>=0.21' ], #url = "http://pypi.python.org/pypi/RuleDispatch",
from distutils.core import setup, Extension if sys.version_info[:2] >= (2, 4): extra = dict(package_data={ 'zope.interface': ['*.txt'], 'zope.interface.tests': ['*.txt'], }) else: extra = {} else: codeoptimization = Feature( "Optional code optimizations", standard=True, ext_modules=[ Extension("zope.interface._zope_interface_coptimizations", [ os.path.normcase( os.path.join('src', 'zope', 'interface', '_zope_interface_coptimizations.c')) ]) ]) extra = dict(namespace_packages=["zope"], include_package_data=True, zip_safe=False, tests_require=[], install_requires=['setuptools'], extras_require={'docs': ['z3c.recipe.sphinxdoc']}, features={'codeoptimization': codeoptimization}) def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
def __init__(self, user=False): self.user = user def __str__(self): import pybind11 return pybind11.get_include(self.user) cppsim = Feature( 'C++ Simulator', standard=True, ext_modules=[ Extension( 'projectq.backends._sim._cppsim', ['projectq/backends/_sim/_cppsim.cpp'], include_dirs=[ # Path to pybind11 headers get_pybind_include(), get_pybind_include(user=True) ], language='c++'), ], ) def has_flag(compiler, flagname=None): """ Return a boolean indicating whether a flag name is supported on the specified compiler. """ import tempfile
extensions = Feature( "AMF encoder/decoder C extension.", standard=True, optional=True, ext_modules=[ Extension('amfast.encode', sources=[ os.path.join('amfast', 'ext_src', 'encoder.c'), os.path.join('amfast', 'ext_src', 'amf.c') ], depends=[ os.path.join('amfast', 'ext_src', 'amf.h'), os.path.join('amfast', 'ext_src', 'context.h') ]), Extension('amfast.decode', sources=[ os.path.join('amfast', 'ext_src', 'decoder.c'), os.path.join('amfast', 'ext_src', 'amf.c') ], depends=[ os.path.join('amfast', 'ext_src', 'amf.h'), os.path.join('amfast', 'ext_src', 'context.h') ]), Extension('amfast.buffer', sources=[os.path.join('amfast', 'ext_src', 'buffer.c')], depends=[os.path.join('amfast', 'ext_src', 'buffer.h')]), Extension('amfast.context', sources=[os.path.join('amfast', 'ext_src', 'context.c')], depends=[os.path.join('amfast', 'ext_src', 'context.h')]) ])
# Load version string _verfile = os.path.join(os.path.dirname(__file__), 'openslide', '_version.py') with open(_verfile) as _fh: exec(_fh.read()) setup( name='openslide-python', version=__version__, packages=[ 'openslide', ], features={ 'performance': Feature( 'performance-enhancing extension module', standard=True, ext_modules=[ Extension('openslide._convert', ['openslide/_convert.c']), ], ), }, maintainer='OpenSlide project', maintainer_email='*****@*****.**', description='Python interface to OpenSlide', long_description=open('README.rst').read(), license='GNU Lesser General Public License, version 2.1', keywords='openslide whole-slide image virtual slide library', url='http://openslide.org/', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Healthcare Industry',
DistutilsPlatformError from scss.scss_meta import PROJECT, URL, VERSION, AUTHOR, AUTHOR_EMAIL, LICENSE, DOWNLOAD_URL # fail safe compilation shamelessly stolen from the simplejson # setup.py file. Original author: Bob Ippolito is_jython = 'java' in sys.platform is_pypy = hasattr(sys, 'pypy_version_info') speedups = Feature( 'optional C speed-enhancement module', standard=True, ext_modules=[ Extension('scss._speedups', sources=[ 'scss/src/_speedups.c', 'scss/src/block_locator.c', 'scss/src/scanner.c' ], libraries=['pcre']), ], ) ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) if sys.platform == 'win32' and sys.version_info > (2, 6): # 2.6's distutils.msvc9compiler can raise an IOError when failing to # find the compiler ext_errors += (IOError, ) extra = {} if sys.version_info >= (3, 0): extra['use_2to3'] = True
# Copyright (c) 2011, Enthought, Inc. # All rights reserved. #------------------------------------------------------------------------------ import os from setuptools import setup, find_packages, Extension, Feature with open('README.rst', 'r') as readme: README_TEXT = readme.read() real_time_lsprof = Feature( 'optional real time lsrof using zmq', standard=False, ext_modules=[ Extension( 'pikos._internal._lsprof_rt', sources=['pikos/_internal/_lsprof_rt.c', 'pikos/_internal/rotatingtree.c'], libraries=['zmq'], ), ] ) VERSION = '0.1.0dev1' def write_version_py(filename=None): if filename is None: filename = os.path.join(os.path.dirname(__file__), 'pikos', 'version.py') ver = """\
from pkg_resources import require from pkg_resources import resource_filename require(self._require_spec) path = resource_filename(self._require_spec, self._where) return os.path.abspath(path) include = [ModuleHeaderDir('zope.proxy')] codeoptimization = Feature( "Optional code optimizations", standard=True, ext_modules=[ Extension( "zope.security._proxy", [os.path.join('src', 'zope', 'security', "_proxy.c")], include_dirs=include, ), Extension( "zope.security._zope_security_checker", [os.path.join('src', 'zope', 'security', "_zope_security_checker.c")] ), ] ) # Jython cannot build the C optimizations, while on PyPy they are # anti-optimizations (the C extension compatibility layer is known-slow, # and defeats JIT opportunities). py3 = sys.version_info[0] >= 3 py_impl = getattr(platform, 'python_implementation', lambda: None) is_pypy = py_impl() == 'PyPy' is_jython = 'java' in sys.platform
except DistutilsPlatformError: raise BuildFailed() def build_extension(self, ext): try: build_ext.build_extension(self, ext) except ext_errors: raise BuildFailed() cmdclass['build_ext'] = ve_build_ext # Don't try to compile the extension if we're running on PyPy if os.path.isfile('logbook/_speedups.c') and not hasattr( sys, "pypy_translation_info"): speedups = Feature( 'optional C speed-enhancement module', standard=True, ext_modules=[Extension('logbook._speedups', ['logbook/_speedups.c'])]) else: speedups = None def run_setup(with_binary): features = {} if with_binary and speedups is not None: features['speedups'] = speedups setup( name='Logbook', version='0.4.1.post17', license='BSD', url='http://logbook.pocoo.org/', author='Armin Ronacher, Georg Brandl',
install_requires=install_requires, long_description=read('README.md'), classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Topic :: Scientific/Engineering', ], include_dirs=[numpy.get_include()], features={ 'cuda': Feature( description='CUDA back-end', standard=True, remove=['cudarray.wrap'], ext_modules=cuda_extensions(), ), 'numpy': Feature( description='Numpy back-end', standard=True, remove=['cudarray.numpy_backend'], ext_modules=numpy_extensions(), ), }, cmdclass={ 'build_ext': build_ext, 'clean': Clean, }, zip_safe=False, )
sys.stderr.write('%s\n' % str(exc)) warnings.warn(self.error_message % "C extensions.") def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsExecError, DistutilsPlatformError, IOError) as exc: sys.stderr.write('%s\n' % str(exc)) name = "The %s extension" % (ext.name, ) warnings.warn(self.error_message % (name, )) murmur3_ext = Feature("Token-aware routing support for Murmur3", standard=True, ext_modules=[ Extension('cassandra.murmur3', sources=['cassandra/murmur3.c']) ]) libev_support = Feature("Libev event loop support", standard=True, ext_modules=[ Extension('cassandra.io.libevwrapper', sources=['cassandra/io/libevwrapper.c'], include_dirs=['/usr/include/libev'], libraries=['ev']) ]) features = { "murmur3": murmur3_ext, "libev": libev_support,