def finalize_options(self):
        self.set_undefined_options(
            'install',
            ('extra_compile_args', 'extra_compile_args'),
            ('extra_link_args', 'extra_link_args'),
            ('with_mysql_capi', 'with_mysql_capi'),
            ('with_protobuf_include_dir', 'with_protobuf_include_dir'),
            ('with_protobuf_lib_dir', 'with_protobuf_lib_dir'),
            ('with_protoc', 'with_protoc'))

        build_ext.finalize_options(self)

        print("# Python architecture: {0}".format(py_arch))
        print("# Python ARCH_64BIT: {0}".format(ARCH_64BIT))

        if self.with_mysql_capi:
            self._finalize_connector_c(self.with_mysql_capi)

        if not self.with_protobuf_include_dir:
            self.with_protobuf_include_dir = \
                os.environ.get("MYSQLXPB_PROTOBUF_INCLUDE_DIR")

        if not self.with_protobuf_lib_dir:
            self.with_protobuf_lib_dir = \
                os.environ.get("MYSQLXPB_PROTOBUF_LIB_DIR")

        if not self.with_protoc:
            self.with_protoc = os.environ.get("MYSQLXPB_PROTOC")

        self.with_mysqlxpb_cext = any((self.with_protobuf_include_dir,
                                       self.with_protobuf_lib_dir,
                                       self.with_protoc))
 def finalize_options(self):
     # Validate the --enable-openmp and --disable-openmp command line options:
     # the user should provide at most one of them.
     if self.enable_openmp and self.disable_openmp:
         raise _DistutilsOptionError("--enable-openmp and --disable-openmp are mutually exclusive")
     # Chain to method in parent class.
     _build_ext.finalize_options(self)
Esempio n. 3
0
 def finalize_options(self) :
     build_ext.finalize_options(self)
     if self.sndfile_libdir  is not None :
         self.library_dirs.append(self.sndfile_libdir)
         self.rpath.append(self.sndfile_libdir)
     if self.sndfile_incdir  is not None :
         self.include_dirs.append(self.sndfile_incdir)
Esempio n. 4
0
 def finalize_options (self):
     build_ext.finalize_options (self)
     #
     # split libraries, since Python does not expand them by default
     #
     if self.libraries:
         self.libraries = self.libraries[0].split (os.pathsep)
Esempio n. 5
0
    def finalize_options(self):
        build_ext.finalize_options(self)
        if self.sdl_location is None:

            # The default SDL location.  This is useful only if your
            # SDL source is installed under a common root, with
            # sdl_loc/include and sdl_loc/lib directories beneath that
            # root.  This is the standard way that SDL is distributed
            # on Windows, but not on Unix.  For a different
            # configuration, just specify --include-dirs and
            # --library-dirs separately.

            if env == ENV_WINDOWS:
                # For a default location on Windows, look around for SDL
                # in the current directory.
                sdl_dirs = glob.glob('SDL*')

                # Sort them in order, so that the highest-numbered version
                # will (probably) fall to the end.
                sdl_dirs.sort()

                for dir in sdl_dirs:
                    if os.path.isdir(os.path.join(dir, 'include')):
                        self.sdl_location = dir

        if self.sdl_location is not None:
            # Now append the system paths.
            self.include_dirs.append(os.path.join(self.sdl_location, 'include'))
            self.library_dirs.append(os.path.join(self.sdl_location, 'lib'))

            # Also put the lib dir on the PATH, so py2exe can find SDL.dll.
            if env == ENV_WINDOWS:
                libdir = os.path.join(self.sdl_location, 'lib')
                os.environ["PATH"] = '%s;%s' % (libdir, os.environ["PATH"])
Esempio n. 6
0
    def finalize_options(self):
        if self.include_dirs is None:
            self.include_dirs = include_dirs
        # Needed on recent MacOSX
        elif isinstance(self.include_dirs, str) and sys.platform == 'darwin':
            self.include_dirs += ':' + ':'.join(include_dirs)
        if self.library_dirs is None:
            self.library_dirs = library_dirs
        # Needed on recent MacOSX
        elif isinstance(self.library_dirs, str) and sys.platform == 'darwin':
            self.library_dirs += ':' + ':'.join(library_dirs)
        if self.libraries is None:
            if self.get_compiler() == 'msvc':
                libraries.remove('gdal')
                libraries.append('gdal_i')
            self.libraries = libraries

        build_ext.finalize_options(self)

        self.include_dirs.append(self.numpy_include_dir)

        if self.get_compiler() == 'msvc':
            return True

        self.gdaldir = self.get_gdal_config('prefix')
        self.library_dirs.append(os.path.join(self.gdaldir,'lib'))
        self.include_dirs.append(os.path.join(self.gdaldir,'include'))
Esempio n. 7
0
 def finalize_options(self):
     #  #[ make settings available
     """ copy user defined options from the build to the
     build_ext class instance """
     # this copies the user_options from the build
     # to the build_ext class, so I'll have to modify
     # the build class as well to allow new options
     self.set_undefined_options('build',
                                ('preferred_fortran_compiler',
                                 'preferred_fortran_compiler'),
                                ('preferred_c_compiler',
                                 'preferred_c_compiler'),
                                ('fortran_compiler',
                                 'fortran_compiler'),
                                ('fortran_ld_library_path',
                                 'fortran_ld_library_path'),
                                ('fortran_flags',
                                 'fortran_flags'),
                                ('c_compiler',
                                 'c_compiler'),
                                ('c_ld_library_path',
                                 'c_ld_library_path'),
                                ('c_flags',
                                 'c_flags'),
                                ('download_library_sources',
                                 'download_library_sources')
                                )
     _build_ext.finalize_options(self)
Esempio n. 8
0
 def finalize_options(self):
     _build_ext.finalize_options(self)
     self.set_undefined_options('build',
                                ('petsc_dir',  'petsc_dir'),
                                ('petsc_arch', 'petsc_arch'))
     import sys, os
     from distutils import sysconfig
     if ((sys.platform.startswith('linux') or
          sys.platform.startswith('gnu') or
          sys.platform.startswith('sunos')) and
         sysconfig.get_config_var('Py_ENABLE_SHARED')):
         py_version = sysconfig.get_python_version()
         bad_pylib_dir = os.path.join(sys.prefix, "lib",
                                      "python" + py_version,
                                      "config")
         try:
             self.library_dirs.remove(bad_pylib_dir)
         except ValueError:
             pass
         pylib_dir = sysconfig.get_config_var("LIBDIR")
         if pylib_dir not in self.library_dirs:
             self.library_dirs.append(pylib_dir)
         if pylib_dir not in self.rpath:
             self.rpath.append(pylib_dir)
         if sys.exec_prefix == '/usr':
             self.library_dirs.remove(pylib_dir)
             self.rpath.remove(pylib_dir)
Esempio n. 9
0
 def finalize_options(self):
     self.pyev_options = {}
     build_ext.finalize_options(self)
     if "sdist" not in sys.argv:
         plat_name = os.name
         if plat_name not in pyev_platforms:
             raise SystemExit("Aborted: platform '{0}' "
                              "not supported".format(plat_name))
         self.pyev_options.update(pyev_platforms[plat_name])
         # libraries
         libraries = self.pyev_options["libraries"]
         if hasattr(libraries, "__call__"):
             libraries = libraries()
         if libraries:
             if self.libraries:
                 self.libraries.extend(libraries)
             else:
                 self.libraries = libraries
         # define
         define_fmt = self.pyev_options["define_fmt"]
         define = [
                   ("PYEV_VERSION", define_fmt.format(pyev_version)),
                   ("LIBEV_VERSION", define_fmt.format(libev_version)),
                  ]
         if self.define:
             self.define.extend(define)
         else:
             self.define = define
Esempio n. 10
0
    def finalize_options(self):
        if self.parallel:
            try:
                self.parallel = int(self.parallel)
            except ValueError:
                raise ValueError("--parallel/-j argument must be an integer")

        # Ensure that self.include_dirs and self.distribution.include_dirs
        # refer to the same list object. finalize_options will modify
        # self.include_dirs, but self.distribution.include_dirs is used
        # during the actual build.
        # self.include_dirs is None unless paths are specified with
        # --include-dirs.
        # The include paths will be passed to the compiler in the order:
        # numpy paths, --include-dirs paths, Python include path.
        if isinstance(self.include_dirs, str):
            self.include_dirs = self.include_dirs.split(os.pathsep)
        incl_dirs = self.include_dirs or []
        if self.distribution.include_dirs is None:
            self.distribution.include_dirs = []
        self.include_dirs = self.distribution.include_dirs
        self.include_dirs.extend(incl_dirs)

        old_build_ext.finalize_options(self)
        self.set_undefined_options('build', ('parallel', 'parallel'))
Esempio n. 11
0
    def finalize_options(self):
        _build_ext.finalize_options(self)
        if self.inplace:
            for x in self.distribution.packages:
                self.library_dirs.append(x)
        else:
            self.library_dirs.append(self.build_lib)
            for x in self.distribution.packages:
                self.library_dirs.append(join(self.build_lib,x))
        if sys.platform.lower().startswith("linux"):
            # allow shared library to be found in same folder as
            # dependent module
            for x in self.extensions:
                if len(x.libraries): x.runtime_library_dirs=["$ORIGIN"]

        # find out the name of built libraries so that
        # dependent modules know what name to use
        # since debug versions and python3 output names are modified
        # depending on the python version, architecture etc...

        lib_fix = []
        for x in self.extensions:
            w = x.name.split('.')[-1]
            if w.startswith('lib'):
                n = w[3:]
                z = self.get_ext_filename(x.name)
                z = (splitext(split(z)[-1])[0])[3:]
                if z != n: lib_fix.append((x,n,z))
        if lib_fix:
            for l in lib_fix:
                for x in self.extensions:
                    if l[0] != x and x.libraries:
                        x.libraries[:] = [v if v!=l[1] else l[2]
                                            for v in x.libraries]
Esempio n. 12
0
    def finalize_options(self):
        if self.include_dirs is None:
            self.include_dirs = include_dirs
        if self.library_dirs is None:
            self.library_dirs = library_dirs
        if self.libraries is None:
            if self.get_compiler() == "msvc":
                libraries.remove("gdal")
                libraries.append("gdal_i")
            self.libraries = libraries

        build_ext.finalize_options(self)

        self.include_dirs.append(self.numpy_include_dir)

        if self.get_compiler() == "msvc":
            return True
        try:
            self.gdaldir = self.get_gdal_config("prefix")
        except:
            print ("Could not run gdal-config!!!! 1")
        try:
            self.library_dirs.append(os.path.join(self.gdaldir, "lib"))
            print self.library_dirs
        except:
            print ("Could not run gdal-config!!!! 2")
        try:
            self.include_dirs.append(os.path.join(self.gdaldir, "include"))
            print self.include_dirs
        except:
            print ("Could not run gdal-config!!!! 3")
Esempio n. 13
0
File: setup.py Progetto: fabioz/coev
    def finalize_options(self):
        """Complete the build system configuation."""
        build_ext.finalize_options(self)

        self.include_dirs.append(".")
        self.libraries.append("pq")
        self.libraries.append("ucoev")

        try:
            self.library_dirs.append(self.get_pg_config("libdir"))
            self.include_dirs.append(self.get_pg_config("includedir"))
            self.include_dirs.append(self.get_pg_config("includedir-server"))
            try:
                # Here we take a conservative approach: we suppose that
                # *at least* PostgreSQL 7.4 is available (this is the only
                # 7.x series supported by psycopg 2)
                pgversion = self.get_pg_config("version").split()[1]
            except:
                pgversion = "7.4.0"
            pgmajor, pgminor, pgpatch = pgversion.split('.')
            define_macros.append(("PG_VERSION_HEX", "0x%02X%02X%02X" %
                                  (int(pgmajor), int(pgminor), int(pgpatch))))
        except Warning, w:
            if self.pg_config == self.DEFAULT_PG_CONFIG:
                sys.stderr.write("Warning: %s" % str(w))
            else:
                sys.stderr.write("Error: %s" % str(w))
                sys.exit(1)
Esempio n. 14
0
    def finalize_options(self):
        """Complete the build system configuation."""
        build_ext.finalize_options(self)
        if self.pg_config is None:
            self.pg_config = self.autodetect_pg_config_path()
        if self.pg_config is None:
            sys.stderr.write("""\
Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

    python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.
""")
            sys.exit(1)

        self.include_dirs.append(".")
        if self.static_libpq:
            if not self.link_objects: self.link_objects = []
            self.link_objects.append(
                    os.path.join(self.get_pg_config("libdir"), "libpq.a"))
        else:
            self.libraries.append("pq")

        try:
            self.library_dirs.append(self.get_pg_config("libdir"))
            self.include_dirs.append(self.get_pg_config("includedir"))
            self.include_dirs.append(self.get_pg_config("includedir-server"))
            try:
                # Here we take a conservative approach: we suppose that
                # *at least* PostgreSQL 7.4 is available (this is the only
                # 7.x series supported by psycopg 2)
                pgversion = self.get_pg_config("version").split()[1]
            except:
                pgversion = "7.4.0"

            verre = re.compile(r"(\d+)\.(\d+)(?:(?:\.(\d+))|(devel|(alpha|beta|rc)\d+))")
            m = verre.match(pgversion)
            if m:
                pgmajor, pgminor, pgpatch = m.group(1, 2, 3)
                if pgpatch is None or not pgpatch.isdigit():
                    pgpatch = 0
            else:
                sys.stderr.write(
                    "Error: could not determine PostgreSQL version from '%s'"
                                                                % pgversion)
                sys.exit(1)

            define_macros.append(("PG_VERSION_HEX", "0x%02X%02X%02X" %
                                  (int(pgmajor), int(pgminor), int(pgpatch))))
        except Warning:
            w = sys.exc_info()[1] # work around py 2/3 different syntax
            sys.stderr.write("Error: %s\n" % w)
            sys.exit(1)

        if hasattr(self, "finalize_" + sys.platform):
            getattr(self, "finalize_" + sys.platform)()
Esempio n. 15
0
    def finalize_options(self):
        if self.include_dirs is None:
            self.include_dirs = include_dirs
        
        includes =  self.get_mapserver_config('includes')
        includes = includes.split()
        for item in includes:
            if item[:2] == '-I' or item[:2] == '/I':
                if item[2:] not in include_dirs:
                    self.include_dirs.append( item[2:] )

        if self.library_dirs is None:
            self.library_dirs = library_dirs

        libs =  self.get_mapserver_config('libs')
        self.library_dirs = self.library_dirs + [x[2:] for x in libs.split() if x[:2] == "-L"]

        # silly stuff to deal with setuptools doing things 
        # like -D-DMYDEFINE
        defs = self.get_mapserver_config('defines')
        self.define = [x[2:] for x in defs.split() if x[:2] == "-D"]
        self.define = ','.join(self.define)

        ex_next = False
        libs = libs.split()
        for x in libs:
            if ex_next:
                extra_link_args.append(x)
                ex_next = False
            elif x[:2] == '-l':
                libraries.append( x[2:] )
            elif x[-4:] == '.lib' or x[-4:] == '.LIB':
                dir, lib = os.path.split(x)
                libraries.append( lib[:-4] )
                if len(dir) > 0:
                    self.library_dirs.append( dir )
            elif x[-2:] == '.a':
                extra_link_args.append(x)
            elif x[:10] == '-framework':
                extra_link_args.append(x)
                ex_next = True
            elif x[:2] == '-F':
                extra_link_args.append(x)
                
        # don't forget to add mapserver lib
        self.libraries = unique(libraries) + ['mapserver',]

        if self.get_compiler() == 'msvc':
            for lib in self.libraries:
                if lib == 'mapserver':
                    self.libraries.remove(lib)
            self.libraries.append('mapserver_i')
            self.libraries.append('gd')
            self.libraries = unique(self.libraries)
        build_ext.finalize_options(self)
        
        self.dir = os.path.abspath('../..')
        self.library_dirs.append(self.dir)
        self.include_dirs.append(self.dir)
Esempio n. 16
0
    def finalize_options(self):
        if self.include_dirs is None:
            self.include_dirs = include_dirs

        includes = self.get_mapserver_config("includes")
        includes = includes.split()
        for item in includes:
            if item[:2] == "-I" or item[:2] == "/I":
                if item[2:] not in include_dirs:
                    self.include_dirs.append(item[2:])

        if self.library_dirs is None:
            self.library_dirs = library_dirs

        libs = self.get_mapserver_config("libs")
        self.library_dirs = self.library_dirs + [x[2:] for x in libs.split() if x[:2] == "-L"]

        # silly stuff to deal with setuptools doing things
        # like -D-DMYDEFINE
        defs = self.get_mapserver_config("defines")
        self.define = [x[2:] for x in defs.split() if x[:2] == "-D"]
        self.define = ",".join(self.define)

        ex_next = False
        libs = libs.split()
        for x in libs:
            if ex_next:
                extra_link_args.append(x)
                ex_next = False
            elif x[:2] == "-l":
                libraries.append(x[2:])
            elif x[-4:] == ".lib" or x[-4:] == ".LIB":
                dir, lib = os.path.split(x)
                libraries.append(lib[:-4])
                if len(dir) > 0:
                    self.library_dirs.append(dir)
            elif x[-2:] == ".a":
                extra_link_args.append(x)
            elif x[:10] == "-framework":
                extra_link_args.append(x)
                ex_next = True
            elif x[:2] == "-F":
                extra_link_args.append(x)

        # don't forget to add mapserver lib
        self.libraries = unique(libraries) + ["mapserver"]

        if self.get_compiler() == "msvc":
            for lib in self.libraries:
                if lib == "mapserver":
                    self.libraries.remove(lib)
            self.libraries.append("mapserver_i")
            self.libraries.append("gd")
            self.libraries = unique(self.libraries)
        build_ext.finalize_options(self)

        self.dir = os.path.abspath("../..")
        self.library_dirs.append(self.dir)
        self.include_dirs.append(self.dir)
 def finalize_options(self):
     build_ext.finalize_options(self)
     self.tempdir = pjoin(self.build_temp, 'scratch')
     self.has_run = False
     self.config = discover_settings(self.build_base)
     if self.zmq is not None:
         merge(self.config, config_from_prefix(self.zmq))
     self.init_settings_from_config()
Esempio n. 18
0
    def finalize_options(self):
        """Complete the build system configuration."""
        build_ext.finalize_options(self)

        sip_config = SipConfig(self)

        if hasattr(self, "finalize_" + sys.platform):
            getattr(self, "finalize_" + sys.platform)()
Esempio n. 19
0
 def finalize_options (self):
     if self.library_dirs is None:
         self.library_dirs = []
     elif isinstance(self.library_dirs, basestring):
         self.library_dirs = self.library_dirs.split(os.pathsep)
     
     self.library_dirs.insert(0, os.path.join(sys.real_prefix, "Libs"))
     old_build_ext.finalize_options(self)
Esempio n. 20
0
    def finalize_options(self):
        self.set_undefined_options('install',
                                   ('with_mysql_capi', 'with_mysql_capi'))

        build_ext.finalize_options(self)

        if self.with_mysql_capi:
            self._finalize_connector_c(self.with_mysql_capi)
Esempio n. 21
0
 def finalize_options(self):
     build_ext.finalize_options(self)
     self.ensure_file_exists("boost_include_dir", "boost/python.hpp")
     self.ensure_dirname("boost_library_dir")
     self.ensure_file_exists("timbl_include_dir", "timbl/TimblAPI.h")
     self.ensure_dirname("timbl_library_dir")
     self.ensure_file_exists("libxml2_include_dir", "libxml/tree.h")
     self.ensure_dirname("libxml2_library_dir")
Esempio n. 22
0
 def finalize_options(self):
     build_ext.finalize_options(self)
     if self.devel:
         for ext in self.extensions:
             if hasattr(ext, "extra_compile_args"):
                 ext.extra_compile_args.extend(self.extra_cflags)
             else:
                 ext.extra_compile_args = self.extra_cflags
Esempio n. 23
0
 def finalize_options(self):
     build_ext.finalize_options(self)
     if self.cuda_root is None:
         self.cuda_root = os.getenv('CUDA_ROOT', None)
     if self.cuda_root is not None:
         self._nvcc_bin = os.path.join(self.cuda_root, 'bin', 'nvcc')
     else:
         self._nvcc_bin = 'nvcc'
Esempio n. 24
0
 def finalize_options(self):
     self.set_undefined_options(
         'build', 
         ('with_static_binutils','with_static_binutils'))
     self.set_undefined_options(
         'install', 
         ('with_static_binutils','with_static_binutils'))
     build_ext.finalize_options(self)
Esempio n. 25
0
 def finalize_options(self):
     build_ext.finalize_options(self)
     for x in self.feature:
         if getattr(self, "disable_%s" % x):
             setattr(self.feature, x, False)
             if getattr(self, "enable_%s" % x):
                 raise ValueError("Conflicting options: --enable-%s and --disable-%s" % (x, x))
         if getattr(self, "enable_%s" % x):
             self.feature.required.append(x)
Esempio n. 26
0
 def finalize_options(self):
     if isinstance(self.include_dirs, str):
         self.include_dirs = self.include_dirs.split(os.pathsep)
     incl_dirs = self.include_dirs or []
     if self.distribution.include_dirs is None:
         self.distribution.include_dirs = []
     self.include_dirs = self.distribution.include_dirs
     self.include_dirs.extend(incl_dirs)
     old_build_ext.finalize_options(self)
Esempio n. 27
0
 def finalize_options(self):
     """
     Update build options with details about OpenSSL.
     """
     build_ext.finalize_options(self)
     if self.with_openssl is None:
         self.find_openssl()
     self.find_openssl_dlls()
     self.add_openssl_compile_info()
    def finalize_options(self):
        self.set_undefined_options('install',
                                   ('with_mysql_capi', 'with_mysql_capi'))

        build_ext.finalize_options(self)
        self.connc_lib = os.path.join(self.build_temp, 'connc', 'lib')
        self.connc_include = os.path.join(self.build_temp, 'connc', 'include')

        if self.with_mysql_capi:
            self._finalize_connector_c(self.with_mysql_capi)
Esempio n. 29
0
    def finalize_options(self):
        self.set_undefined_options('build',
                                   #('r_autoconfig', 'r_autoconfig'),
                                   ('r_home', 'r_home'))

        _build_ext.finalize_options(self) 
        if self.r_home is None:
            tmp = os.popen("R RHOME")
            self.r_home = tmp.readlines()
            tmp.close()
            self.r_home = ['/app/vendor/R/lib64/R\n']
            if len(self.r_home) == 0:
                raise SystemExit("Error: Tried to guess R's HOME but no R command in the PATH.")

    #Twist if 'R RHOME' spits out a warning
            if self.r_home[0].startswith("WARNING"):
                self.r_home = self.r_home[1]
            else:
                self.r_home = self.r_home[0]
            #self.r_home = [self.r_home, ]

        if self.r_home is None:
            raise SystemExit("Error: --r-home not specified.")
        else:
            self.r_home = self.r_home.split(os.pathsep)

        rversions = []
        for r_home in self.r_home:
            r_home = r_home.strip()
        rversion = get_rversion(r_home)
        if rversion[0] == 'development' or \
                cmp_version(rversion[:2], [2, 8]) == -1:
            if self.ignore_check_rversion:
                warnings.warn("R did not seem to have the minimum required version number")
            else:
                raise SystemExit("Error: R >= 2.8 required (and R told '%s')." %'.'.join(rversion))    
        rversions.append(rversion)

        config = RConfig()
        for about in ('--ldflags', '--cppflags'):
            config += get_rconfig(r_home, about)
        for about in ('LAPACK_LIBS', 'BLAS_LIBS'):
            config += get_rconfig(r_home, about, True)

        print(config.__repr__())

        self.include_dirs.extend(config._include_dirs)
        self.libraries.extend(config._libraries)
        self.library_dirs.extend(config._library_dirs)

        if self.r_home_modules is None:
            self.library_dirs.extend([os.path.join(r_home, 'modules'), ])
        else:
            self.library_dirs.extend([self.r_home_modules, ])
Esempio n. 30
0
 def finalize_options(self):
     if self.jobs:
         try:
             self.jobs = int(self.jobs)
         except ValueError:
             raise ValueError("--jobs/-j argument must be an integer")
     incl_dirs = self.include_dirs
     old_build_ext.finalize_options(self)
     if incl_dirs is not None:
         self.include_dirs.extend(self.distribution.include_dirs or [])
     self.set_undefined_options('build', ('jobs', 'jobs'))
Esempio n. 31
0
 def finalize_options(self):
     _build_ext.finalize_options(self)
     self.build_lib  = build_lib
     self.build_temp = build_tmp
Esempio n. 32
0
    def finalize_options(self):
        """Complete the build system configuration."""
        # An empty option in the setup.cfg causes self.libraries to include
        # an empty string in the list of libraries
        if self.libraries is not None and not self.libraries.strip():
            self.libraries = None

        build_ext.finalize_options(self)

        pg_config_helper = PostgresConfig(self)

        self.include_dirs.append(".")
        if self.static_libpq:
            if not getattr(self, 'link_objects', None):
                self.link_objects = []
            self.link_objects.append(
                os.path.join(pg_config_helper.query("libdir"), "libpq.a"))
        else:
            self.libraries.append("pq")

        try:
            self.library_dirs.append(pg_config_helper.query("libdir"))
            self.include_dirs.append(pg_config_helper.query("includedir"))
            self.include_dirs.append(
                pg_config_helper.query("includedir-server"))
            try:
                # Here we take a conservative approach: we suppose that
                # *at least* PostgreSQL 7.4 is available (this is the only
                # 7.x series supported by psycopg 2)
                pgversion = pg_config_helper.query("version").split()[1]
            except Exception:
                pgversion = "7.4.0"

            verre = re.compile(
                r"(\d+)(?:\.(\d+))?(?:(?:\.(\d+))|(devel|(?:alpha|beta|rc)\d+))?"
            )
            m = verre.match(pgversion)
            if m:
                pgmajor, pgminor, pgpatch = m.group(1, 2, 3)
                # Postgres >= 10 doesn't have pgminor anymore.
                pgmajor = int(pgmajor)
                if pgmajor >= 10:
                    pgminor, pgpatch = None, pgminor
                if pgminor is None or not pgminor.isdigit():
                    pgminor = 0
                if pgpatch is None or not pgpatch.isdigit():
                    pgpatch = 0
                pgminor = int(pgminor)
                pgpatch = int(pgpatch)
            else:
                sys.stderr.write(
                    "Error: could not determine PostgreSQL version from '%s'" %
                    pgversion)
                sys.exit(1)

            define_macros.append(
                ("PG_VERSION_NUM", "%d%02d%02d" % (pgmajor, pgminor, pgpatch)))

            # enable lo64 if libpq >= 9.3 and Python 64 bits
            if (pgmajor, pgminor) >= (9, 3) and is_py_64():
                define_macros.append(("HAVE_LO64", "1"))

                # Inject the flag in the version string already packed up
                # because we didn't know the version before.
                # With distutils everything is complicated.
                for i, t in enumerate(define_macros):
                    if t[0] == 'PSYCOPG_VERSION':
                        n = t[1].find(')')
                        if n > 0:
                            define_macros[i] = (t[0],
                                                t[1][:n] + ' lo64' + t[1][n:])

        except Warning:
            w = sys.exc_info()[1]  # work around py 2/3 different syntax
            sys.stderr.write("Error: %s\n" % w)
            sys.exit(1)

        if hasattr(self, "finalize_" + sys.platform):
            getattr(self, "finalize_" + sys.platform)()
Esempio n. 33
0
    def finalize_options(self):
        _build_ext.finalize_options(self)

        if not self.esql_informixdir:
            self.esql_informixdir = os.getenv("INFORMIXDIR")
        if not self.esql_informixdir:
            if get_platform() == "win32":
                self.esql_informixdir = "C:\\Program Files\\Informix\\Client-SDK"
            else:
                self.esql_informixdir = "/usr/informix"
        os.environ['INFORMIXDIR'] = self.esql_informixdir

        self.esql_parts.append(
            os.path.join(self.esql_informixdir, 'bin', 'esql'))
        if get_platform() == "win32":
            if self.esql_parts[0].find(' ') != -1:
                self.esql_parts[0] = '"' + self.esql_parts[0] + '"'

        if self.esql_threadlib:
            os.environ['THREADLIB'] = self.esql_threadlib
            self.esql_parts.append('-thread')
            if self.define is None:
                self.define = []
            self.define += [('IFX_THREAD', None), ('_REENTRANT', None)]

        if self.esql_static:
            self.esql_parts.append('-static')

        if self.testing:
            self.undef_macros.append('NDEBUG')

        # determine esql version
        driver_name = "INFORMIX-ESQL"
        driver_version = "Unknown"
        esqlver = re.compile(r"(IBM)?.*ESQL Version ((\d+)\.(\d+)[^ ]*)")
        cout = os.popen(' '.join(self.esql_parts[0:1] + ['-V']), 'r')
        esqlversion = None
        for line in cout:
            matchobj = esqlver.match(line)
            if matchobj:
                matchgroups = matchobj.groups()
                driver_version = matchgroups[1].strip()
                esqlversion = int(matchgroups[2] + matchgroups[3])
                if matchgroups[0] == "IBM":
                    # Assume ESQL 9.xx for any IBM branded CSDK.
                    driver_name = "IBM Informix-ESQL"
                    esqlversion = 960
        if esqlversion == None:
            esqlversion = 850
        f = open(os.path.join("ext", "esqlver.h"), "w")
        f.write("""\
#define DRIVER_NAME "%(driver_name)s"
#define DRIVER_VERSION "%(driver_version)s"
""" % locals())
        f.close()

        # find esql libs/objects
        cout = os.popen(' '.join(self.esql_parts + ['-libs']), 'r')
        esql_config = []
        lexer = shlex.shlex(cout)
        lexer.wordchars += '-.\\/'
        while True:
            token = lexer.get_token()
            if token == '' or token == None: break
            if token.startswith('"') and token.endswith('"'):
                token = token[1:-1]
            esql_config.append(token)
        ret = cout.close()
        if ret != None:
            raise DistutilsSetupError, """\
Can't run esql. Please make sure that:
   * You have the Informix CSDK installed,
   * INFORMIXDIR is set to where Informix CSDK is installed, and
   * esql is in your PATH.

See the README for build requirements.
"""

        if get_platform() == "win32":
            for arg in esql_config:
                if arg.endswith('.lib'):
                    if self.libraries is None:
                        self.libraries = []
                    self.libraries.append(arg[:-4])
        else:
            for arg in esql_config:
                if arg.startswith('-l'):
                    if self.libraries is None:
                        self.libraries = []
                    self.libraries.append(arg[2:])
                else:
                    if self.link_objects is None:
                        self.link_objects = []
                    self.link_objects.append(arg)

        if self.include_dirs is None:
            self.include_dirs = []
        self.include_dirs = [os.path.join(self.esql_informixdir,'incl','esql')]\
                            + self.include_dirs

        if self.library_dirs is None:
            self.library_dirs = []
        self.library_dirs += [
            os.path.join(self.esql_informixdir, 'lib', 'esql'),
            os.path.join(self.esql_informixdir, 'lib')
        ]
Esempio n. 34
0
 def finalize_options(self):
     build_ext.finalize_options(self)
     gmpy_build_ext.doit(self)
Esempio n. 35
0
 def finalize_options(self):
     if self.my_inplace is None:
         self.my_inplace = self.inplace
         self.inplace = 0
     _build_ext.finalize_options(self)
Esempio n. 36
0
 def finalize_options(self):
     _build_ext.finalize_options(self)
Esempio n. 37
0
File: setup.py Progetto: yarv/sage
 def finalize_options(self):
     build_ext.finalize_options(self)
     self.check_flags()
Esempio n. 38
0
 def finalize_options(self):
     incl_dirs = self.include_dirs
     old_build_ext.finalize_options(self)
     if incl_dirs is not None:
         self.include_dirs.extend(self.distribution.include_dirs or [])
Esempio n. 39
0
 def finalize_options(self):
     build_ext.finalize_options(self)
     __builtins__.__NUMPY_SETUP__ = False
     import numpy
     self.include_dirs.append(numpy.get_include())
Esempio n. 40
0
 def finalize_options(self):
     build_ext.finalize_options(self)
     self.set_undefined_options('build', ('build_scripts', 'build_scripts'))
     self.extensions = self.distribution.exe_modules
Esempio n. 41
0
    def finalize_options(self):
        build_ext.finalize_options(self)    
        self.pfft_build_dir = os.path.join(self.build_temp, 'depends')

        self.include_dirs.insert(0, os.path.join(
                        self.pfft_build_dir, 'include'))
Esempio n. 42
0
 def finalize_options (self):
     if self.library_dirs is None:
         self.library_dirs = []
     
     self.library_dirs.insert(0, os.path.join(sys.real_prefix, "Libs"))
     old_build_ext.finalize_options(self)
Esempio n. 43
0
 def finalize_options(self):
     _build_ext.finalize_options(self)
     if self.enable_double:
         self.announce(
                 'will generate code for aubio compiled with HAVE_AUBIO_DOUBLE=1',
                 level=distutils.log.INFO)
Esempio n. 44
0
 def finalize_options(self):
     build_ext.finalize_options(self)
     self.EXT_MANAGER.patch_src()
     self.extensions = self.EXT_MANAGER.create_extensions()
     self.java_libs = self.EXT_MANAGER.create_java_libs()
Esempio n. 45
0
    def finalize_options(self):
        build_ext.finalize_options(self)
        self.set_undefined_options('build', ('static', 'static'))

        self.include_dirs = self.include_dirs or []
        self.library_dirs = self.library_dirs or []
        self.define = self.define or []
        self.libraries = self.libraries or []

        extra_compile_args = []
        extra_link_args = []

        compiler = self.compiler or get_default_compiler()

        if compiler == 'msvc':
            try:
                QL_INSTALL_DIR = os.environ['QL_DIR']
                self.include_dirs += [QL_INSTALL_DIR]
                self.library_dirs += [os.path.join(QL_INSTALL_DIR, 'lib')]
            except KeyError:
                print('warning: unable to detect QuantLib installation')

            if 'INCLUDE' in os.environ:
                dirs = [dir for dir in os.environ['INCLUDE'].split(';')]
                self.include_dirs += [d for d in dirs if d.strip()]
            if 'LIB' in os.environ:
                dirs = [dir for dir in os.environ['LIB'].split(';')]
                self.library_dirs += [d for d in dirs if d.strip()]
            dbit = round(math.log(sys.maxsize, 2) + 1)
            if dbit == 64:
                machinetype = '/machine:x64'
            else:
                machinetype = '/machine:x86'
            self.define += [('__WIN32__', None), ('WIN32', None),
                            ('NDEBUG', None), ('_WINDOWS', None),
                            ('NOMINMAX', None)]
            extra_compile_args = ['/GR', '/FD', '/Zm250', '/EHsc', '/bigobj']
            extra_link_args = ['/subsystem:windows', machinetype]

            if self.debug:
                if self.static:
                    extra_compile_args.append('/MTd')
                else:
                    extra_compile_args.append('/MDd')
            else:
                if self.static:
                    extra_compile_args.append('/MT')
                else:
                    extra_compile_args.append('/MD')

        elif compiler == 'unix':
            ql_compile_args = \
                os.popen('quantlib-config --cflags').read()[:-1].split()
            ql_link_args = \
                os.popen('quantlib-config --libs').read()[:-1].split()

            self.define += [(arg[2:], None) for arg in ql_compile_args
                            if arg.startswith('-D')]
            self.define += [('NDEBUG', None)]
            self.include_dirs += [
                arg[2:] for arg in ql_compile_args if arg.startswith('-I')
            ]
            self.library_dirs += [
                arg[2:] for arg in ql_link_args if arg.startswith('-L')
            ]
            self.libraries += [
                arg[2:] for arg in ql_link_args if arg.startswith('-l')
            ]

            extra_compile_args = [ arg for arg in ql_compile_args
                                   if not arg.startswith('-D')
                                   if not arg.startswith('-I') ] \
                                   + [ '-Wno-unused' ]
            if 'CXXFLAGS' in os.environ:
                extra_compile_args += os.environ['CXXFLAGS'].split()

            extra_link_args = [
                arg for arg in ql_link_args if not arg.startswith('-L')
                if not arg.startswith('-l')
            ]
            if 'LDFLAGS' in os.environ:
                extra_link_args += os.environ['LDFLAGS'].split()

        else:
            pass

        for ext in self.extensions:
            ext.extra_compile_args = ext.extra_compile_args or []
            ext.extra_compile_args += extra_compile_args

            ext.extra_link_args = ext.extra_link_args or []
            ext.extra_link_args += extra_link_args