Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit fb004ba

Browse files
authored
basic python 3 support (dronekit#655)
* basic python 3 support * pyenv support * test python 2 and 3 on travis * test py 2.7 3.5 on circleci * debug travis nose tests * install to virtualenv
1 parent f2a531a commit fb004ba

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.project
22
.pydevproject
3+
.python-version
34
dronekit.egg-info
45
dist
56
build

.travis.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ env:
55

66
python:
77
- "2.7"
8+
- "3.5"
89

910
install:
10-
- 'sudo pip install . -UI'
11-
- 'sudo pip install -r requirements.txt -UI'
11+
- 'pip install -r requirements.txt'
1212

1313
script:
14-
- 'nosetests -svx dronekit.test.unit'
15-
- 'nosetests -svx dronekit.test.sitl'
14+
- 'nosetests --debug=nose,nose.importer --debug-log=nose_debug -svx dronekit.test.unit'
15+
- 'nosetests --debug=nose,nose.importer --debug-log=nose_debug -svx dronekit.test.sitl'
1616

1717
git:
1818
depth: 10
1919

20-
language: objective-c
20+
language: python
2121

2222
notifications:
2323
email: false
@@ -34,6 +34,3 @@ matrix:
3434
branches:
3535
only:
3636
- master
37-
- patch
38-
- major
39-
- minor

circle.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
machine:
2+
post:
3+
- pyenv global 2.7.10 3.5.0
24
environment:
35
SITL_SPEEDUP: 10
46
SITL_RATE: 200

dronekit/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import re
4141
from dronekit.util import errprinter
4242
from pymavlink import mavutil, mavwp
43-
from Queue import Queue, Empty
43+
from queue import Queue, Empty
4444
from threading import Thread
4545
import types
4646
import threading
@@ -1208,7 +1208,7 @@ def listener(self, name, msg):
12081208
def listener(self, name, msg):
12091209
self._home_location = LocationGlobal(msg.latitude/1.0e7, msg.longitude/1.0e7, msg.altitude/1000.0);
12101210
self.notify_attribute_listeners('home_location', self.home_location, cache=True)
1211-
1211+
12121212
@self.on_message(['WAYPOINT', 'MISSION_ITEM'])
12131213
def listener(self, name, msg):
12141214
if not self._wp_loaded:
@@ -1530,10 +1530,10 @@ def _mode_mapping_bynumber(self):
15301530
return mavutil.mode_mapping_bynumber(self._vehicle_type)
15311531

15321532
def _is_mode_available(self, custommode_code, basemode_code=0):
1533-
try:
1534-
if self._autopilot_type == mavutil.mavlink.MAV_AUTOPILOT_PX4:
1533+
try:
1534+
if self._autopilot_type == mavutil.mavlink.MAV_AUTOPILOT_PX4:
15351535
mode = mavutil.interpret_px4_mode(basemode_code, custommode_code)
1536-
return mode in self._mode_mapping
1536+
return mode in self._mode_mapping
15371537
return custommode_code in self._mode_mapping_bynumber
15381538
except:
15391539
return False
@@ -1553,7 +1553,7 @@ def mode(self):
15531553

15541554
@mode.setter
15551555
def mode(self, v):
1556-
if self._autopilot_type == mavutil.mavlink.MAV_AUTOPILOT_PX4:
1556+
if self._autopilot_type == mavutil.mavlink.MAV_AUTOPILOT_PX4:
15571557
self._master.set_mode(v.name)
15581558
else:
15591559
self._master.set_mode(self._mode_mapping[v.name])

dronekit/mavlink.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from dronekit import APIException
1212
from dronekit.util import errprinter
1313
from pymavlink import mavutil, mavwp
14-
from Queue import Queue, Empty
14+
from queue import Queue, Empty
1515
from threading import Thread
1616
import types
1717

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pymavlink==2.0.6
22
monotonic==1.2
3+
future==0.15.2
34
nose==1.3.7
45
mock==2.0.0
56
dronekit-sitl==3.1.0

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
author='3D Robotics',
1313
install_requires=[
1414
'pymavlink==2.0.6',
15-
'monotonic==1.2'
15+
'monotonic==1.2',
16+
'future==0.15.2'
1617
],
1718
1819
classifiers=[

0 commit comments

Comments
 (0)