python3 compatibility

This commit is contained in:
Simon John 2014-04-02 17:57:58 +01:00
parent 392a6b9db1
commit c080fb29b7
5 changed files with 12 additions and 8 deletions

View file

@ -17,6 +17,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Add: Add phony target to run pre-build hook script (https://github.com/jrid)
- Fix: Add BOOTLOADER_PARENT to `arduino-mk-vars.md` and fixed BOOTLOADER_PATH example. (https://github.com/sej7278)
- Tweak: Replace perl reset script with Python script. (https://github.com/sej7278)
- Tweak: Made choice of Python2/3 interpreter up to the OS. (https://github.com/peplin)
### 1.3.1 (2014-02-04)
- Fix: BUNDLED_AVR_TOOLS_DIR is now set properly when using only arduino-core and not the whole arduino package. (https://github.com/sej7278)

View file

@ -1,5 +1,6 @@
#!/usr/bin/python
#!/usr/bin/env python
from __future__ import print_function
import serial
import os.path
import argparse
@ -13,7 +14,7 @@ parser.add_argument('port', nargs=1, help='Serial device e.g. /dev/ttyACM0')
args = parser.parse_args()
if args.caterina:
if args.verbose: print 'Forcing reset using 1200bps open/close on port %s' % args.port[0]
if args.verbose: print('Forcing reset using 1200bps open/close on port %s' % args.port[0])
ser = serial.Serial(args.port[0], 57600)
ser.close()
ser.open()
@ -24,12 +25,12 @@ if args.caterina:
sleep(1)
while not os.path.exists(args.port[0]):
if args.verbose: print 'Waiting for %s to come back' % args.port[0]
if args.verbose: print('Waiting for %s to come back' % args.port[0])
sleep(1)
if args.verbose: print '%s has come back after reset' % args.port[0]
if args.verbose: print('%s has come back after reset' % args.port[0])
else:
if args.verbose: print 'Setting DTR high on %s for %ss' % (args.port[0],args.period)
if args.verbose: print('Setting DTR high on %s for %ss' % (args.port[0],args.period))
ser = serial.Serial(args.port[0], 115200)
ser.setDTR(False)
sleep(args.period)

View file

@ -7,7 +7,7 @@ or [Ubuntu](https://launchpad.net/ubuntu/+source/arduino-mk) or use apt.
First install the dependencies for building/running the package, as root:
apt-get build-dep arduino-mk
apt-get install arduino-core build-essential dpkg-dev fakeroot devscripts python-serial
apt-get install arduino-core build-essential dpkg-dev fakeroot devscripts python-serial python3-serial
Fetch the Debian source:

View file

@ -2,7 +2,7 @@
First install the dependencies as root:
yum install arduino-core rpm-build pyserial
yum install arduino-core rpm-build pyserial python3-pyserial
From the top-level Arduino-Makefile directory you've checked out of github, run the following (as unprivileged user) to create a compressed tarball using the naming conventions required by rpmbuild:

View file

@ -10,7 +10,7 @@ License: LGPLv2+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: arduino-core pyserial
BuildRequires: arduino-core pyserial
BuildRequires: arduino-core pyserial python3-pyserial
%description
Arduino is an open-source electronics prototyping platform based on
@ -49,6 +49,8 @@ rm -rf %{buildroot}
%{_docdir}/%{name}/examples
%changelog
* Wed Apr 02 2014 Simon John <git@the-jedi.co.uk>
- Added BuildRequires of python3-pyserial. Need to look into Requires.
* Mon Mar 24 2014 Simon John <git@the-jedi.co.uk>
- Replaced perl/help2man with pyserial for reset script.
* Tue Feb 04 2014 Simon John <git@the-jedi.co.uk>