def finalize_options(self): BuildCLibBase.finalize_options(self) self._dest_folder = self._get_unqlite_build_dir() # Option 1: User specified a download URL if self.unqlite_url: self._unqlite_download_url = self.unqlite_url self._unqlite_archive_filename = \ os.path.basename(urlparse(self._unqlite_download_url).path) # Option 2: User specified at least a version elif self.unqlite_version: self._unqlite_archive_filename = 'unqlite-db-' if self.unqlite_release_date: self._unqlite_archive_filename += \ '{0}-'.format(self.unqlite_release_date.translate(None, '-')) self._unqlite_archive_filename += self.unqlite_version.translate(None, '.') self._unqlite_download_url = self._UNQLITE_BASE_URL + self._unqlite_archive_filename # Option 3: Assume a libunqlite has been pre-built and is accessible for the # 'build_ext' step using include and linker paths if not self._unqlite_archive_filename: self.libraries = [] else: # add the source information for lib in self.libraries: if lib[0] == 'unqlite': lib[1]['sources']= [os.path.join(self._dest_folder, 'unqlite.c')] lib[1]['include_dirs'] = []
def finalize_options(self): if self.jobs: try: self.jobs = int(self.jobs) except ValueError: raise ValueError("--jobs/-j argument must be an integer") old_build_clib.finalize_options(self) self.set_undefined_options('build', ('jobs', 'jobs'))
def finalize_options(self): if self.parallel: try: self.parallel = int(self.parallel) except ValueError: raise ValueError("--parallel/-j argument must be an integer") old_build_clib.finalize_options(self) self.set_undefined_options('build', ('parallel', 'parallel'))
def finalize_options(self): _build_clib.finalize_options(self) if self.build_flags is None: self.build_flags = { 'include_dirs': [], 'library_dirs': [], 'define': [], }
def finalize_options(self): build_clib.finalize_options(self) env = self.env() for lib_name, build_info in self.libraries: if 'sources' not in build_info: log.info("running 'autoreconf -v -i -f' for library '%s'", lib_name) check_call(['autoreconf', '-v', '-i', '-f'], cwd = build_info['local_source'], env = env)
def finalize_options(self): # Call super class. _build_clib.finalize_options(self) self.set_undefined_options('build', ('build_scripts', 'build_bin')) self.libraries = self.progs if self.libraries: self.check_library_list(self.libraries)
def finalize_options(self): """Run 'autoreconf -i' for any bundled libraries to generate the configure script.""" build_clib.finalize_options(self) for lib_name, build_info in self.libraries: if 'sources' not in build_info: log.info("checking if configure script for library '%s' exists", lib_name) if not os.path.exists(os.path.join(build_info['local_source'], 'configure')): log.info("running 'autoreconf -i' for library '%s'", lib_name) check_call(['autoreconf', '-i'], cwd=build_info['local_source'])
def finalize_options(self): build_clib.finalize_options(self) env = self.env() for lib_name, build_info in self.libraries: if 'sources' not in build_info: log.info("running 'autoreconf -v -i -f' for library '%s'", lib_name) check_call(['autoreconf', '-v', '-i', '-f'], cwd=build_info['local_source'], env=env)
def finalize_options(self): _build_clib.finalize_options(self) if self.build_flags is None: self.build_flags = { 'include_dirs': [], 'library_dirs': [], 'define': [], } self.build_flags["include_dirs"] = [ 'libsecp256k1/include', ]
def finalize_options(self): # We want build-clib to default to build-lib as defined by the "build" # command. This is so the compiled library will be put in the right # place along side the python code. self.set_undefined_options('build', ('build_lib', 'build_clib'), ('build_temp', 'build_temp'), ('compiler', 'compiler'), ('debug', 'debug'), ('force', 'force')) build_clib.finalize_options(self)
def finalize_options(self): old_build_clib.finalize_options(self) self.set_undefined_options('build_ext', ('fcompiler', 'fcompiler')) #XXX: This is hackish and probably unnecessary, # could we get rid of this? from scipy_distutils import misc_util extra_includes = misc_util.get_environ_include_dirs() if extra_includes: print "XXX: are you sure you'll need PYTHONINCLUDES env. variable??" self.include_dirs.extend(extra_includes) return
def finalize_options(self): if self.parallel: try: self.parallel = int(self.parallel) except ValueError as e: raise ValueError( "--parallel/-j argument must be an integer") from e old_build_clib.finalize_options(self) self.set_undefined_options( "build", ("parallel", "parallel"), ("warn_error", "warn_error"), ("cpu_baseline", "cpu_baseline"), ("cpu_dispatch", "cpu_dispatch"), ("disable_optimization", "disable_optimization"), )
def finalize_options(self): """Run 'autoreconf -i' for any bundled libraries to generate the configure script.""" build_clib.finalize_options(self) env = self.env() for lib_name, build_info in self.libraries: if "sources" not in build_info: log.info( "checking if configure script for library '%s' exists", lib_name ) if not os.path.exists( os.path.join(build_info["local_source"], "configure") ): log.info("running 'autoreconf -i' for library '%s'", lib_name) check_call( ["autoreconf", "-i"], cwd=build_info["local_source"], env=env )
def finalize_options(self): build_clib.finalize_options(self) compiler = new_compiler(compiler=self.compiler, verbose=self.verbose) customize_compiler(compiler) disabled_libraries = [] # Section for custom limits imposed on the SIMD instruction # levels based on the installed compiler plat_compiler = platform.python_compiler() if plat_compiler.lower().startswith('gcc'): log.info('gcc detected') # Check the installed gcc version, as versions older than # 7.0 claim to support avx512 but are missing some # intrinsics that FastNoiseSIMD calls. output = sub.check_output('gcc --version', shell=True) gcc_version = tuple([ int(x) for x in re.findall(b'\d+(?:\.\d+)+', output)[0].split(b'.') ]) if gcc_version < (7, 2): # Disable AVX512 log.info('Disabled avx512; not supported with gcc < 7.2.') disabled_libraries.append('avx512') if gcc_version < (4, 7): # Disable AVX2 log.info('Disabled avx2; not supported with gcc < 4.7.') disabled_libraries.append('avx2') elif plat_compiler.lower().startswith('msc'): # No versions of Windows Python support AVX512 yet, # it is supported in MSVC2017 only. # MSVC++ 14.1 _MSC_VER == 1911 (Visual Studio 2017) # MSVC++ 14.1 _MSC_VER == 1910 (Visual Studio 2017) # Python 3.5/3.6: MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015) # Python 3.4: MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010) # Python 2.7: MSVC++ 9.0 _MSC_VER == 1500 (Visual Studio 2008) # Here we just assume the user has the platform compiler msc_version = int( re.findall('v\.\d+', plat_compiler)[0].lstrip('v.')) if msc_version < 1910: disabled_libraries.append('avx512') if msc_version < 1900: disabled_libraries.append('avx2') # End of SIMD limits for name, lib in self.distribution.libraries: val = getattr(self, 'with_' + name) if val not in ('auto', 'yes', 'no'): raise DistutilsOptionError('with_%s flag must be auto, yes, ' 'or no, not "%s".' % (name, val)) if val == 'no': disabled_libraries.append(name) continue if not self.compiler_has_flags(compiler, name, lib['cflags']): if val == 'yes': # Explicitly required but not available. raise CCompilerError('%s is not supported by your ' 'compiler.' % (name, )) disabled_libraries.append(name) use_fma = False if (self.with_fma != 'no' and ('avx512' not in disabled_libraries or 'avx2' not in disabled_libraries)): if fma_flags is None: # No flags required. use_fma = True elif self.compiler_has_flags(compiler, 'fma', fma_flags): use_fma = True avx512['cflags'] += fma_flags avx2['cflags'] += fma_flags elif self.with_fma == 'yes': # Explicitly required but not available. raise CCompilerError('FMA is not supported by your compiler.') self.distribution.libraries = [ lib for lib in self.distribution.libraries if lib[0] not in disabled_libraries ] with open(SIMD_NOISE_SOURCES + '/x86_flags.h', 'wb') as fh: fh.write(b'// This file is generated by setup.py, ' b'do not edit it by hand\n') for name, lib in self.distribution.libraries: fh.write(b'#define FN_COMPILE_%b\n' % (name.upper().encode('ascii', ))) if use_fma: fh.write(b'#define FN_USE_FMA\n')
def finalize_options(self): build_clib.finalize_options(self) if self.compiler is None: # we use this variable with tox to build using GCC on Windows. # https://bitbucket.org/hpk42/tox/issues/274/specify-compiler self.compiler = os.environ.get("DISTUTILS_COMPILER", None)
def finalize_options(self): """ Validate custom command line switches values """ build_clib.finalize_options(self)