Merge pull request #66 from mithro/fix-travis
Install tox inside the conda environment.
diff --git a/.travis.yml b/.travis.yml
index dabf64f..a361894 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,17 +1,14 @@
-language: python
-
-matrix:
- include:
- - python: 3.7
- env: TOXENV=py37
+language: minimal
install:
- - . prepareenv.sh
- - conda activate yosys-env
+ - source prepareenv.sh
- source .github/travis/check_license.sh
- source .github/travis/check_python_script.sh
-script: tox
+script:
+ - conda activate yosys-env
+ - which tox
+ - tox
notifications:
email: false
diff --git a/conf/environment.yml b/conf/environment.yml
index 08fb66b..c7a801f 100644
--- a/conf/environment.yml
+++ b/conf/environment.yml
@@ -3,3 +3,6 @@
- symbiflow
dependencies:
- yosys
+ - pip:
+ - tox
+ - flake8
diff --git a/prepareenv.sh b/prepareenv.sh
index 5193fa0..1c89efe 100755
--- a/prepareenv.sh
+++ b/prepareenv.sh
@@ -8,7 +8,6 @@
#
# SPDX-License-Identifier: ISC
-pip install tox
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
source "$HOME/miniconda/etc/profile.d/conda.sh"
@@ -17,3 +16,4 @@
conda install -q setuptools
conda update -q conda
conda env create --file conf/environment.yml
+conda activate yosys-env
diff --git a/v2x/lib/asserts.py b/v2x/lib/asserts.py
index 8f5b4ad..b2d7b5c 100644
--- a/v2x/lib/asserts.py
+++ b/v2x/lib/asserts.py
@@ -60,14 +60,14 @@
assert_type(obj, classes)
-def assert_len_eq(l):
+def assert_len_eq(v):
"""Check all lists in a list are equal length"""
# Sanity check
- max_len = max(len(p) for p in l)
- for i, p in enumerate(l):
+ max_len = max(len(p) for p in v)
+ for i, p in enumerate(v):
assert len(
p
) == max_len, "Length check failed!\n \
-l[{}] has {} elements != {} ({!r})\n{!r}".format(
- i, len(p), max_len, p, l
+v[{}] has {} elements != {} ({!r})\n{!r}".format(
+ i, len(p), max_len, p, v
)
diff --git a/v2x/vlog_to_pbtype.py b/v2x/vlog_to_pbtype.py
index 74fa32a..8c4f8c7 100755
--- a/v2x/vlog_to_pbtype.py
+++ b/v2x/vlog_to_pbtype.py
@@ -383,8 +383,8 @@
else:
return pin
- for l in interconn.values():
- l.sort(key=pin_sort)
+ for v in interconn.values():
+ v.sort(key=pin_sort)
return interconn
@@ -452,7 +452,7 @@
raise NameError("No cell named {}".format(shortname))
-def get_list_name_and_length(l: List[str]) -> Tuple[str, int]:
+def get_list_name_and_length(v: List[str]) -> Tuple[str, int]:
"""
>>> get_list_name_and_length(['i[{}]'.format(i) for i in range(10)])
('i', 10)
@@ -502,21 +502,21 @@
>>> get_list_name_and_length(['i[1][{}]'.format(i) for i in range(4)])
('i[1]', 4)
"""
- if not l:
+ if not v:
return True
- assert '[' in l[0], "No index brackets found in item 0: {}\n{}".format(
- l[0], l
+ assert '[' in v[0], "No index brackets found in item 0: {}\n{}".format(
+ v[0], v
)
- list_name = l[0][:l[0].rfind('[')]
- sl = sorted(l, key=len)
- for i in range(0, len(l)):
+ list_name = v[0][:v[0].rfind('[')]
+ sl = sorted(v, key=len)
+ for i in range(0, len(v)):
expected_item = "{}[{}]".format(list_name, i)
assert expected_item == sl[
i], "index {} expected: {} != actual: {}\n{}".format(
i, expected_item, sl[i], sl
)
- return list_name, len(l)
+ return list_name, len(v)
def make_ports(clocks, mod, pb_type_xml, only_type=None):
@@ -700,8 +700,8 @@
attrs["max"] = splitspec[1]
else:
assert iodir == "input", \
- "Only input ports can have {} timing definition."
- "Port {}, direction {}.".format(xmltype, port, iodir)
+ ("Only input ports can have {} timing definition."
+ "Port {}, direction {}.").format(xmltype, port, iodir)
attrs["value"] = splitspec[1]
ET.SubElement(xml_parent, xmltype, attrs)
diff --git a/v2x/yosys/run.py b/v2x/yosys/run.py
index 2852133..25b4e82 100755
--- a/v2x/yosys/run.py
+++ b/v2x/yosys/run.py
@@ -110,7 +110,7 @@
emsg += "Yosys failed with exit code {}\n".format(retcode)
emsg += "Command: '{}'\n".format(" ".join(cmd))
emsg += "Message:\n"
- emsg += "\n".join([" " + l for l in stderr.splitlines()])
+ emsg += "\n".join([" " + v for v in stderr.splitlines()])
raise subprocess.CalledProcessError(retcode, cmd, emsg)