Skip to content

Commit

Permalink
Merge pull request #596 from VUnit/no-python27
Browse files Browse the repository at this point in the history
Remove Python 2.7 support
  • Loading branch information
kraigher committed Dec 1, 2019
2 parents 16cb38a + 72236b6 commit 157fae6
Show file tree
Hide file tree
Showing 47 changed files with 53 additions and 217 deletions.
9 changes: 2 additions & 7 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,20 @@ environment:
matrix:

# For Python versions available on Appveyor, see
# http://www.appveyor.com/docs/installed-software#python
# https://www.appveyor.com/docs/windows-images-software/#python

- BUILD_NAME: py27-unit
PYTHON: "C:\\Python27"
- BUILD_NAME: py35-unit
PYTHON: "C:\\Python35"

- BUILD_NAME: py38-unit
PYTHON: "C:\\Python38"

- BUILD_NAME: py38-lint
PYTHON: "C:\\Python38"

- BUILD_NAME: py27-docs
PYTHON: "C:\\Python27"
- BUILD_NAME: py38-docs
PYTHON: "C:\\Python38"

- BUILD_NAME: py27-acceptance-ghdl
PYTHON: "C:\\Python27"
- BUILD_NAME: py38-acceptance-ghdl
PYTHON: "C:\\Python38"

Expand Down
4 changes: 2 additions & 2 deletions .github/images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
set -e

docker build \
--build-arg IMAGE="python:$PYVER-slim-buster" \
--build-arg IMAGE="python:3-slim-buster" \
--build-arg LLVM_VER=7 \
--build-arg GNAT_VER=8 \
--target vunit \
-t "vunit/dev:${TAG}" \
- <<-EOF
$(curl -fsSL https://raw.githubusercontent.com/ghdl/docker/master/dockerfiles/run_debian)
FROM $TGT AS vunit
FROM $TAG AS vunit
COPY --from=ghdl/pkg:buster-$PKG / /test
RUN tar xzf \$(ls /test/ghdl-*) -C /usr/local/ \\
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ jobs:
build:
strategy:
fail-fast: false
max-parallel: 3
max-parallel: 2
matrix:
task: [
{ tag: llvm, pyver: 3, tgt: llvm, pkg: llvm-7 },
{ tag: mcode, pyver: 3, tgt: mcode, pkg: mcode },
{ tag: mcode-2, pyver: 2, tgt: mcode, pkg: mcode },
{ tag: llvm, pkg: llvm-7 },
{ tag: mcode, pkg: mcode },
]
runs-on: ubuntu-latest
env:
Expand All @@ -29,10 +28,8 @@ jobs:
- uses: actions/checkout@v1
- name: build image
env:
TAG: ${{ matrix.task.tag }}
PYVER: ${{ matrix.task.pyver }}
TGT: ${{ matrix.task.tgt }}
PKG: ${{ matrix.task.pkg }}
TAG: ${{ matrix.task.tag }}
PKG: ${{ matrix.task.pkg }}
run: |
./.github/images.sh
- name: docker login
Expand Down
15 changes: 3 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,13 @@ matrix:
include:
- &docker
env:
- BUILD_NAME=py27-acceptance-ghdl
- DOCKER_IMAGE=mcode-2
- BUILD_NAME=py38-acceptance-ghdl
- DOCKER_IMAGE=llvm
services: docker
language: minimal
install: skip
script: docker run --rm -tv $(pwd):/src -w /src vunit/dev:$DOCKER_IMAGE tox -e $BUILD_NAME

- <<: *docker
env:
- BUILD_NAME=py38-acceptance-ghdl
- DOCKER_IMAGE=llvm

- <<: *docker
env:
- BUILD_NAME=py38-vcomponents-ghdl
Expand All @@ -38,18 +33,13 @@ matrix:
python: '3.8'


- env: BUILD_NAME=py27-unit
python: '2.7'
- env: BUILD_NAME=py35-unit
python: '3.5'
- env: BUILD_NAME=py38-unit
dist: xenial
python: '3.8'


- env: BUILD_NAME=py27-docs
python: '2.7'
before_script: git fetch --unshallow --tags
- env: BUILD_NAME=py38-docs
python: '3.8'
before_script: git fetch --unshallow --tags
Expand All @@ -66,6 +56,7 @@ matrix:
repo: VUnit/vunit
branch: master


# Deploy to PyPI whenever the package version has changed
# When a package version has not changed a new upload will not be triggered
- stage: deploy
Expand Down
5 changes: 1 addition & 4 deletions docs/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ Operating systems
Python
******

- Python 3.4 or higher
- Python 2.7

- VUnit support for Python 2.7 will end in 1 Jan 2020 when it reaches end of life.
- Python 3.5 or higher

Simulators
**********
Expand Down
10 changes: 3 additions & 7 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ The test suite is divided into three parts:
**tests/lint/**
Style checks such as pycodestyle and license header verification.

The test suites must pass with both Python 2.7 and Python 3.x as well
as with all supported simulators.
The test suites must pass with Python 3.x as well as with all supported simulators.

For running the test locally we recommend using `pytest <https://pypi.python.org/pypi/pytest>`__.

Expand All @@ -63,9 +62,6 @@ Dependencies
Other than the dependencies required to use VUnit as a user the
following are also required for developers to run the test suite manually:

`mock <https://pypi.python.org/pypi/mock>`__
For Python 2.7 only, built into Python 3.x

`pycodestyle <https://pypi.python.org/pypi/pycodestyle>`__
Coding style check.

Expand Down Expand Up @@ -168,13 +164,13 @@ PyPI with pip:
For most developers, running the full testsuite will likely lead to failed test
cases because not all Python interpreters or HDL simulators are installed in
their environment. More focused testing is possible by specifying which tox
"environments" should be tested. For example, assume a developer uses Python 2.7
"environments" should be tested. For example, assume a developer uses Python 3.8
and Modelsim and would like to test changes using tools available in his
environment:

.. code-block:: console
vunit/ > tox -e py27-unit,py27-acceptance-modelsim
vunit/ > tox -e py38-unit,py38-acceptance-modelsim
A full list of test environments can be seen by issuing the following command:

Expand Down
1 change: 0 additions & 1 deletion examples/vhdl/vivado/vivado_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#
# Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com

from __future__ import print_function
from subprocess import check_call
import os
from os.path import join, exists, abspath, dirname, basename
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def find_all_files(directory, endings=None):
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Natural Language :: English",
"Intended Audience :: Developers",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
Expand All @@ -72,6 +71,7 @@ def find_all_files(directory, endings=None):
"Topic :: Software Development :: Testing",
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
],
python_requires=">=3.5",
install_requires=["colorama"],
requires=["colorama"],
license=["Mozilla Public License 2.0 (MPL 2.0)"],
Expand Down
1 change: 0 additions & 1 deletion tests/lint/test_license.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""
License header sanity check
"""
from __future__ import print_function

import unittest
from warnings import simplefilter, catch_warnings
Expand Down
19 changes: 0 additions & 19 deletions tests/mock_2or3.py

This file was deleted.

8 changes: 1 addition & 7 deletions tests/unit/non_utf8_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,5 @@
# pylint: skip-file
from sys import stdout

if hasattr(stdout, "buffer"):
# Python 3
stdout.buffer.write(b"a" + b"\x87" + b"c")
else:
# Python 2.7
stdout.write(b"a" + b"\x87" + b"c")

stdout.buffer.write(b"a" + b"\x87" + b"c")
stdout.write("\n")
2 changes: 1 addition & 1 deletion tests/unit/test_activehdl_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from os.path import join, dirname, exists
import os
from shutil import rmtree
from tests.mock_2or3 import mock
from unittest import mock
from vunit.sim_if.activehdl import ActiveHDLInterface, VersionConsumer, Version
from vunit.project import Project
from vunit.ostools import renew_path, write_file
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""

import unittest
from tests.mock_2or3 import mock
from unittest import mock
from vunit.builtins import BuiltinsAdder


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_cds_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""

import unittest
from tests.mock_2or3 import mock
from unittest import mock
from vunit.sim_if.cds_file import CDSFile


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import unittest
import contextlib
from os.path import join
from tests.mock_2or3 import mock
from unittest import mock
from tests.common import with_tempdir, create_tempdir
from tests.unit.test_test_bench import Entity
from vunit.configuration import Configuration, AttributeException
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_ghdl_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from os.path import join, dirname, exists
import os
from shutil import rmtree
from tests.mock_2or3 import mock
from unittest import mock
from tests.unit.test_test_bench import Entity
from vunit.sim_if.ghdl import GHDLInterface
from vunit.project import Project
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_incisive_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from os.path import join, dirname, exists, basename
import os
from shutil import rmtree
from tests.mock_2or3 import mock
from unittest import mock
from vunit.sim_if.incisive import IncisiveInterface
from vunit.project import Project
from vunit.ostools import renew_path, write_file, read_file
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_modelsim_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from os.path import join, dirname, exists
import os
from shutil import rmtree
from tests.mock_2or3 import mock
from unittest import mock
from tests.common import set_env
from vunit.sim_if.modelsim import ModelSimInterface
from vunit.project import Project
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import os
from time import sleep
import itertools
from tests.mock_2or3 import mock
from unittest import mock
from vunit.exceptions import CompileError
from vunit.ostools import renew_path, write_file
from vunit.project import Project
Expand Down Expand Up @@ -1940,7 +1940,7 @@ def update(self, source_file):
self.project.update(source_file)

def assert_should_recompile(self, source_files):
self.assert_count_equal(source_files, self.project.get_files_in_compile_order())
self.assertCountEqual(source_files, self.project.get_files_in_compile_order())

def assert_compiles(self, source_file, before):
"""
Expand Down Expand Up @@ -1992,8 +1992,8 @@ def assert_has_entity(

for entity in source_file.library.get_entities():
if entity.name == name:
self.assert_count_equal(entity.generic_names, generic_names)
self.assert_count_equal(entity.architecture_names, architecture_names)
self.assertCountEqual(entity.generic_names, generic_names)
self.assertCountEqual(entity.architecture_names, architecture_names)
return

self.assertFalse("Did not find entity " + name + "in " + source_file.name)
Expand Down Expand Up @@ -2051,10 +2051,6 @@ def _find_design_unit( # pylint: disable=too-many-arguments

return None

def assert_count_equal(self, values1, values2):
# Python 2.7 compatability
self.assertEqual(sorted(values1), sorted(values2))


def tick():
sleep(0.01)
2 changes: 1 addition & 1 deletion tests/unit/test_rivierapro_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from os.path import join, dirname, exists
import os
from shutil import rmtree
from tests.mock_2or3 import mock
from unittest import mock
from vunit.sim_if.rivierapro import RivieraProInterface
from vunit.project import Project
from vunit.ostools import renew_path, write_file
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_simulator_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import os
import subprocess
from shutil import rmtree
from tests.mock_2or3 import mock
from unittest import mock
from vunit.project import Project
from vunit.sim_if import (
SimulatorInterface,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_test_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import unittest
from os.path import join

from tests.mock_2or3 import mock
from unittest import mock
from tests.common import with_tempdir, get_vhdl_test_bench
from vunit.test.bench import (
TestBench,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_test_bench_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from os.path import join

from tests.unit.test_test_bench import Entity, Module
from tests.mock_2or3 import mock
from unittest import mock
from tests.common import with_tempdir
from vunit.test.bench_list import TestBenchList, tb_filter

Expand Down
4 changes: 1 addition & 3 deletions tests/unit/test_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
Test the test runner
"""

from __future__ import print_function

import unittest
from os.path import join, abspath

from tests.mock_2or3 import mock
from unittest import mock
from tests.common import with_tempdir
from vunit.hashing import hash_string
from vunit.test.runner import TestRunner, create_output_path
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""

from unittest import TestCase
from tests.mock_2or3 import mock
from unittest import mock
from vunit.parsing.tokenizer import describe_location


Expand Down
Loading

0 comments on commit 157fae6

Please sign in to comment.