Beispiel #1
0
def get_parser():
    prefix_dir = os.path.dirname(os.path.dirname(cocotb.__file__))
    version = cocotb.__version__
    python_bin = sys.executable

    parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
    parser.add_argument(
        "--prefix",
        help="echo the package-prefix of cocotb",
        action=PrintAction,
        text=prefix_dir,
    )
    parser.add_argument(
        "--share",
        help="echo the package-share of cocotb",
        action=PrintAction,
        text=share_dir,
    )
    parser.add_argument(
        "--makefiles",
        help="echo the package-makefiles of cocotb",
        action=PrintAction,
        text=makefiles_dir,
    )
    parser.add_argument(
        "--python-bin",
        help="echo the path to the Python binary cocotb is installed for",
        action=PrintAction,
        text=python_bin,
    )
    parser.add_argument(
        "--help-vars",
        help="show help about supported variables",
        action=PrintAction,
        text=help_vars_text(),
    )
    parser.add_argument(
        "-v",
        "--version",
        help="echo the version of cocotb",
        action=PrintAction,
        text=version,
    )
    parser.add_argument(
        "--libpython",
        help="prints the absolute path to the libpython associated with the current Python installation",
        action=PrintAction,
        text=find_libpython.find_libpython(),
    )

    return parser
Beispiel #2
0
    def set_env(self):

        for e in os.environ:
            self.env[e] = os.environ[e]

        self.env["LIBPYTHON_LOC"] = find_libpython.find_libpython()

        self.env["PATH"] += os.pathsep + self.lib_dir

        self.env["PYTHONPATH"] = os.pathsep.join(sys.path)
        for path in self.python_search:
            self.env["PYTHONPATH"] += os.pathsep + path

        self.env["PYTHONHOME"] = get_config_var("prefix")

        self.env["TOPLEVEL"] = self.toplevel_module
        self.env["MODULE"] = self.module

        if not os.path.exists(self.sim_dir):
            os.makedirs(self.sim_dir)
Beispiel #3
0
def get_parser():
    prefix_dir = os.path.dirname(os.path.dirname(cocotb.__file__))
    version = cocotb.__version__
    python_bin = sys.executable

    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawTextHelpFormatter)
    parser.add_argument(
        "--prefix",
        help="echo the package-prefix of cocotb",
        action=PrintAction,
        text=prefix_dir,
    )
    parser.add_argument(
        "--share",
        help="echo the package-share of cocotb",
        action=PrintAction,
        text=share_dir,
    )
    parser.add_argument(
        "--makefiles",
        help="echo the package-makefiles of cocotb",
        action=PrintAction,
        text=makefiles_dir,
    )
    parser.add_argument(
        "--python-bin",
        help="echo the path to the Python binary cocotb is installed for",
        action=PrintAction,
        text=python_bin,
    )
    parser.add_argument(
        "--help-vars",
        help="show help about supported variables",
        action=PrintAction,
        text=help_vars_text(),
    )
    parser.add_argument(
        "--libpython",
        help=
        "Print the absolute path to the libpython associated with the current Python installation",
        action=PrintAction,
        text=find_libpython.find_libpython(),
    )
    parser.add_argument(
        "--lib-dir",
        help="Print the absolute path to the interface libraries location",
        action=PrintAction,
        text=libs_dir)
    parser.add_argument(
        "--lib-name",
        help=
        'Print the name of interface library for given interface (VPI/VHPI/FLI) and simulator',
        nargs=2,
        metavar=('INTERFACE', 'SIMULATOR'),
        action=PrintFuncAction,
        function=lib_name)
    parser.add_argument(
        "--lib-name-path",
        help=
        'Print the absolute path of interface library for given interface (VPI/VHPI/FLI) and simulator',
        nargs=2,
        metavar=('INTERFACE', 'SIMULATOR'),
        action=PrintFuncAction,
        function=lib_name_path)
    parser.add_argument(
        "-v",
        "--version",
        help="echo the version of cocotb",
        action=PrintAction,
        text=version,
    )

    return parser
Beispiel #4
0
def _findlibpython():
    libpython_path = find_libpython.find_libpython()
    if libpython_path is None:
        sys.exit(1)
    return libpython_path