mirror of
https://github.com/YosysHQ/yosys
synced 2025-10-09 01:11:58 +00:00
- Rewrite all Python features to use the pybind11 library instead of boost::python. Unlike boost::python, pybind11 is a header-only library that is just included by Pyosys code, saving a lot of compile time on wheels. - Factor out as much "translation" code from the generator into proper C++ files - Fix running the embedded interpreter not supporting "from pyosys import libyosys as ys" like wheels - Move Python-related elements to `pyosys` directory at the root of the repo - Slight shift in bridging semantics: - Containers are declared as "opaque types" and are passed by reference to Python - many methods have been implemented to make them feel right at home without the overhead/ambiguity of copying to Python and then copying back after mutation - Monitor/Pass use "trampoline" pattern to support virual methods overridable in Python: virtual methods no longer require `py_` prefix - Create really short test set for pyosys that just exercises basic functionality
20 lines
523 B
Python
20 lines
523 B
Python
|
|
import os
|
|
import sys
|
|
|
|
sys.setdlopenflags(os.RTLD_NOW | os.RTLD_GLOBAL)
|
|
|
|
__dir__ = os.path.abspath(os.path.dirname(__file__))
|
|
sys._pyosys_dir = os.path.abspath(__dir__)
|
|
|
|
bin_ext = ".exe" if os.name == "nt" else ""
|
|
|
|
_share_candidate = os.path.join(__dir__, "share")
|
|
if os.path.isdir(_share_candidate):
|
|
sys._pyosys_share_dirname = _share_candidate + os.path.sep
|
|
|
|
_abc_candidate = os.path.join(__dir__, f"yosys-abc{bin_ext}")
|
|
if os.path.isfile(_abc_candidate):
|
|
sys._pyosys_abc = _abc_candidate
|
|
|
|
__all__ = ["libyosys"]
|