-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing pyvsc fails on pyboolector for python 3.11.5 on Linux (Arch) #190
Comments
Hi @alwilson, appreciate the heads-up on this. I've created a PR on the Boolector project to support for 3.11 and 3.12. You can find that here: |
Also, there are some minor unit test regressions due to 3.11. Coverpoint bin names use str() to get the enum name, but it looks like that now returns the enum value instead. Also, some uses of random.sample() hit a type error now that wants the population arg to be a sequence. Here's some quick fixes I made, not sure if it works for 3.10 though and not sure about the enum workaround since it doesn't return the enum instance name as well. diff --git a/src/vsc/coverage.py b/src/vsc/coverage.py
index 2567db6..55ae833 100644
--- a/src/vsc/coverage.py
+++ b/src/vsc/coverage.py
@@ -820,7 +820,7 @@ class coverpoint(object):
for v in enum_bins.range_l:
e = ei.v2e_m[v[0]]
- self.model.add_bin_model(CoverpointBinEnumModel(str(e), v[0]))
+ self.model.add_bin_model(CoverpointBinEnumModel(e.name, v[0]))
elif isinstance(self.cp_t, type_base):
binspec = RangelistModel()
diff --git a/src/vsc/model/coverpoint_cross_model.py b/src/vsc/model/coverpoint_cross_model.py
index ff387b9..3776aef 100644
--- a/src/vsc/model/coverpoint_cross_model.py
+++ b/src/vsc/model/coverpoint_cross_model.py
@@ -93,7 +93,7 @@ class CoverpointCrossModel(CoverItemBase):
def select_unhit_bin(self, r:RandIF)->int:
if len(self.unhit_s) > 0:
- return random.sample(self.unhit_s, 1)[0]
+ return random.sample(sorted(self.unhit_s), 1)[0]
else:
return -1
diff --git a/src/vsc/model/rand_info_builder.py b/src/vsc/model/rand_info_builder.py
index b661b4f..5b16be7 100644
--- a/src/vsc/model/rand_info_builder.py
+++ b/src/vsc/model/rand_info_builder.py
@@ -159,7 +159,7 @@ class RandInfoBuilder(ModelVisitor,RandIF):
return self._rng.randint(low,high)
def sample(self, s, k):
- return self._rng.sample(s, k)
+ return self._rng.sample(sorted(s), k)
def visit_constraint_block(self, c):
if RandInfoBuilder.EN_DEBUG:
diff --git a/ve/unit/test_coverage_driven_constraints.py b/ve/unit/test_coverage_driven_constraints.py
index 7921623..a22701d 100644
--- a/ve/unit/test_coverage_driven_constraints.py
+++ b/ve/unit/test_coverage_driven_constraints.py
@@ -24,7 +24,7 @@ class TestCoverageDrivenConstraints(VscTestCase):
return low
def sample(self, s, k):
- return random.sample(s, k)
+ return random.sample(sorted(s), k)
@vsc.randobj
diff --git a/ve/unit/test_coverage_enum.py b/ve/unit/test_coverage_enum.py
index abf911a..6f97f99 100644
--- a/ve/unit/test_coverage_enum.py
+++ b/ve/unit/test_coverage_enum.py
@@ -31,8 +31,8 @@ class TestCoverageEnum(VscTestCase):
v = my_e.B
cg.sample()
- self.assertEqual(cg.cp.get_model().get_bin_name(0), "my_e.A")
- self.assertEqual(cg.cp.get_model().get_bin_name(1), "my_e.B")
+ self.assertEqual(cg.cp.get_model().get_bin_name(0), "A")
+ self.assertEqual(cg.cp.get_model().get_bin_name(1), "B")
# def test_bin_names_enum(self):
#
@@ -81,10 +81,10 @@ class TestCoverageEnum(VscTestCase):
v = my_e.D
cg.sample()
- self.assertEqual(cg.cp.get_model().get_bin_name(0), "my_e.A")
- self.assertEqual(cg.cp.get_model().get_bin_name(1), "my_e.B")
- self.assertEqual(cg.cp.get_model().get_bin_name(2), "my_e.C")
- self.assertEqual(cg.cp.get_model().get_bin_name(3), "my_e.D")
+ self.assertEqual(cg.cp.get_model().get_bin_name(0), "A")
+ self.assertEqual(cg.cp.get_model().get_bin_name(1), "B")
+ self.assertEqual(cg.cp.get_model().get_bin_name(2), "C")
+ self.assertEqual(cg.cp.get_model().get_bin_name(3), "D")
self.assertEqual(cg.cp.get_coverage(), 100) |
That PR went through and pyboolector installs fine now. Sounds like they'll be fixing up some other version issues in the next release. Thanks @mballance! |
Arch linux upgraded to python 3.11 back in April '23. I think the pyboolector pypi package is only built up to 3.10 currently.
Anything I can do to help? I attempted to build the pypi package in the boolector project, but I don't know enough about python packages. I can get Boolector and the python API to build, but getting the package built seems like a different challenge.
Originally posted here back in May: Boolector/boolector#207
Output:
Currently I can get around things with the pyboolector.so library I built by running:
The text was updated successfully, but these errors were encountered: