def how_to_gen(source, target, env, for_signature): env.Alias('mkhowto', target) html_dir = env.get('html_dir', None) if html_dir is None: name = splitext(split(str(source[0]))[-1])[0] html_dir = join("#", 'html', name) dir = env.Dir(html_dir) MKHOWTO = WhereIs('mkhowto') or os.environ.get('MKHOWTO') MKHOWTO = env.get('MKHOWTO', MKHOWTO) env['MKHOWTO'] = MKHOWTO mk_act = ("${TEXINPUTS and 'TEXINPUTS='}${':'.join(TEXINPUTS)} " "${MKHOWTO} --quiet --html --dir=%(dir)s " "${ADDRESS and '--address='}${ADDRESS} " "${UP_LINK and '--up-link='}${UP_LINK} " "${UP_TITLE and '--up-title='}${'\"'+str(UP_TITLE)+'\"'} " "${SOURCE}" % vars()) mk_act_str = "mkhowto --html --dir=${TARGET.dir} " mkhowto_action = Action(mk_act, mk_act_str) Mkdir(str(dir)) return [mkhowto_action]
def load_mpi(mpi): """global function to load MPI into os.environ""" # On Ubuntu, MPI stacks use alternatives and need root to change their # pointer, so just verify that the desired MPI is loaded if distro.id() == "ubuntu": updatealternatives = WhereIs('update-alternatives') if not updatealternatives: print("No update-alternatives found in path.") return False try: proc = Popen([updatealternatives, '--query', 'mpi'], stdout=PIPE) except OSError as error: print("Error running update-alternatives") if error.errno == errno.ENOENT: return False for line in proc.stdout.readlines(): if line.startswith(b"Value:"): if line[line.rfind(b".")+1:-1].decode() == mpi: return True return False return False if _env_module.env_module_init is None: _env_module.env_module_init = _env_module() return _env_module.env_module_init.load_mpi(mpi)
def _find_indent(): """find clang-format""" indent = WhereIs("clang-format") if indent is None: return None if _supports_custom_format(indent): style = "file" else: style = "Mozilla" return "%s --style=%s" % (indent, style)
def load_mpi(self, mpi): """Invoke the mpi loader""" if not self._module_load(mpi): print("No %s found\n" % mpi) return False exe_path = WhereIs('mpirun') if not exe_path: print("No mpirun found in path. Could not configure %s\n" % mpi) return False self.setup_pkg_config(exe_path) return True
def _find_mpicc(env): """find mpicc""" mpicc = WhereIs('mpicc') if mpicc: env.Replace(CC="mpicc") env.Replace(LINK="mpicc") env.AppendUnique(CPPDEFINES=["-DDAOS_MPI_PATH=\"%s\"" % mpicc]) _clear_icc_env(env) load_mpi_path(env) compiler_setup.base_setup(env) return True return False
def _find_mpicc(env): """find mpicc""" mpicc = WhereIs('mpicc') if not mpicc: return False env.Replace(CC="mpicc") env.Replace(LINK="mpicc") env.PrependENVPath('PATH', os.path.dirname(mpicc)) compiler_setup.base_setup(env) return True
def _mpi_module_old(self, mpi): """attempt to load the requested module""" load = [] for key, value in self._mpi_map.items(): if key == mpi: load = value self._module_func('purge') for to_load in load: self._module_func('load', to_load) print("Looking for %s" % to_load) if WhereIs('mpirun'): print("Loaded %s" % to_load) return True return False
def find_indent(): """find clang-format""" indent = WhereIs("clang-format") if indent is not None: style = "Mozilla" # fallback root = Dir("#").abspath while root != "/": if os.path.exists(os.path.join(root, ".clang-format")): if not supports_custom_format(indent): break style = "file" root = os.path.dirname(root) return "%s --style=%s" % (indent, style) return "cat"
def exists(env): return WhereIs("sphinx-build")
"+jtag_vpi_enable=1", ]), "Running Verilator", ), "Start Verilator", ) # # Target: Generate bitstream # vivado_path = "" vivado_tcl_script = "" vivado_design_project = "" if "generate_bitstream" in COMMAND_LINE_TARGETS: vivado_path = WhereIs("vivado") if not vivado_path: sys.stderr.write("Error: Couldn't find Vivado tools!\n") env.Exit(1) vivado_tcl_script = os.path.abspath( board_config.get("build.swervolf_run_tc", "swervolf_0.6_run.tcl")) vivado_design_project = os.path.abspath( board_config.get("build.swervolf_xpr", "swervolf_0.6.xpr")) for f in (vivado_tcl_script, vivado_design_project): if not os.path.isfile(f): sys.stderr.write("Error: Couldn't find file %s\n" % f) env.Exit(1)
# the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # from Utilities import whereis from SCons.Script import Delete, Touch, WhereIs epydoc_cli = WhereIs('epydoc') if not epydoc_cli: try: import epydoc except ImportError: epydoc = None else: # adding Epydoc builder using imported module def epydoc_builder_action(target, source, env): """ Take a list of `source` files and build docs for them in `target` dir. `target` and `source` are lists.
def load_mpi_path(env): """Load location of mpicc into path if MPI_PKG is set""" mpicc = WhereIs('mpicc') if mpicc: env.PrependENVPath("PATH", os.path.dirname(mpicc))
def exists(env): return WhereIs('sphinx-build')