Skip to content

Commit 84290e4

Browse files
committed
Merge branch '37-drop-python-2'
Closes florisla#37
2 parents 4e020f7 + c9c0ba7 commit 84290e4

File tree

10 files changed

+10
-26
lines changed

10 files changed

+10
-26
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ matrix:
2121
sudo: required # necessary for Python 3.8?
2222

2323
# Test using nox on non-native Python version 3.6
24-
# (nox does not natively run on 2.7 / 3.4)
25-
- python: "3.6"
26-
env: NOXSESSION="tests-2.7"
24+
# (nox does not natively run on 3.4)
2725
- python: "3.6"
2826
env: NOXSESSION="tests-3.4"
2927

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ST Microelectronics STM32 microcontrollers over UART.
1212
Also supports ST BlueNRG devices, and the SweetPeas bootloader
1313
for Wiznet W7500.
1414

15-
Compatible with Python version 3.4 to 3.8 or 2.7.
15+
Compatible with Python version 3.4 to 3.8.
1616

1717

1818
Usage

noxfile.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import nox
66

77

8-
@nox.session(python=["2.7", "3.4", "3.5", "3.6", "3.7", "3.8"])
8+
@nox.session(python=["3.4", "3.5", "3.6", "3.7", "3.8"])
99
def tests(session):
1010
"""
1111
Install stm32loader package and execute unit tests.
@@ -19,8 +19,6 @@ def tests(session):
1919
rmtree("./dist", ignore_errors=True)
2020
session.install(".")
2121
session.install("pytest")
22-
if session.python == "2.7":
23-
session.install("mock")
2422
session.chdir("tests")
2523
session.run("pytest", "./")
2624

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11

22
[tool.black]
33
line-length = 98
4-
# not including py27 since that triggers black
5-
# to change print("") into print ("")
6-
target-version = ['py34', 'py35', 'py36', 'py37']
4+
target-version = ['py34', 'py35', 'py36', 'py37', 'py38']
75
exclude = '''
86
/(
97
\.git

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bdist_wheel]
2-
universal = 1
2+
universal = 0
33

44
[metadata]
55
license_file = LICENSE

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
URL = 'https://github.com/florisla/stm32loader'
1717
1818
AUTHOR = 'Floris Lambrechts'
19-
REQUIRES_PYTHON = '>=2.7.0'
19+
REQUIRES_PYTHON = '>=3.4.0'
2020
PROJECT_URLS = {
2121
"Bug Tracker": "https://github.com/florisla/stm32loader/issues",
2222
"Source Code": "https://github.com/florisla/stm32loader",
@@ -63,8 +63,6 @@
6363
classifiers=[
6464
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
6565
'Programming Language :: Python',
66-
'Programming Language :: Python :: 2',
67-
'Programming Language :: Python :: 2.7',
6866
'Programming Language :: Python :: 3',
6967
'Programming Language :: Python :: 3.4',
7068
'Programming Language :: Python :: 3.5',

stm32loader/bootloader.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
"""Talk to an STM32 native bootloader (see ST AN3155)."""
2121

2222

23-
from __future__ import print_function
24-
2523
import math
2624
import operator
2725
import struct
@@ -291,8 +289,8 @@ def write(self, *data):
291289

292290
def write_and_ack(self, message, *data):
293291
"""Write data to the MCU and wait until it replies with ACK."""
294-
# this is a separate method from write() because a keyword
295-
# argument after *args is not possible in Python 2
292+
# Note: this is a separate method from write() because a keyword
293+
# argument after *args was not possible in Python 2
296294
self.write(*data)
297295
return self._wait_for_ack(message)
298296

stm32loader/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
"""Flash firmware to STM32 microcontrollers over a serial connection."""
2222

2323

24-
from __future__ import print_function
25-
2624
import getopt
2725
import os
2826
import sys

stm32loader/uart.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@
2323
Offer support for toggling RESET and BOOT0.
2424
"""
2525

26-
# not naming this file itself 'serial', because that name-clashes in Python 2
26+
# This file not named 'serial' because that name-clashed in Python 2
2727
import serial
2828

2929

30-
class SerialConnection(object): # pylint: disable=useless-object-inheritance
30+
class SerialConnection:
3131
"""Wrap a serial.Serial connection and toggle reset and boot0."""
3232

33-
# Note: inheriting from object is required for Python2 setters
34-
# https://stackoverflow.com/questions/598077/why-does-foo-setter-in-python-not-work-for-me
35-
3633
# pylint: disable=too-many-instance-attributes
3734

3835
def __init__(self, serial_port, baud_rate=115200, parity="E"):

tests/integration/test_stm32loader.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ def test_erase_resets_memory_to_all_ones(stm32loader, dump_file):
121121
stm32loader("-e")
122122
# read all bytes and check if they're 0xFF
123123
stm32loader("-r", "-l", "1024", dump_file)
124-
# bytearray() is required for Python 2
125124
read_data = bytearray(open(dump_file, "rb").read())
126125
assert all(byte == 0xFF for byte in read_data)
127126

0 commit comments

Comments
 (0)