Skip to content

Commit 6a86d58

Browse files
Remove python2 compatibility code (#564)
* Remove Python2 checks Remove Python2 code snippets * Fix smaller errors Remove Python2 from checks, CI stuff and more * Fix missing imports Add missing closing braket * Remve pypy2 from CI * Should fix unawaited coroutines which may cause CI to timeout * replace old coroutine style Co-authored-by: dhoomakethu <[email protected]>
1 parent 018d618 commit 6a86d58

File tree

129 files changed

+718
-1076
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+718
-1076
lines changed

.github/pythonpackage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
python-version: '3.x'
1616
- name: Install dependencies
1717
run: |
18-
python -m pip install --upgrade pip
18+
python3 -m pip install --upgrade pip
1919
pip install setuptools wheel twine
2020
- name: Build and publish
2121
env:
2222
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2323
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2424
run: |
25-
python setup.py sdist bdist_wheel
25+
python3 setup.py sdist bdist_wheel
2626
twine upload dist/*

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ jobs:
3737
3.7: docker://python:3.7-buster
3838
3.8: docker://python:3.8-buster
3939
3.9: docker://python:3.9-buster
40-
pypy2: docker://pypy:2-jessie
4140
pypy3: docker://pypy:3-stretch
4241
- name: macOS
4342
runs-on: macos-latest

CHANGELOG.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ version 3.0.0dev1
1414
* Fix for lazy loading serial module with asyncio clients.
1515
* Updated examples and tests
1616

17-
1817
version 3.0.0dev0
1918
----------------------------------------------------------
2019
* Support python3.7 and above

Makefile

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,12 @@ check: install
4141

4242
test: install
4343
@pip install --upgrade --quiet --requirement=requirements-tests.txt
44-
ifeq ($(PYVER),3.6)
45-
$(info Running tests on $(PYVER))
46-
@pip install --upgrade pip --quiet
47-
@pytest --cov=pymodbus/ --cov-report term-missing test/test_server_asyncio.py test
48-
@coverage report --fail-under=85 -i
49-
else ifeq ($(PYVER),2.7)
50-
$(info Running tests on $(PYVER))
51-
@pip install pip==20.3.4 --quiet
52-
@pytest --cov-config=.coveragerc --cov=pymodbus/ --cov-report term-missing --ignore test/test_server_asyncio.py --ignore test/test_client_async_asyncio.py test
53-
@coverage report --fail-under=90 -i
54-
else
55-
$(info Running tests on $(PYVER))
56-
@pip install --upgrade pip --quiet
57-
@pytest --cov=pymodbus/ --cov-report term-missing test
58-
@coverage report --fail-under=85 -i
59-
endif
44+
45+
$(info Running tests on $(PYVER))
46+
@pip install --upgrade pip --quiet
47+
@pytest --cov=pymodbus/ --cov-report term-missing test
48+
@coverage report --fail-under=85 -i
49+
6050

6151
tox: install
6252
@pip install --upgrade --quiet tox && tox

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Summary
2323
Pymodbus is a full Modbus protocol implementation using twisted/tornado/asyncio for its
2424
asynchronous communications core. It can also be used without any third
2525
party dependencies (aside from pyserial) if a more lightweight project is
26-
needed. Furthermore, it should work fine under any python version > 2.7
26+
needed. Furthermore, it should work fine under any python version >= 3.7
2727
(including python 3+)
2828

2929

doc/INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Requirements
22
-------------
33

4-
* Python 2.7 or later.
4+
* Python 3.7 or later.
55
* Python Twisted, Tornado or asyncio (For async client and server)
66
* Pyserial
77

doc/api/doxygen/build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
'''
33
Doxygen API Builder
44
---------------------
@@ -29,8 +29,8 @@ def which(program):
2929
return None
3030

3131
if which('doxygen') is not None:
32-
print "Building Doxygen API Documentation"
32+
print("Building Doxygen API Documentation")
3333
os.system("doxygen .doxygen")
3434
if os.path.exists('../../../build'):
3535
shutil.move("html", "../../../build/doxygen")
36-
else: print "Doxygen not available...not building"
36+
else: print("Doxygen not available...not building")

doc/api/epydoc/build.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
'''
33
Epydoc API Runner
44
------------------
@@ -27,12 +27,12 @@
2727
if not os.path.exists("./html"):
2828
os.mkdir("./html")
2929

30-
print "Building Epydoc API Documentation"
30+
print( "Building Epydoc API Documentation")
3131
cli()
3232

3333
if os.path.exists('../../../build'):
3434
shutil.move("html", "../../../build/epydoc")
35-
except Exception, ex:
35+
except Exception as ex:
3636
import traceback,sys
3737
traceback.print_exc(file=sys.stdout)
38-
print "Epydoc not avaliable...not building"
38+
print( "Epydoc not avaliable...not building")

doc/api/pydoc/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
Pydoc sub-class for generating documentation for entire packages.
44
@@ -447,7 +447,7 @@ def recurseScan(self, objectList):
447447
if not os.path.exists("./html"):
448448
os.mkdir("./html")
449449

450-
print "Building Pydoc API Documentation"
450+
print( "Building Pydoc API Documentation")
451451
PackageDocumentationGenerator(
452452
baseModules = ['pymodbus', '__builtin__'],
453453
destinationDirectory = "./html/",

doc/api/pydoctor/build.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
'''
33
Pydoctor API Runner
44
---------------------
@@ -19,9 +19,10 @@
1919
--html-output=html
2020
--html-write-function-pages --make-html'''.split()
2121

22-
print "Building Pydoctor API Documentation"
22+
print( "Building Pydoctor API Documentation")
2323
main(sys.argv[1:])
2424

2525
if os.path.exists('../../../build'):
2626
shutil.move("html", "../../../build/pydoctor")
27-
except: print "Pydoctor unavailable...not building"
27+
except:
28+
print( "Pydoctor unavailable...not building")

0 commit comments

Comments
 (0)