Beispiel #1
0
    def __init__(self, system_libraries):
        """extra_link_args is a list of argument strings
        from pkg-config, or None if we're to use the standard
        libcdio libraries"""

        self.__library_manifest__ = []
        sources = []
        libraries = set()
        extra_compile_args = []
        extra_link_args = []

        if (system_libraries.present("libcdio_paranoia")):
            if (system_libraries.guaranteed_present("libcdio_paranoia")):
                libraries.update(
                    set(["libcdio", "libcdio_cdda", "libcdio_paranoia"]))
            else:
                extra_compile_args.extend(
                    system_libraries.extra_compile_args("libcdio_paranoia"))
                extra_link_args.extend(
                    system_libraries.extra_link_args("libcdio_paranoia"))
            sources.extend([
                "src/cdiomodule.c", "src/array.c", "src/pcmconv.c", "src/pcm.c"
            ])
            self.__library_manifest__.append(
                ("libcdio", "CDDA data extraction", True))
        else:
            self.__library_manifest__.append(
                ("libcdio", "CDDA data extraction", False))

        Extension.__init__(self,
                           "audiotools.cdio",
                           sources=sources,
                           libraries=list(libraries),
                           extra_compile_args=extra_compile_args,
                           extra_link_args=extra_link_args)
Beispiel #2
0
 def __init__(self, *args, **kwargs):
     for name, default in [("extra_pyxtract_cmds", []), ("lib_type", "dynamic")]:
         setattr(self, name, kwargs.get(name, default))
         if name in kwargs:    
             del kwargs[name]
         
     Extension.__init__(self, *args, **kwargs)
Beispiel #3
0
    def __init__(self, root = ""):
        path = join(root, 'Onboard', 'osk')
        sources = [join(path, x) for x in self.sources]
        depends = [join(path, x) for x in self.depends]
        defines = self.defines

        # dconf had an API change between 0.12 and 0.13, tell osk
        major, minor, revision = get_pkg_version("dconf")
        if major == 0 and minor <= 12:
            defines.append(("DCONF_API_0", 0))
        print("found dconf version {}.{}.{}".format(major, minor, revision))

        Extension.__init__(self,
                           MODULE_NAME_OSK,

                           sources = sources,
                           depends = depends,
                           define_macros = defines,
                           extra_compile_args = [
                               "-Wdeclaration-after-statement",
                               "-Werror=declaration-after-statement"],

                           **pkgconfig('gdk-3.0', 'x11', 'xi', 'xtst', 'xkbfile',
                                       'dconf', 'libcanberra', 'hunspell')
                           )
Beispiel #4
0
    def __init__(self, system_libraries):
        self.__library_manifest__ = []
        sources = []
        libraries = set()
        extra_compile_args = []
        extra_link_args = []

        if system_libraries.present("libdvd-audio"):
            if system_libraries.guaranteed_present("libdvd-audio"):
                libraries.update(set(["libdvd-audio"]))
            else:
                extra_compile_args.extend(
                    system_libraries.extra_compile_args("libdvd-audio"))
                extra_link_args.extend(
                    system_libraries.extra_link_args("libdvd-audio"))

            sources.extend(
                ["src/dvdamodule.c", "src/framelist.c", "src/pcm_conv.c"])

            self.__library_manifest__.append(
                ("libdvd-audio", "DVD-Audio data extraction", True))
        else:
            self.__library_manifest__.append(
                ("libdvd-audio", "DVD-Audio data extraction", False))

        Extension.__init__(self,
                           "audiotools.dvda",
                           sources=sources,
                           libraries=list(libraries),
                           extra_compile_args=extra_compile_args,
                           extra_link_args=extra_link_args)
Beispiel #5
0
 def __init__(self, *args, **kwargs):
     for name, default in [("extra_pyxtract_cmds", []), ("lib_type", "dynamic")]:
         setattr(self, name, kwargs.get(name, default))
         if name in kwargs:    
             del kwargs[name]
         
     Extension.__init__(self, *args, **kwargs)
    def __init__(self, system_libraries):
        self.__library_manifest__ = []
        sources = []
        libraries = set()
        extra_compile_args = []
        extra_link_args = []

        if system_libraries.present("libdvd-audio"):
            if system_libraries.guaranteed_present("libdvd-audio"):
                libraries.update(set(["libdvd-audio"]))
            else:
                extra_compile_args.extend(
                    system_libraries.extra_compile_args("libdvd-audio"))
                extra_link_args.extend(
                    system_libraries.extra_link_args("libdvd-audio"))

            sources.extend(["src/dvdamodule.c",
                            "src/framelist.c",
                            "src/pcm_conv.c"])

            self.__library_manifest__.append(("libdvd-audio",
                                              "DVD-Audio data extraction",
                                              True))
        else:
            self.__library_manifest__.append(("libdvd-audio",
                                              "DVD-Audio data extraction",
                                              False))

        Extension.__init__(
            self,
            "audiotools.dvda",
            sources=sources,
            libraries=list(libraries),
            extra_compile_args=extra_compile_args,
            extra_link_args=extra_link_args)
Beispiel #7
0
 def __init__(self):
     Extension.__init__(self,
                        "audiotools.bitstream",
                        sources=[
                            "src/mod_bitstream.c", "src/bitstream.c",
                            "src/buffer.c", "src/func_io.c", "src/huffman.c"
                        ])
Beispiel #8
0
    def __init__(self, name, sources, **kwargs):
        # the goal is to rely on original Extension
        # to do so we convert the .py to .cpp with pythran
        # and register the .cpp in place of the .py
        # That's stage 0, and it's enough if you get the source
        # from github and `python setup.py install it`
        #
        # *But* if you want to distribute the source through
        # `python setup.py sdist` then the .py no longer exists
        # and only the .cpp is distributed. That's stage 1

        cxx_sources = []
        for source in sources:
            base, ext = os.path.splitext(source)
            output_file = base + '.cpp'  # target name

            # stage 0 when we have the .py
            if os.path.exists(source):
                stage = 0
            # stage 1 otherwise. `.cpp' should already be there
            # as generated upon stage 0
            else:
                assert os.path.exists(output_file)
                stage = 1
                ext = '.cpp'
                source = output_file

            # stage-dependant processing
            if stage == 0:
                tc.compile_pythranfile(source, output_file,
                                       module_name=name, cpponly=True)
            cxx_sources.append(output_file)

        extension_args = cfg.make_extension()
        Extension.__init__(self, name, cxx_sources, **extension_args)
Beispiel #9
0
    def __init__(self, source_dir, include_dirs, library_dirs):
        if winbuild:
            apr1 = 0
            for dir in library_dirs:
                if os.path.exists(os.path.join(dir, 'libapr-1.lib')):
                    apr1 = 1
            if apr1:
                libraries = ['libhttpd', 'libapr-1', 'libaprutil-1', 'ws2_32']
            else:
                libraries = ['libhttpd', 'libapr', 'libaprutil', 'ws2_32']
        else:
            libraries = ['apr-0', 'aprutil-0']

        Extension.__init__(self, "mod_python_so",
            sources = [os.path.join(source_dir, source_file) for source_file in modpy_src_files],
                           include_dirs=include_dirs,
            libraries = libraries,
            library_dirs=library_dirs
                           )
        if winbuild:
            self.define_macros.extend([('WIN32', None),('NDEBUG', None),('_WINDOWS', None)])
            self.sources.append(os.path.join(source_dir, "Version.rc"))
        else:
            # TODO: fix this to autodetect if required...
            self.include_dirs.append("/usr/include/apr-0")
        # this is a hack to prevent build_ext from trying to append "initmod_python" to the export symbols
        self.export_symbols = finallist(self.export_symbols)
Beispiel #10
0
 def __init__(self):
     Extension.__init__(self,
                        'audiotools.verify',
                        sources=['src/verify.c',
                                 'src/bitstream.c',
                                 'src/buffer.c',
                                 'src/func_io.c'])
 def __init__(self):
     Extension.__init__(self,
                        "audiotools.verify",
                        sources=["src/verify.c",
                                 "src/bitstream.c",
                                 "src/buffer.c",
                                 "src/func_io.c"])
Beispiel #12
0
    def __init__(self, source_dir, include_dirs, library_dirs):
        if winbuild:
            apr1 = 0
            for dir in library_dirs:
                if os.path.exists(os.path.join(dir, 'libapr-1.lib')):
                    apr1 = 1
            if apr1:
                libraries = ['libhttpd', 'libapr-1', 'libaprutil-1', 'ws2_32']
            else:
                libraries = ['libhttpd', 'libapr', 'libaprutil', 'ws2_32']
        else:
            libraries = ['apr-0', 'aprutil-0']

        Extension.__init__(self,
                           "mod_python_so",
                           sources=[
                               os.path.join(source_dir, source_file)
                               for source_file in modpy_src_files
                           ],
                           include_dirs=include_dirs,
                           libraries=libraries,
                           library_dirs=library_dirs)
        if winbuild:
            self.define_macros.extend([('WIN32', None), ('NDEBUG', None),
                                       ('_WINDOWS', None)])
            self.sources.append(os.path.join(source_dir, "Version.rc"))
        else:
            # TODO: fix this to autodetect if required...
            self.include_dirs.append("/usr/include/apr-0")
        # this is a hack to prevent build_ext from trying to append "initmod_python" to the export symbols
        self.export_symbols = finallist(self.export_symbols)
Beispiel #13
0
 def __init__(self, *args, **kwargs):
     # bypass the patched init if possible
     if Extension.__bases__:
         base, = Extension.__bases__
         base.__init__(self, *args, **kwargs)
     else:
         Extension.__init__(self, *args, **kwargs)
Beispiel #14
0
 def __init__(self, *args, **kwargs):
     # bypass the patched init if possible
     if Extension.__bases__:
         base, = Extension.__bases__
         base.__init__(self, *args, **kwargs)
     else:
         Extension.__init__(self, *args, **kwargs)
    def __init__(self, name, sources,
              include_dirs=None,
              define_macros=None,
              undef_macros=None,
              library_dirs=None,
              libraries=None,
              runtime_library_dirs=None,
              extra_objects=None,
              extra_compile_args=None,
              extra_link_args=None,
              export_symbols=None,
              swig_opts = None,
              depends=None,
              language=None,
              optional=None,
							test_name=None,
              test_sources=None,
              ext_sources=None,
              **kw                      # To catch unknown keywords
             ):
        if not test_sources:
            raise DistutilsSetupError("Running build_test, but no test_sources are specified in the Extension.");
        self.test_sources = test_sources
        self.ext_sources = ext_sources
        self.test_name = test_name
        Extension.__init__(self, name, sources, include_dirs, define_macros, undef_macros, library_dirs,
            libraries, runtime_library_dirs, extra_objects, extra_compile_args, extra_link_args,
            export_symbols, swig_opts, depends, language, optional, **kw)
Beispiel #16
0
    def __init__(self, system_libraries):
        """extra_link_args is a list of argument strings
        from pkg-config, or None if we're to use the standard
        libcdio libraries"""

        self.__library_manifest__ = []
        sources = []
        libraries = set()
        extra_link_args = []

        if (system_libraries.present("libcdio_paranoia")):
            if (system_libraries.guaranteed_present("libcdio_paranoia")):
                libraries.update(set(["libcdio",
                                      "libcdio_cdda",
                                      "libcdio_paranoia"]))
            else:
                extra_link_args.extend(
                    system_libraries.extra_link_args("libcdio_paranoia"))
            sources.append("src/cdiomodule.c")
            self.__library_manifest__.append(("libcdio",
                                              "CDDA data extraction",
                                              True))
        else:
            self.__library_manifest__.append(("libcdio",
                                              "CDDA data extraction",
                                              False))

        Extension.__init__(
            self,
            'audiotools.cdio',
            sources=sources,
            libraries=list(libraries),
            extra_link_args=extra_link_args)
Beispiel #17
0
 def __init__(self):
     Extension.__init__(self,
                        "audiotools.replaygain",
                        sources=[
                            "src/replaygain.c", "src/pcmconv.c",
                            "src/array.c", "src/bitstream.c",
                            "src/buffer.c", "src/func_io.c"
                        ])
 def __init__(self):
     Extension.__init__(self,
                        "audiotools.bitstream",
                        sources=["src/mod_bitstream.c",
                                 "src/bitstream.c",
                                 "src/buffer.c",
                                 "src/func_io.c",
                                 "src/huffman.c"])
Beispiel #19
0
 def __init__(self):
     Extension.__init__(self,
                        'audiotools.bitstream',
                        sources=['src/mod_bitstream.c',
                                 'src/bitstream.c',
                                 'src/buffer.c',
                                 'src/func_io.c',
                                 'src/huffman.c'])
Beispiel #20
0
 def __init__(self):
     Extension.__init__(self,
                        "audiotools._ogg",
                        sources=[
                            "src/ogg.c", "src/ogg_crc.c", "src/mod_ogg.c",
                            "src/bitstream.c", "src/func_io.c",
                            "src/buffer.c"
                        ])
Beispiel #21
0
    def __init__(self, system_libraries):
        """extra_link_args is a list of argument strings
        from pkg-config, or None if we're to use the standard
        libcdio libraries"""

        self.__library_manifest__ = []
        sources = []
        libraries = set()
        extra_compile_args = []
        extra_link_args = []

        if system_libraries.present("libcdio_paranoia"):
            if system_libraries.guaranteed_present("libcdio_paranoia"):
                libraries.update(set(["libcdio",
                                      "libcdio_cdda",
                                      "libcdio_paranoia"]))
                try:
                    if tuple(int(s) for s in
                             system_libraries.configfile.get(
                                 "Libraries",
                                 "libcdio_paranoia_version")) < (0, 90):
                        paranoia_version = [("OLD_PARANOIA", None)]
                    else:
                        paranoia_version = []
                except (KeyError, ValueError):
                    paranoia_version = []
            else:
                extra_compile_args.extend(
                    system_libraries.extra_compile_args("libcdio_paranoia"))
                extra_link_args.extend(
                    system_libraries.extra_link_args("libcdio_paranoia"))

                if system_libraries.lib_version("libcdio_paranoia") < (0, 90):
                    paranoia_version = [("OLD_PARANOIA", None)]
                else:
                    paranoia_version = []

            sources.extend(["src/cdiomodule.c",
                            "src/framelist.c",
                            "src/pcm_conv.c"])

            self.__library_manifest__.append(("libcdio",
                                              "CDDA data extraction",
                                              True))
        else:
            self.__library_manifest__.append(("libcdio",
                                              "CDDA data extraction",
                                              False))
            paranoia_version = []

        Extension.__init__(
            self,
            "audiotools.cdio",
            sources=sources,
            libraries=list(libraries),
            extra_compile_args=extra_compile_args,
            extra_link_args=extra_link_args,
            define_macros=paranoia_version)
 def __init__(self, name, sources, **kwds):
     Extension.__init__(self,name,sources,**kwds)
     if not hasattr(self, 'swig_opts'): # distutils < 2.4
         self.swig_opts = []
     dirs = self.include_dirs
     for source in sources:
         dir = os.path.dirname(source)
         if dir not in dirs:
             dirs.insert(0,dir)
Beispiel #23
0
    def __init__(self, source_dir, include_dirs):
        Extension.__init__(self, "mod_python._psp",
                               [os.path.join(source_dir, source_file) for source_file in
                                    ("psp_string.c", "psp_parser.c", "_pspmodule.c")],
                                include_dirs=include_dirs
                           )

        if winbuild:
            self.define_macros.extend([('WIN32', None), ('NDEBUG', None), ('_WINDOWS', None)])
Beispiel #24
0
 def __init__(self):
     Extension.__init__(self,
                        "audiotools._ogg",
                        sources=[
                            "src/ogg.c", "src/ogg_crc.c", "src/mod_ogg.c",
                            "src/bitstream.c", "src/func_io.c",
                            "src/mini-gmp.c", "src/buffer.c"
                        ],
                        define_macros=[("HAS_PYTHON", None)])
 def __init__(self, *args, **kw):
     # Add a custom 'target_desc' option, which matches CCompiler
     # (is there a better way?
     if "target_desc" in kw:
         self.target_desc = kw['target_desc']
         del kw['target_desc']
     else:
         self.target_desc = "executable"
     Extension.__init__(self, *args, **kw)
Beispiel #26
0
 def __init__(self):
     Extension.__init__(self,
                        'audiotools._ogg',
                        sources=['src/ogg.c',
                                 'src/ogg_crc.c',
                                 'src/mod_ogg.c',
                                 'src/bitstream.c',
                                 'src/func_io.c',
                                 'src/buffer.c'])
Beispiel #27
0
 def __init__(self, *args, **kw):
     _Extension.__init__(self, *args, **kw)
     sources = []
     for s in self.sources:
         if s.endswith('.pyx'):
             sources.append(s[:-3] + 'c')
         else:
             sources.append(s)
     self.sources = sources
 def __init__(self):
     Extension.__init__(self,
                        "audiotools._ogg",
                        sources=["src/ogg.c",
                                 "src/ogg_crc.c",
                                 "src/mod_ogg.c",
                                 "src/bitstream.c",
                                 "src/func_io.c",
                                 "src/buffer.c"])
Beispiel #29
0
 def __init__(self,*args,**kw):
     _Extension.__init__(self,*args,**kw)
     sources = []
     for s in self.sources:
         if s.endswith('.pyx'):
             sources.append(s[:-3]+'c')
         else:
             sources.append(s)
     self.sources = sources
Beispiel #30
0
 def __init__(self, name, sources, feature_name, feature_description,
              feature_check, **kwds):
     if not with_cython:
         for filename in sources[:]:
             base, ext = os.path.splitext(filename)
             if ext == '.pyx':
                 sources.remove(filename)
                 sources.append('%s.c' % base)
     _Extension.__init__(self, name, sources, **kwds)
Beispiel #31
0
 def __init__(self):
     Extension.__init__(self,
                        'audiotools.replaygain',
                        sources=['src/replaygain.c',
                                 'src/pcmconv.c',
                                 'src/array.c',
                                 'src/bitstream.c',
                                 'src/buffer.c',
                                 'src/func_io.c'])
 def __init__(self):
     Extension.__init__(self,
                        "audiotools.replaygain",
                        sources=["src/replaygain.c",
                                 "src/pcmconv.c",
                                 "src/array.c",
                                 "src/bitstream.c",
                                 "src/buffer.c",
                                 "src/func_io.c"])
Beispiel #33
0
 def __init__(self):
     Extension.__init__(self,
                        "audiotools.replaygain",
                        sources=[
                            "src/replaygain.c", "src/framelist.c",
                            "src/pcmreader.c", "src/bitstream.c",
                            "src/buffer.c", "src/func_io.c",
                            "src/mini-gmp.c"
                        ],
                        define_macros=[("HAS_PYTHON", None)])
Beispiel #34
0
 def __init__(self):
     Extension.__init__(
         self,
         "audiotools.pcmconverter",
         sources=[
             "src/pcmconverter.c", "src/pcmconv.c", "src/array.c",
             "src/bitstream.c", "src/buffer.c", "src/func_io.c",
             "src/samplerate/samplerate.c", "src/samplerate/src_sinc.c",
             "src/samplerate/src_zoh.c", "src/samplerate/src_linear.c"
         ])
Beispiel #35
0
	def __init__(self, *args, **kwargs):
		Extension.__init__(self, *args, **kwargs)
		self.cython_directives = {
			'c_string_encoding': 'utf-8',
			'profile': 'USE_PROFILE' in os.environ,
			'embedsignature': 'USE_EMBEDSIGNATURE' in os.environ}
		# XXX with pip, setuptools is imported before distutils, and change
		# our pyx to c, then, cythonize doesn't happen. So force again our
		# sources
		self.sources = args[1]
 def __init__(self):
     Extension.__init__(self,
                        "audiotools.bitstream",
                        sources=["src/mod_bitstream.c",
                                 "src/bitstream.c",
                                 "src/buffer.c",
                                 "src/func_io.c",
                                 "src/mini-gmp.c",
                                 "src/huffman.c"],
                        define_macros=[("HAS_PYTHON", None)])
Beispiel #37
0
    def __init__(self, *args, **kw):
        Extension.__init__(self, *args, **kw)

        if not has_cython:
            s = []
            for f in self.sources:
                name = f[0 : -len("py")]
                s.append(name + "c")

            self.sources = s
 def __init__(self):
     Extension.__init__(self,
                        "audiotools.replaygain",
                        sources=["src/replaygain.c",
                                 "src/framelist.c",
                                 "src/pcmreader.c",
                                 "src/bitstream.c",
                                 "src/buffer.c",
                                 "src/func_io.c",
                                 "src/mini-gmp.c"],
                        define_macros=[("HAS_PYTHON", None)])
Beispiel #39
0
    def __init__(self, key, **opts):
        self.boodler_key = key
        modname = "boodle.cboodle_" + key

        ls = ["audev-" + key, "cboodle-" + key, "noteq", "sample"]
        ls = [("src/cboodle/" + val + ".c") for val in ls]

        avail = opts.pop("available", None)
        if avail:
            self.ext_available = avail

        Extension.__init__(self, modname, ls, **opts)
Beispiel #40
0
 def __init__(self):
     Extension.__init__(
         self,
         "audiotools.pcmconverter",
         sources=[
             "src/pcmconverter.c", "src/framelist.c", "src/pcmreader.c",
             "src/pcm_conv.c", "src/bitstream.c", "src/buffer.c",
             "src/func_io.c", "src/mini-gmp.c",
             "src/samplerate/samplerate.c", "src/samplerate/src_sinc.c",
             "src/samplerate/src_zoh.c", "src/samplerate/src_linear.c"
         ],
         define_macros=[("HAS_PYTHON", None)])
Beispiel #41
0
    def __init__(self, system_libraries):
        """extra_link_args is a list of argument strings
        from pkg-config, or None if we're to use the standard
        libcdio libraries"""

        self.__library_manifest__ = []
        sources = []
        libraries = set()
        extra_compile_args = []
        extra_link_args = []

        if system_libraries.present("libcdio_paranoia"):
            if system_libraries.guaranteed_present("libcdio_paranoia"):
                libraries.update(
                    set(["libcdio", "libcdio_cdda", "libcdio_paranoia"]))
                try:
                    if tuple(
                            int(s) for s in system_libraries.configfile.get(
                                "Libraries", "libcdio_paranoia_version")) < (
                                    0, 90):
                        paranoia_version = [("OLD_PARANOIA", None)]
                    else:
                        paranoia_version = []
                except (KeyError, ValueError):
                    paranoia_version = []
            else:
                extra_compile_args.extend(
                    system_libraries.extra_compile_args("libcdio_paranoia"))
                extra_link_args.extend(
                    system_libraries.extra_link_args("libcdio_paranoia"))

                if system_libraries.lib_version("libcdio_paranoia") < (0, 90):
                    paranoia_version = [("OLD_PARANOIA", None)]
                else:
                    paranoia_version = []

            sources.extend(
                ["src/cdiomodule.c", "src/framelist.c", "src/pcm_conv.c"])

            self.__library_manifest__.append(
                ("libcdio", "CDDA data extraction", True))
        else:
            self.__library_manifest__.append(
                ("libcdio", "CDDA data extraction", False))
            paranoia_version = []

        Extension.__init__(self,
                           "audiotools.cdio",
                           sources=sources,
                           libraries=list(libraries),
                           extra_compile_args=extra_compile_args,
                           extra_link_args=extra_link_args,
                           define_macros=paranoia_version)
Beispiel #42
0
    def __init__(self, key, **opts):
        self.boodler_key = key
        modname = 'boodle.cboodle_' + key

        ls = ['audev-' + key, 'cboodle-' + key, 'noteq', 'sample']
        ls = [('src/cboodle/' + val + '.c') for val in ls]

        avail = opts.pop('available', None)
        if (avail):
            self.ext_available = avail

        Extension.__init__(self, modname, ls, **opts)
Beispiel #43
0
    def __init__(self, source_dir, include_dirs):
        Extension.__init__(
            self,
            "mod_python._psp", [
                os.path.join(source_dir, source_file)
                for source_file in ("psp_string.c", "psp_parser.c",
                                    "_pspmodule.c")
            ],
            include_dirs=include_dirs)

        if winbuild:
            self.define_macros.extend([('WIN32', None), ('NDEBUG', None),
                                       ('_WINDOWS', None)])
 def __init__(self):
     Extension.__init__(self,
                        "audiotools.pcmconverter",
                        sources=["src/pcmconverter.c",
                                 "src/pcmconv.c",
                                 "src/array.c",
                                 "src/bitstream.c",
                                 "src/buffer.c",
                                 "src/func_io.c",
                                 "src/samplerate/samplerate.c",
                                 "src/samplerate/src_sinc.c",
                                 "src/samplerate/src_zoh.c",
                                 "src/samplerate/src_linear.c"])
Beispiel #45
0
 def __init__(self, name, sources, feature_name, feature_description,
              feature_check, **kwds):
     if not with_cython:
         for filename in sources[:]:
             base, ext = os.path.splitext(filename)
             if ext == ".pyx":
                 sources.remove(filename)
                 sources.append("%s.c" % base)
     _Extension.__init__(self, name, sources, **kwds)
     self.feature_name = feature_name
     self.feature_description = feature_description
     self.feature_check = feature_check
     self.attr_name = "with_" + feature_name.replace("-", "_")
     self.option_name = "with-" + feature_name
     self.neg_option_name = "without-" + feature_name
Beispiel #46
0
 def __init__(self, name, sources, feature_name, feature_description,
         feature_check, **kwds):
     if not with_cython:
         for filename in sources[:]:
             base, ext = os.path.splitext(filename)
             if ext == '.pyx':
                 sources.remove(filename)
                 sources.append('%s.c' % base)
     _Extension.__init__(self, name, sources, **kwds)
     self.feature_name = feature_name
     self.feature_description = feature_description
     self.feature_check = feature_check
     self.attr_name = 'with_' + feature_name.replace('-', '_')
     self.option_name = 'with-' + feature_name
     self.neg_option_name = 'without-' + feature_name
Beispiel #47
0
 def __init__(self, name, sources, feature_name, feature_description,
         feature_check, **kwds):
     if not with_cython:
         for filename in sources[:]:
             base, ext = os.path.splitext(filename)
             if ext == '.pyx':
                 sources.remove(filename)
                 sources.append('%s.c' % base)
     _Extension.__init__(self, name, sources, **kwds)
     self.feature_name = feature_name
     self.feature_description = feature_description
     self.feature_check = feature_check
     self.attr_name = 'with_' + feature_name.replace('-', '_')
     self.option_name = 'with-' + feature_name
     self.neg_option_name = 'without-' + feature_name
 def __init__(self):
     Extension.__init__(self,
                        "audiotools.pcmconverter",
                        sources=["src/pcmconverter.c",
                                 "src/framelist.c",
                                 "src/pcmreader.c",
                                 "src/pcm_conv.c",
                                 "src/bitstream.c",
                                 "src/buffer.c",
                                 "src/func_io.c",
                                 "src/mini-gmp.c",
                                 "src/samplerate/samplerate.c",
                                 "src/samplerate/src_sinc.c",
                                 "src/samplerate/src_zoh.c",
                                 "src/samplerate/src_linear.c"],
                        define_macros=[("HAS_PYTHON", None)])
Beispiel #49
0
    def __init__(self, root = "", module_root = ""):
        path = join(root, 'pypredict', 'lm')
        sources = [join(path, x) for x in self.sources]

        module_name = "pypredict.lm"
        if module_root:
            module_name = module_root + "." + module_name

        Extension.__init__(self,
                           module_name,
                           sources = sources,
                           depends = self.depends,             
                           undef_macros = [],
                           library_dirs = [],
                           libraries = [],
                           #define_macros=[('NDEBUG', '1')], 
                          )
    def __init__(self, root = "", module_root = ""):
        path = join(root, 'pypredict', 'lm')
        sources = [join(path, x) for x in self.sources]

        module_name = "pypredict.lm"
        if module_root:
            module_name = module_root + "." + module_name

        Extension.__init__(self,
                           module_name,
                           sources = sources,
                           depends = self.depends,             
                           undef_macros = [],
                           library_dirs = [],
                           libraries = [],
                           #define_macros=[('NDEBUG', '1')], 
                          )
Beispiel #51
0
    def __init__(self, name, sources, **kwargs):
        # the goal is to rely on original Extension
        # to do so we convert the .py to .cpp with pythran
        # and register the .cpp in place of the .py
        # That's stage 0, and it's enough if you get the source
        # from github and `python setup.py install it`
        #
        # *But* if you want to distribute the source through
        # `python setup.py sdist` then the .py no longer exists
        # and only the .cpp is distributed. That's stage 1

        cxx_sources = []
        for source in sources:
            base, ext = os.path.splitext(source)
            output_file = base + '.cpp'  # target name

            # stage 0 when we have the .py
            if os.path.exists(source):
                stage = 0
            # stage 1 otherwise. `.cpp' should already be there
            # as generated upon stage 0
            else:
                assert os.path.exists(output_file)
                stage = 1
                ext = '.cpp'
                source = output_file

            # stage-dependant processing
            if stage == 0:
                tc.compile_pythranfile(source,
                                       output_file,
                                       module_name=name,
                                       cpponly=True)
            cxx_sources.append(output_file)

        # in both cases, setup the flags in a pythran-compatible way.
        kwargs['language'] = 'c++'
        kwargs.setdefault('extra_compile_args',
                          []).extend(tc.cppflags() + tc.cxxflags())
        # FIXME: force the compiler to be pythran's ones
        # I cannot find a way to do this in a less intrusive manner
        os.environ['CC'] = tc.default_compiler()
        os.environ['CXX'] = tc.default_compiler()
        kwargs.setdefault('extra_link_args', []).extend(tc.ldflags())
        Extension.__init__(self, name, cxx_sources, **kwargs)
Beispiel #52
0
    def __init__(self, mpath, sources, rustlibname, subcrate, **kw):
        Extension.__init__(self, mpath, sources, **kw)
        if not iswithrustextensions:
            return
        srcdir = self.rustsrcdir = os.path.join('rust', subcrate)
        self.libraries.append(rustlibname)
        self.extra_compile_args.append('-DWITH_RUST')

        # adding Rust source and control files to depends so that the extension
        # gets rebuilt if they've changed
        self.depends.append(os.path.join(srcdir, 'Cargo.toml'))
        cargo_lock = os.path.join(srcdir, 'Cargo.lock')
        if os.path.exists(cargo_lock):
            self.depends.append(cargo_lock)
        for dirpath, subdir, fnames in os.walk(os.path.join(srcdir, 'src')):
            self.depends.extend(
                os.path.join(dirpath, fname) for fname in fnames
                if os.path.splitext(fname)[1] == '.rs')
Beispiel #53
0
 def __init__(self, name, sources, **kwargs):
     Extension.__init__(self, name, sources, **kwargs)
     is64 = platform.architecture()[0].startswith('64')
     self.libraries.append('cudart')
     self.libraries.append('cufft')
     self.include_dirs.append(os.path.join(CUDA_DIR, 'include'))
     if is64 and os.path.exists(os.path.join(CUDA_DIR,'lib64')):
         self.library_dirs.append(os.path.join(CUDA_DIR,'lib64'))
     else: self.library_dirs.append(os.path.join(CUDA_DIR, 'lib'))
     try: self.cuda_sources = kwargs.pop('cuda_sources')
     except(KeyError): self.cuda_sources = []
     try: self.cuda_extra_compile_args = kwargs.pop('cuda_extra_compile_args')
     except(KeyError): self.cuda_extra_compile_args = []
     # NVCC wants us to call out 64/32-bit compiling explicitly
     if is64: self.cuda_extra_compile_args.append('-m64')
     else: self.cuda_extra_compile_args.append('-m32')
     self.cuda_extra_compile_args.append('-Xcompiler')
     self.cuda_extra_compile_args.append('-fPIC')
Beispiel #54
0
    def __init__(self,
                 name,
                 sources,
                 libs=[],
                 incdirs=[],
                 libdirs=[],
                 define_macros=[],
                 swig_args=[]):
        Extension.__init__(self,
                           name=name,
                           sources=sources,
                           libraries=libs,
                           include_dirs=incdirs,
                           library_dirs=libdirs,
                           define_macros=define_macros)

        self.swig_basename = name
        self.swig_extra_args = swig_args
Beispiel #55
0
    def __init__(self, module, sources=None, **keywords):

        if sources is None:
            sources = [module + "module.c"]

        if "include_dirs" not in keywords.keys():
            keywords["include_dirs"] = []
        keywords["include_dirs"].append(numinclude.include_dir)

        if "extra_compile_args" not in keywords.keys():
            keywords["extra_compile_args"] = []
        keywords["extra_compile_args"].extend(EXTRA_COMPILE_ARGS)

        if "extra_link_args" not in keywords.keys():
            keywords["extra_link_args"] = []
        keywords["extra_link_args"].extend(EXTRA_LINK_ARGS)

        Extension.__init__(self, module, sources, **keywords)
 def __init__(self,
              name,
              jars=None,
              packages=None,
              classpath=None,
              classes=None,
              excludes=None,
              mappings=None,
              sequences=None,
              version=None):
     Extension.__init__(self, name, [], include_dirs=jni_includes())
     self.jcc_jars = jars or []
     self.jcc_packages = packages or []
     self.jcc_classpath = classpath or []
     self.jcc_classes = classes or []
     self.jcc_excludes = excludes or []
     self.jcc_mappings = mappings or {}
     self.jcc_sequences = mappings or {}
     self.jcc_version = version
Beispiel #57
0
    def __init__(self, *args, **kwargs):
        if 'define_macros' in kwargs or 'undef_macros' in kwargs:
            raise DistutilsOptionError(
                'D does not support macros, so the'
                ' "define_macros" and "undef_macros" arguments are not'
                ' supported.  Instead, consider using the "Version Condition"'
                ' and "Debug Condition" conditional compilation features'
                ' documented at http://www.digitalmars.com/d/version.html'
                '\n  Version flags can be passed to the compiler via the'
                ' "version_flags" keyword argument to DExtension; debug flags'
                ' via the "debug_flags" keyword argument.  For example, when'
                ' used with the DMD compiler,'
                '\n    DExtension(..., version_flags=["a", "b"])'
                '\nwill cause'
                '\n    -version=a -version=b'
                '\nto be passed to the compiler.')

        # If the user has requested any version_flags or debug_flags, we use
        # the distutils 'define_macros' keyword argument to carry them (they're
        # later unpacked in the dcompiler module).

        self.version_flags = kwargs.pop('version_flags', [])
        self.debug_flags = kwargs.pop('debug_flags', [])

        if 'raw_only' in kwargs:
            kwargs['with_pyd'] = False
            kwargs['with_main'] = False
            del kwargs['raw_only']
        self.with_pyd = kwargs.pop('with_pyd', True)
        self.build_deimos = kwargs.pop('build_deimos', False)
        self.with_main = kwargs.pop('with_main', True)
        self.pyd_optimize = kwargs.pop('optimize', False)
        self.d_unittest = kwargs.pop('d_unittest', False)
        self.d_property = kwargs.pop('d_property', False)
        self.d_lump = kwargs.pop('d_lump', False)
        self.string_imports = kwargs.pop('string_imports', [])
        if self.with_main and not self.with_pyd:
            # The special PydMain function should only be used when using Pyd
            self.with_main = False

        std_Extension.__init__(self, *args, **kwargs)