Exemple #1
0
    def run(self):
        if has_nvcc(self):
            # run clib build. Or, clib won't be build with such command as 'pip
            # install -e .'

            build_clib = self.get_finalized_command('build_nvcc')
            build_clib.force = self.force
            build_clib.compiler = None  # bug in distutils?

            build_clib.run()

            clibdir = build_clib.build_clib
            self.libraries.extend(build_clib.get_library_names() or [])
            self.library_dirs.append(clibdir)

            deps = [
                build_clib.compiler.library_filename(name, output_dir=clibdir)
                for name in build_clib.get_library_names()]

            for ext in self.extensions:
                ext.depends += deps

        orig_build_ext.run(self)
Exemple #2
0
 def run(self):
     log.info('running custom_build_clib')
     build_clib.run(self)
Exemple #3
0
 def run(self):
     run_triggers('build_clib', 'pre', args=(self,))
     build_clib.run(self)
     run_triggers('build_clib', 'post', args=(self,))
Exemple #4
0
 def run(self):
     return build_clib.run(self)
Exemple #5
0
 def run(self):
     log.info('running custom_build_clib')
     build_clib.run(self)
Exemple #6
0
 def run(self):
     # Uncomment the line below if you want to check if the C library
     # is installed and in your path.
     # ret_val = self.check_extensions()
     build_path = self.build_library('ccl')
     BuildCLib.run(self)
Exemple #7
0
 def run(self):
     run_triggers('build_clib', 'pre', args=(self, ))
     build_clib.run(self)
     run_triggers('build_clib', 'post', args=(self, ))
Exemple #8
0
                        local_archive_file.write(download.read())
                    archive_downloaded = True
                    
            except HTTPError, e:
                log.error('HTTP Error: {0} {1}'.format(e.code, self._unqlite_download_url))
                raise
            except URLError, e:
                log.error('URL Error: {0} {1}'.format(e.reason, self._unqlite_download_url))
                raise        
        
        # extract the source files only if they don't exist or no recent
        # download was made
        log.info('Checking if archive extracted: ' + self._unqlite_archive_filename)
        source_extracted = os.path.exists(os.path.join(self._dest_folder, 'unqlite.h')) and \
            os.path.exists(os.path.join(self._dest_folder, 'unqlite.c'))
        if archive_downloaded or not source_extracted:
            log.info('Extracting archive: ' + self._unqlite_archive_filename)
            if not self.dry_run:
                with ZipFile(unqlite_archive_path) as archive_file:
                    archive_file.extractall(self._dest_folder)

        # check if the library has already been built (fix for OS X)
        # TODO this should also check timestamps of source files
        log.info('Checking if unqlite was already built')
        compiler = ccompiler.new_compiler()
        if compiler.find_library_file([self.build_clib], 'unqlite'):
            return	
                    
        # run the build
        BuildCLibBase.run(self)
Exemple #9
0
 def run(self):
     log.info('running PyFDPCustomBuildClib')
     build_clib.run(self)
Exemple #10
0
 def run(self):
     log.info('running build_dynamic_clib')
     build_clib.run(self)
 def run(self):
     log.info('running build_dynamic_clib')
     build_clib.run(self)
Exemple #12
0
 def run(self):
     log.info('running PyFDPCustomBuildClib')
     build_clib.run(self)
Exemple #13
0
    def run(self):
        self.libraries = [('secp256k1', {
            'sources': ['libsecp256k1/src/secp256k1.c'],
            'include_dirs': ['libsecp256k1/src', 'libsecp256k1']
        })]
        self.define = [
            ('USE_NUM_NONE', 1),
            ('USE_FIELD_10X26', 1),
            #            ('USE_FIELD_5X52', 1),
            ('USE_FIELD_INV_BUILTIN', 1),
            #            ('USE_FIELD_INV_NU', 1),
            #            ('USE_SCALAR_4X64', 1),
            ('USE_SCALAR_8X32', 1),
            ('USE_SCALAR_INV_BUILTIN', 1),
            #           ('USE_SCALAR_INV_NUM', )
            ('ENABLE_MODULE_ECDH', 1),
            ('ENABLE_MODULE_SCHNORR', 1),
            ('ENABLE_MODULE_RECOVERY', 1),
            ('ENABLE_MODULE_RANGEPROOF', 1),
        ]
        return _build_clib.run(self)
        # Note: bypass UNIX-only build path
        if has_system_lib():
            log.info("Using system library")
            return

        build_temp = os.path.abspath(self.build_temp)

        try:
            os.makedirs(build_temp)
        except OSError as e:
            if e.errno != errno.EEXIST:
                raise

        if not os.path.exists(absolute("libsecp256k1/configure")):
            # configure script hasn't been generated yet
            autogen = absolute("libsecp256k1/autogen.sh")
            os.chmod(absolute(autogen), 0o755)
            subprocess.check_call(
                [autogen],
                cwd=absolute("libsecp256k1"),
            )

        for filename in [
                "libsecp256k1/configure",
                "libsecp256k1/build-aux/compile",
                "libsecp256k1/build-aux/config.guess",
                "libsecp256k1/build-aux/config.sub",
                "libsecp256k1/build-aux/depcomp",
                "libsecp256k1/build-aux/install-sh",
                "libsecp256k1/build-aux/missing",
                "libsecp256k1/build-aux/test-driver",
        ]:
            try:
                os.chmod(absolute(filename), 0o755)
            except OSError as e:
                # some of these files might not exist depending on autoconf version
                if e.errno != errno.ENOENT:
                    # If the error isn't "No such file or directory" something
                    # else is wrong and we want to know about it
                    raise

        cmd = [
            absolute("libsecp256k1/configure"), "--disable-shared",
            "--enable-static", "--disable-dependency-tracking", "--with-pic",
            "--enable-module-recovery", "--prefix",
            os.path.abspath(self.build_clib)
        ]
        if os.environ.get('SECP_BUNDLED_WITH_BIGNUM'):
            log.info("Building with bignum support (requires libgmp)")
            cmd.extend(["--with-bignum=gmp"])
        else:
            cmd.extend(["--without-bignum"])

        if os.environ.get('SECP_BUNDLED_EXPERIMENTAL') or True:
            log.info("Building experimental")
            cmd.extend([
                "--enable-experimental",
                "--enable-module-ecdh",
                "--enable-module-schnorr",
                "--enable-module-rangeproof",
            ])

        log.debug("Running configure: {}".format(" ".join(cmd)))
        subprocess.check_call(
            cmd,
            cwd=build_temp,
        )

        subprocess.check_call(["make"], cwd=build_temp)
        subprocess.check_call(["make", "install"], cwd=build_temp)

        self.build_flags['include_dirs'].extend(
            build_flags('libsecp256k1', 'I', build_temp))
        self.build_flags['library_dirs'].extend(
            build_flags('libsecp256k1', 'L', build_temp))
        if not has_system_lib():
            self.build_flags['define'].append(('CFFI_ENABLE_RECOVERY', None))
        else:
            pass