Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: YoWASP/yosys
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9af43216303c
Choose a base ref
...
head repository: YoWASP/yosys
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5b8037b4377a
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Oct 7, 2021

  1. Verified

    This commit was signed with the committer’s verified signature.
    Swatinem Arpad Borsos
    Copy the full SHA
    4ae03d9 View commit details
  2. Use upstream YOSYS_VER variable verbatim when computing version.

    After Yosys 0.10, commits on the master branch no longer follow
    the version tag, making the use of `setuptools_scm.parse` impossible.
    whitequark committed Oct 7, 2021
    Copy the full SHA
    33f7191 View commit details
  3. Prepend YoWASP Python module path to sys.path, not append.

    Otherwise a wrong version of the supporting modules can be picked up
    if YoWASP Yosys is installed concurrently with a native one.
    whitequark committed Oct 7, 2021
    Copy the full SHA
    5b8037b View commit details
Showing with 16 additions and 9 deletions.
  1. +6 −4 pypi/setup.py
  2. +10 −5 pypi/yowasp_yosys/__init__.py
10 changes: 6 additions & 4 deletions pypi/setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import re
from setuptools import setup, find_packages
from setuptools_scm.git import parse as parse_git


def version():
upstream_git = parse_git("../yosys-src")
if upstream_git.exact:
upstream_version = upstream_git.format_with("{tag}")
with open("../yosys-src/Makefile", "r") as f:
yosys_version = re.search(r"^YOSYS_VER := ([\d.]+)\+(\d+)$", f.read(), re.M)
if yosys_version[2] == "0":
upstream_version = yosys_version[1]
else:
upstream_version = upstream_git.format_with("{tag}.post{distance}")
upstream_version = yosys_version[1] + ".post" + yosys_version[2]

package_git = parse_git("..")
if not package_git.dirty:
15 changes: 10 additions & 5 deletions pypi/yowasp_yosys/__init__.py
Original file line number Diff line number Diff line change
@@ -27,10 +27,15 @@ def _run_wasm_app(wasm_filename, argv):
wasi_cfg.argv = argv
wasi_cfg.preopen_dir(str(importlib_resources.files(__package__) / "share"), "/share")
wasi_cfg.preopen_dir(_tempdir.name, "/tmp")
wasi_cfg.preopen_dir("/", "/")
if os.name == "nt":
for letter in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ":
wasi_cfg.preopen_dir(letter + ":\\", letter + ":")
else:
wasi_cfg.preopen_dir("/", "/")
wasi_cfg.preopen_dir(".", ".")
# sby needs to run `yowasp-yosys -ql ../model/design.log ../model/design.ys`
wasi_cfg.preopen_dir("..", "..")
for level in range(len(pathlib.Path().cwd().parts)):
wasi_cfg.preopen_dir(str(pathlib.Path("").joinpath(*[".."] * level)),
"/".join([".."] * level))
wasi_cfg.inherit_stdin()
wasi_cfg.inherit_stdout()
wasi_cfg.inherit_stderr()
@@ -76,7 +81,7 @@ def _run_yosys_argv():

def _run_yosys_smtbmc_argv():
prefix = importlib_resources.files(__package__)
sys.path.append(str(prefix / "share" / "python3"))
sys.path[0:0] = [str(prefix / "share" / "python3")]
smtbmc_py = prefix / "smtbmc.py"
with open(smtbmc_py) as f:
globals = {}
@@ -85,7 +90,7 @@ def _run_yosys_smtbmc_argv():

def _run_sby_argv():
prefix = importlib_resources.files(__package__)
sys.path.append(str(prefix / "share" / "python3"))
sys.path[0:0] = [str(prefix / "share" / "python3")]
sby_py = prefix / "sby.py"
with open(sby_py) as f:
globals = {}